Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How do YOU plan & design your code ?? #252700
02/19/09 19:58
02/19/09 19:58
Joined: Apr 2008
Posts: 437
dracula Offline OP
Senior Member
dracula  Offline OP
Senior Member

Joined: Apr 2008
Posts: 437
I was curious as to what techniques and approaches people use to design and code games in Lite-C.
When you start thinking about a coding a game you must think about breaking it into functions. How these functions are called and interact needs to be planned.

How do YOU plan and design your games ?

Thanks

Re: How do YOU plan & design your code ?? [Re: dracula] #252707
02/19/09 20:51
02/19/09 20:51
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
i use boxes,flowcharts. I think , take notes, revise the flowchar till t's perfect.

(like a map, first a whole world overview flowchart, then for more detiailed flowcharts, so on.)

i am not sure if that d work well for large projects tho.


3333333333
Re: How do YOU plan & design your code ?? [Re: dracula] #252716
02/19/09 22:00
02/19/09 22:00
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
The game design is really, for me, an inspiration thing. Keep a notepad handy and jot ideas down as they appear.
Inspired by other games(note the game so you dont get too similar), movies and music all work well for me.
Go out of your way to watch movies of that theme, no matter how good they look, little details/scenes are what work.


I dont think my coding approach is NOT the best for everybody, but it works for me.

1: Break it up into MAJOR blocks that interact minimally. (ie menus, game, in-game-menus, configs)

2: Make each of the MAJOR blocks a separate include, with the main .C file containing no actual coding for now,
just the include statements, and maybe splashscreen/titles screens.

3: Start with the non-game blocks and get them 'functional', even if the bells and whistles are missing till later,
beause these blocks will change as the game develops/mutates over time, especially the in-game menus.

Now it starts to get blurry, it depends a lot on the game type. But usually start with a basic level
with crude entity models and build on that.

4: Initially get a crude level built and concentrate on getting ALL the player movements/physics right,
then build the final, fully-animated player model and tests his movements and make sure they still work OK.
Tweak as necessary.

5: Give life to your enemies with limited AI, give them their life etc. And animate.
Create the final model and all animations. For ALL the enemies there will be in the entire game.

6: Create all weapons and their special effects/damages and test them with player on movement limited enemies.

7: Create animate and animated-background models, special effects, sky-scenes etc.

8: Design and implement the actual levels with actual graphics/models/animated backgrounds, and test before putting in
any before player or enemies.

9: Design and implement level changing system.

10: Finalise and bugtest other MAJOR modules.(main menu etc)

And thats pretty much it.


As for functions and there names, once again this works for me, but maybe not for all.
A: Build a single function to do everything for a specific entity and include the entities type in the name.
EG player_action()

B: As the function grows, you may see code being repeated, split that off into s separate function.
EG player_do_gravity

B1: Sometimes the split-off code will be useful to other entities. Than name it generically.
EG entity_do_gravity

C: As you create new entitys code, you'll find bits in it repeat, or nearly repeat code in other entity-functions.
Split that off in both entities and tweak to be multi-entity generic code like B1.

D: If the function gets too big, split off large sections that live inside the same IF statement.
In the end we will want our action to be as small as possible to speeds sake.

E: Once its all done remember, each ACTION type function should be small, as it may be running in
multiple instances so smaller is better. Calling another function when needed is better than having
it clogging up memory when its not needed, especially multiple times.


That will do, my fingers are getting sore...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: How do YOU plan & design your code ?? [Re: EvilSOB] #252718
02/19/09 22:10
02/19/09 22:10
Joined: Sep 2008
Posts: 76
Max_Prower Offline
Junior Member
Max_Prower  Offline
Junior Member

Joined: Sep 2008
Posts: 76
I just chug along with it one little piece at a time. Usually starting with menus.

Re: How do YOU plan & design your code ?? [Re: Max_Prower] #252753
02/20/09 03:33
02/20/09 03:33
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

I do a sketch of what I want
Then
I have a practice areas sssssss.

one work_alpha ....for text, strings...

one work_struct ....for struct

And when it works I bring it back to the big one

They all use the same models, tga, pcx ....folders

Ottawa.

Re: How do YOU plan & design your code ?? [Re: Ottawa] #252792
02/20/09 08:11
02/20/09 08:11
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
I do it likeinthe rpg-maker xp

Game_Variables.c
Game_Strins.c
Game_Hero.c
...and so on

That gives me muchorganisation power, and can give ready projects to others, and they understand everything.


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: How do YOU plan & design your code ?? [Re: Espér] #252795
02/20/09 08:33
02/20/09 08:33
Joined: Apr 2008
Posts: 437
dracula Offline OP
Senior Member
dracula  Offline OP
Senior Member

Joined: Apr 2008
Posts: 437
I have only just started to think about this as up until now my programs have been small testing programs. Now I want to design a bigger project and it occured to me that just jumping in with code would be almost impossible.

For me, the hardest part is knowing what functions to create. I suppose there will always been several ways of appoaching it but generally there must be some rules or wisdom about what makes a function. Also, how do you decide what goes in the main game loop and what goes into a function. Your excellent responses have given me some good ideas !

Thanks

Re: How do YOU plan & design your code ?? [Re: dracula] #252808
02/20/09 12:59
02/20/09 12:59
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
my game uses as few whiles/waits as possible.
Means:
Main-while-loop: every environment function that has to start every frame
Function-intern-while: every function with an other waittime than 1

And because nearly everything in an japano-rpg has the same waittime, the main-while is big ^^



Ps.: my scripts are organized itself.
From the script Top to the bottom
Name -> description -> functions -> actions -> mainloop

Defines and includes are in a seperated script (best overview above all scripts ^^)


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: How do YOU plan & design your code ?? [Re: Espér] #252878
02/20/09 23:52
02/20/09 23:52
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
I try to keep as close to polymorphistic as possible, as generic as possible and as object oriented as possible.

A few of my own rules coming to mind:
- Each function processes their gained data, and forgets about it.
- As few global variables as possible.
- Every object (structure + assigned function) manages the lower objects, and never vice versa.
- Never allocate memory and pass the pointer to higher objects. Instead, create the memory block on the level where you use it, and remove it there as well.
- Everything is managed by the game loop.

But there's much more to do in proper ways, using various techniques. Handling object states... using events... using observers, adapters, factories... I don't know the best way to do this stuff, but I'd gladly read a fifty page article about it all (not that 50 would be enough at all). Anyone up for a write? grin


Click and join the 3dgs irc community!
Room: #3dgs
Re: How do YOU plan & design your code ?? [Re: Joozey] #252909
02/21/09 10:32
02/21/09 10:32
Joined: Apr 2008
Posts: 437
dracula Offline OP
Senior Member
dracula  Offline OP
Senior Member

Joined: Apr 2008
Posts: 437
Originally Posted By: Joozey

- Every object (structure + assigned function) manages the lower objects, and never vice versa.


When you say 'structure' do you mean structure as in C language or something within Lite-C like an entity (which is a kind of structure ?)

Thanks


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1