Advertisement

Organizing my project

Started by January 01, 2003 01:05 PM
2 comments, last by olle55 21 years, 10 months ago
Hello! I was re-organizing my game, dividing it to several files etc. And i ran into some trouble, mainly how should i name my files? Or, i mean.. how should i split it up? As it is now, which feels very dirty, i have:
  
graphics.cpp  ( graphics init and shutdown )
sound.cpp( sound init and shutdown )
main.cpp ( render(), nextfram(), game init, game shutdown, etc
winmain.cpp ( window basecode and message proc )

ball.cpp ( the ball class )
bricks.cpp ( the brick class )
paddle.cpp (paddle class )
  
I dont know why, but it just feels sloppy somehow, as the game is starting to get bigger, i find almost everything to endup in main.cpp. What i want to ask is, do anyone know an article on how do split up you project in a nice way and file naming? Or maybe you have some advice.. Thanks in advance!
IMO it makes up for much readable code when you split class, function etc. declarations into .h files and then the definition into the .c/.cpp files. My 2 Euro cents. :D
- Just another sad bastard
Advertisement
There are several reasons for breaking you files into smaller more manageable file -- my suggestion draw a diagram -- not necessarily for flow (but that would be nice) but a diagram showing what goes where, relationships. Search for organizing files on gameDev.net -- you''ll find some good help there. Then I think the biggest benefit is in the debugging. When you have only a small portion of code to check, and fining where it "might" be in small code bundles, and testing for a single answer. Broken peice code is great. But I come from a procedural background it only seems logical that way. Use good naming or its just going to frustrate you.

Good luck

" ''No one has control -- control is just a fantasy. And being human is difficult.'' "
"Education is when you read the fine print; experience is what you get when you don't." -Pete Seegerwww.lucid-edge.net
There are several reasons for breaking your files into smaller more manageable files -- my suggestion draw a diagram -- not necessarily for flow (but that would be nice) but a diagram showing what goes where, relationships. Search for organizing files on gameDev.net -- you''ll find some good help there. Then I think the biggest benefit is in the debugging. When you have only a small portion of code to check, and fining where it "might" be in small code bundles, and testing for a single answer. Broken peice code is great. But I come from a procedural background it only seems logical that way. Use good naming or its just going to frustrate you.

Good luck

" ''No one has control -- control is just a fantasy. And being human is difficult.'' "
"Education is when you read the fine print; experience is what you get when you don't." -Pete Seegerwww.lucid-edge.net

This topic is closed to new replies.

Advertisement