|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
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
Senior Expert
|
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
Expert
|
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: Espér]
#252878
02/20/09 23:52
02/20/09 23:52
|
Joined: Oct 2004
Posts: 4,134 Netherlands
Joozey
Expert
|
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? 
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
OP
Senior Member
|
OP
Senior Member
Joined: Apr 2008
Posts: 437
|
- 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
|
|
|
|