Archived

This topic is now archived and is closed to further replies.

Nullio

Order

Recommended Posts

Nullio    122
I was just wondering how you guys set up all your files that are used in a large project? do you have all your code in one file? or do you split it up? how do you split it up?

Share this post


Link to post
Share on other sites
LOWORBIT    122
Be it working with on a large group of people, or programming on my own, I always break up the files into classes. Right now i''m working on a 3d engine for school, sound/input/graphics/windows i abstract everything, so in the furture i can reuse them. Here;s an example, that engine right now as i think 20 seperate files. cobject.cpp cobject.h winmain.h winmain.cpp clist.cpp clist.h sound.cpp sound.h graphics.h graphics.cpp inputdi8.cpp inputdi8.h clight.h clight.cpp and so on. Basically every seperate thing get''s it''s own class and can run on it''s own. Not only does this allow seperate people to work on the code it also allows you to reuse code with little to no modifications.

-Scott

Share this post


Link to post
Share on other sites
terminate    259
I usually use something like this for large projects



+-code
|
+-Main
| |-main.cpp
| |-main.h
|
+-Input
| |-dxinput.cpp
| |-dxinput.h
|
+-Graphics
| |-Terrain.cpp
| |-Terrain.h
| |-myOpenGL.cpp
| |-myOpenGL.h
|
+-Ect



for a file layout, and then each h/cpp contains a class definition and implementation.

Share this post


Link to post
Share on other sites
Fallen_Angel    138
Well this is only my first game so I can''t really guarantee that this is a good way to do it, however it resembles the methods that the above people are using. It''s basically the way I learnt in Ian Parberry''s book and helps to keep each type class separate.

defines .h - Just holds global definitions; screen height/width etc
main .cpp - Main game loop
ddraw .cpp - DirectDraw functions
bmp .h/cpp - Loading bitmaps
sprite .h/cpp - Handles sprite images
objects .h/cpp - All game objects
objman .h/cpp - Manipulates game objects, movement, life etc
input .h/cpp - DirectInput
text .h/cpp - Font class
timer .h/cpp - Game timer
midi .h/cpp - Background music
wav .h/cpp - Wav files
ai .h/cpp - Just started ai for game.

Hope this helps at all.

Share this post


Link to post
Share on other sites