Treshhold overcomed

by Ladbon

This week has been a series of half-assed opinions and motivations boosts for our group. We’ve been working on getting our orientation between our states better handled, getting sound into our game, customizing our character and getting a score to show up on the screen.
Our producer have been tackled with the presentation assignment and working out the documentation for our group while I took a leave of absent from being a lead designer(when it came to documentation) and focused more on programming.

We have been busy though, like always I’ve been tasked with questioning every artist work to make sure it’s final cut ready before it event shows up on the screen. It’s been done this way because I find it easier denying everything until perfected so I can have my artists working on future projects faster.

Like I said before, we’ve had it rough this week. Two meetings have been had, one was for with our guest teacher bashing our game to oblivion and making us question the whole thing while our main teacher doing the same and asking for proof why we should keep our mechanics the way we implemented them. A lot of philosophical question arose and most answered after we had our meet and greet with the rest of the groups testing each other games. Simply put; An arcade game before never really explained why its designed this way. We cannot care how many people will not like our game, we are interested in making a game that caters to our specific fan group we initially started with. Easy to pick up, hard to play and even harder to master. We made a distinct change where in the future we will have a free move option for simplified tactics but I doubt this will be implemented.

We had some troubles working with the design of the truck. It wasn’t believable according to everybody and finally us that it was a truck. We had to make a change, quickly. There was some trucks Seamus already had put into works that we had a look at and made a decision to switch back to a truck made as a placeholder. It’s been a working success other than that and I think as a glorified QA we’ve made progress in the field of effectiveness.

To the programming part! I’ve been assigned with the task of fixing the states and getting a score shown on the screen.

My main concern with states was a hit and a miss as a first look at it but now I see that it was simply a shotgun shot with two pellets hitting the rabbit and 18 right on the tree. I wanted to do something similar to what my partner at my last project did, getting the whole engine class into each state so I can use the objects created in there, everywhere. I started out putting the engine in State.h and the StateManager.h/cpp to make sure it was everywhere then using a ‘this’ function inside the initialize method in the engine class and attached it to each class. It worked..somewhat but I lost my input objects. This was after I took away all the input and gameobjectmanager objects from each state because I thought the engine would refer back to all the objects easier. Nothing worked, I looked everywhere for the problem chasing every callstack clue but I couldn’t find it!

I finally consulted my old partner and found out that I’ve been tackling this the hard way, there is no need to have an engine in state.h and the statemanager, these are only there to give a static virtual method into every state and the statemanager just refers correctly for every state to understand its methods better. So now I’ve deleted all evidence of engine objects everywhere except the states, still doesn’t work!

I consulted a teacher assistant and was told I am a total idiot, I was told that the problem was that the engine->m_input was initialized after every manager took it in so when they tried to use the object it was a nullptr(not pointing to anything in the heap memory). I simply took that line of code and changed it from:

m_statemanager = new StateManager();
m_window = new sf::RenderWindow(sf::VideoMode(Config::getInt(“window_w”, 0), Config::getInt(“window_h”, 0)), “SFML window”);
m_spritemanager = new SpriteManager();
m_gom = new GameObjectManager(m_spritemanager, m_window, m_input);
m_buttonmanager = new ButtonManager(m_spritemanager, m_input);
m_input = new InputManager(m_window);

to:

m_statemanager = new StateManager();
m_window = new sf::RenderWindow(sf::VideoMode(Config::getInt(“window_w”, 0),               Config::getInt(“window_h”, 0)), “SFML window”);
m_spritemanager = new SpriteManager();
m_input = new InputManager(m_window);
m_gom = new GameObjectManager(m_spritemanager, m_window, m_input);
m_buttonmanager = new ButtonManager(m_spritemanager, m_input);
The benefits with having an engine object there have made us more flexible with using the draw method and update method better in states which will make it easier for us to implement new dynamics into the game. I demonstrated this by putting a start screen up, took me 2 hours but hey faster than it would have creating a class for it!

Image

Now to the score. I consulted our meeting with our mentor Elias about this. I was trying to figure out how to go by creating a Score class. We talked about what kind of methods it needed to have and how we should fill these methods. The methods became:

Public:
konstruct
destruct
Getscore
PutInScore
BuyStuff
private:
int score

and filling the methods became:

stringstream ss;
sf::String sfScore= “Score”;
int iScore = 10;
sf::Text sfText;

ss<<iScore;
sfText.setString(sfScore + ss.str());

When we started writing the code for GameObjectManager we found room to comment where the score should call for it’s “PutInScore” method so implementing all of this was a breeze but I ran into a snag. I couldn’t draw it. I found out quickly that I didn’t have a draw method so I implemented it, took the stringstream and setstring and put it there…string doesn’t work. I guess the problem was somewhere else. Checking everywhere, moving the sf::text* and sf::font* objects to the construct, back to draw, back to construct, to public: in the header file, back to private made me understand something. Pointers weren’t the design I needed to make, I had to change my philosophy in having pointers in everything and took them away. Now the draw method works and everything was set to private and into it’s “rightful” place. And low and behold:

Image

That’s about what I’ve been doing at the moment. My final work will be helping my colleague with the customizing of our avatar and try to get my “BuyStuff” method in score before the alpha but if any teacher is reading this – CANNOT PROMISE CUSTOMIZE IN ALPHA SORRY BRUH –

Cheers

Ladbon