Game design help

So for the past 4 months iv been working on a video game for my advanced game design class. Sofar its alright but i'm having...'Technical difficulty's'. I cant seem to get includes managed correctly. Would someone be willing to help me by looking over my project to try and get it 'setup' correctly?

https://www.dropbox.com/s/u2kqcr7256alikq/Game%20Code.zip

Visual Studios 2012
Allegro 1.5.8
Could you be more specific about your problem? It's going to be hard to find someone to download a zip of code and respond back to you like this.

What exactly is your current problem?
my #include's and my hierarchy dosent sit well. for some reason my includes either work infinity, don't work at all or it cant find the definition during compiling. not to mention every time i edit the systemvars.cpp i have to completely rebuild the project.

My events don't work at all either so im debating on scraping the event system in-favor of a broadcasting system. but even that seems to not work correctly because of the #includes, i need someone with a significant amount of knowledge on c++ to try and hep me arrange them, so that they work.
Try reading this article and see if it helps:
http://www.cplusplus.com/articles/Gw6AC542/
Well that article did help alot, but im still getting a few problems here and there, but i think that's mainly my design. Ill thro more problems up here if i encounter them
Alright new problem.
Im trying to register some of my classes with a manager by passing "this" to a parent type pointer. and adding it to a array of the parent type.
ie:
class SomeManagerClass
{
void register(GameObject *);
Gameobject objects[10];
}
Player::Player() : GameObject()
{
somemanagerclass.register(this);
}
Player myplayer = Player();

Long story short im trying to make a Broadcast system, gameobject has a virtual function called sendmessage() which is overridden in its child class.

But when i "register" it it only uses the parent classes definition. i think its probably a slicing problem but i cant seem to figure out a way around it.
Can you show the class definitions? The function in question should be virtual.
Your code seems to be in a state where it doesn't work at all. Important lines are commented out, you #include headers when you shouldn't, etc.

Can you try stripping stuff out until you have the minimum code to reproduce your problem?
My professer helped me fix that problem, but hes stuped on one, both he and i dont understand why i need to include the systemvars.cpp in main insted of the .h, if i include the .h it gives me linkeing errors.
Are you linking to systemvars.cpp in your project settings? I would expect all professors to understand linker errors and how to solve them.
So, what do i do? I try to not touch the compiler/linker settings unless i have to.
Try removing and re-adding systemvars.cpp from and to the project again.
Okie, Another new problem. I have a class called game object which most things in the game inherit from. Now, iv added several classes that inherit from it, but one just does'nt work.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
//=================================
// include guard
#ifndef _GAMEOBJECT_H_
#define _GAMEOBJECT_H_

//=================================
// forward declared dependencies
enum CLASSTYPE;
//=================================
// included dependencies
#include "SystemVars.h"
#include <iostream>
using namespace std;

//=================================
// the actual class

class GameObject
{
public:
	GameObject();
	GameObject(CLASSTYPE);
	~GameObject(void);
	virtual void sendMessage(string data);
	CLASSTYPE getMyClassType();
	void setMyClassType(CLASSTYPE newrecip);
	void setId(int val);
	int getId();
private:
	//CLASSTYPE _MYCURRENTCLASSTYPE;
	int myid;
	CLASSTYPE MYTYPE;
};
#endif 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
//=================================
// include guard
#ifndef _GameSoundManager_H_
#define _GameSoundManager_H_

//=================================
// forward declared dependencies

//=================================
// included dependencies
#include <allegro5\allegro.h>
#include <allegro5\allegro_audio.h>
#include <allegro5\allegro_acodec.h>
#include "GameObject.h"
#include "SystemVars.h"
#include <iostream>
#include <vector>
using namespace std;
//=================================
// the actual class
class GameSoundManager : public GameObject
{
public:
	GameSoundManager(void);
	void preLoadBGSFile(string file);
	void preLoadSFXFile(string file);
	void playSFX(string file);
	void pauseMusic();
	void playMusic();
	void stopMusic();
	void transitionBGMTo(string file);
	virtual void sendMessage(string data);
	~GameSoundManager(void);
private:
	vector<ALLEGRO_SAMPLE*> bgs;
	vector<string> bgs_filenames;
	vector<ALLEGRO_SAMPLE*> sfx;
	vector<string> sfx_filenames;
	ALLEGRO_SAMPLE_ID bgs_id;
	string bgscurentplaying;
};
#endif 

And im getting the error:
1>c:\users\steven\documents\github\schooladvgdproject\game code\advanced game desing\gamesoundmanager.h(23): error C2504: 'GameObject' : base class undefined

I define what gameobject is, so why is it freeking out? It works in all my other classes so why not this one
Why is your GameSoundManager even deriving from GameObject in the first place? That doesn't make sense.
Last edited on
Its an object in the game in one way,the only thing game object really does is gives an overideable method to receive messages. i have all my sounds in one place so i can manage there playback for instance:
sendmessage("BGM_PLAY_somefile.wav");

if somefile.wav isent loaded into the 'bgs_filenames' it will load the file, and add it to the vector, then recall itself to play the audio.

The only reason so many things inherit from gameobject is so i can add them to a vector of pointers to send messages to one another.
Topic archived. No new replies allowed.