Jump to content
  • Advertisement


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



This topic is 6065 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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.


Share this post

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

| |-main.cpp
| |-main.h
| |-dxinput.cpp
| |-dxinput.h
| |-Terrain.cpp
| |-Terrain.h
| |-myOpenGL.cpp
| |-myOpenGL.h

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
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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!