Skip to main content
gamedev.net
🔒 Locked

Order

Started by Nullio Dec 9, 2001 at 3:49 PM 2 replies 250+ views
Original Post
Nullio
Nullio
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?
LOWORBIT
LOWORBIT
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
-Scott
terminate
terminate
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.
Those who dance are considered insane by those who cannot hear the music.
Fallen_Angel
Fallen_Angel
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.