Archived

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

Object Oriented Design Tutorials

This topic is 6162 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 am a newcomer and I have almost finished my first game but it consists of one source file that is around 6500 lines long. How do I make my game in modules (AI, Physics, etc.) so the game is broken up into many small .cpp files? I can''t find any step by step tutorials on how to link these files together.

Share this post


Link to post
Share on other sites
That''s hardly OOD and lots & lots of files isn''t a great idea either.

I usually keep related classes together...

  
///////////

//Network.h


#ifndef __NETWORK_H
#define __NETWORK_H

#include "Player.h"
#include <afxtempl.h>

////////////

//Prototypes

class CNetworkServerDx8;
class CNetworkClientDx8;
class CPacket;

//class definitions...


#endif //__NETWORK_H



  
#include "stdafx.h"
#include "GameEngine.h"
#include "Network.h"

#ifndef __NETWORK_CPP
#define __NETWORK_CPP

/////////////////////////////////////////////////////////////////////////////////

//Packet

CPacket::CPacket():length(0), packettype(PT_EMPTY), serialnum(0), ecc(0), data(0), m_dwDataSize(0)
{
m_dwDataSize=128;
data = new BYTE[m_dwDataSize];
}
/On & on...

#endif __NETWORK_CPP


Magmai Kai Holmlor
- The disgruntled & disillusioned

Share this post


Link to post
Share on other sites
Thanks for the help. Maybe I used the wrong title but I didn't really know what to call it. OOD just sounded like the appropriate buzzword. I don't really understand how the primary cpp knows which cpp contains the network info. I know the primary cpp will include the network header file (I am not talking about the packet header in the network code just in case you misunderstood).

Edited by - gatekeeper on January 28, 2001 9:07:24 PM

Share this post


Link to post
Share on other sites