I want to be the best

by Ladbon

This weeks artifact have been high score.

Our game is nearing it’s end stage and we are moving into a full feature freeze and going into balancing soon. Our group have almost finished a survival wave based top down shooter called at the moment -something something road-. You take control of a young woman named Ariana. A traveling saleswoman that have to defend herself from bandits during trips. Set in a spaghetti western steam punk world near India she defends from waves of enemies that try to destroy the only worthy possession she has, her truck. You bulk up in score by killing enemies and use it to purchase yourself upgrades for either speed, new weapons or hp. These will affect Ariana in different ways and how you play her. It’s main objective isn’t to survive the hoard of enemies, it’s to get the highest score but buying upgrades for an easier completing makes it hard to reach a higher one as you lose a fixed amount of score upgrading.

The dynamic we wanted to reach was imperative as the simple goal of completing the game will be a lot easier rather than reaching the best score possible. One mechanic that do set us apart is our main controls. We wanted to find a easy way to defend a circular central point on your screen so we made the controls fit the circular collision box that is your truck so when you move you strafe in a 45 angle creating a smaller circle that encompass your truck. It’s creates some difficult navigating at first but when you get the feeling of it the advantages are great.It’s inspired from the circular cities built during the middle ages for easier defending it from sieges. It worked then and it does here. One thing we added this week is some kind of gravity pull for the only power-up in the game, a toolbox which essentially fills up your hp by repairing the truck.

I guess the only thing I haven’t mentioned now about the game is that you are immortal, you can never die unless your truck gets destroyed as it’s power source operates there. No bullet can harm you, sound easy right? wrong hehehe. We will begin the betastage tomorrow.

HERE IS THE ARTIFACT THE REST IS COMPLETELY FOR MY REPORT AND THOSE INTERESTED ENOUGH TO LISTEN

I’ve been working on high score for quite some time now, it’s been brewing on my mind how to build it and what to expect from it when you play the game. It’s not fully functional as some bugs occur like text written over text(might be fixed this hour though).

I had a picture that you create a class that has 4 main methods, Save(), Load(), Read(), Arrange() with  two different dynamic vectors of information. One for keeping track of score and one for keeping track of names. I wasn’t sure about what stream I would be using cause the benefits wasn’t familiar. I had never actually worked on this you see, it’s completely new and when something I need to pick it apart and play with it. Almost a week and a half goes by without any results. I wasn’t getting any code done and the research wasn’t going well. I had to get a meeting with my superiors to understand what I am dealing with. The meeting went and I became much clearer. My design was very on-line based and complex according to my teacher. I was thinking of some kind o racing game high score so I was taught a more suited design.

My design became struct based objects that keeps track of name, score and kills. They are then pushed back into a dynamic vector that keeps track of them. The main methods are Load(), Save() and Arrange(). There are some other methods which are only there to retrieve a single object and one to get the size of the vector.

I create a txt file that already have a few scores in them which at the moment of the startup I load in the scores which are handled by a loop, string stream and a struct. They are then sent out to be arranged so when you start up the program you are allowed to see your high score immediately. It’s then changed when you have lost/won the game. Here you get to write your name and press a button to submit your name, score and kills. The score and kills are already taken care of in the game object manager but I needed here to get the name. I must tell you it took a good three days to get this right.

The method was a event.type in SFML called TextEntered. It’s designed to register every button on the ASCII table you press and all you have to do is create a sf::Text object to place it in there with a string stream and you’re done. It wasn’t easy to get this figured out and working as I wanted mainly because of my inexperience I guess but good comrades are always there fortunately.  So when you press submit your struct object with your name, score and kills goes into the dynamic vector and arranged accordingly. In the same menu you can now press high score(could have before but you wouldn’t have gotten your high score submitted!) and behold, a list of names, arranged perfectly. When you press back from the high score it saves the information that it stored locally in the program back to the txt file which it erases first to make sure stuff don’t get overwritten.

I had a few issues going into this new ideal. My main crunch method is to create the class, the methods and connect everything before I even start to draw stuff out which I haven’t found to be an effective way to code so when every single line of code was finished I couldn’t draw it out, my arranged method wasn’t working and I was creating line breaks and spaces where I didn’t want to. It took me a while but when these minor issues were solved with a reversal of the arranged method and taking out the line breaks and spaces I could now arrange it accordingly in the txt file. The biggest problem I faced was that it drew only the highest score and that’s it. I struggled with this last night and all of today. I build my draw method into my high score state which keeps the highs core class object locally to simply get the whole vector of scores one object at a time. I then push them back to a sf::Text object and place them in a sf::Text vector of it’s own. These are then iterated and drawn out …but it wasn’t drawing. I took the iteration where I get the struct objects to the initiate method instead of the update but it still wouldn’t do it. I finally found the issue, they was getting drawn just not with a font, color, position and style! I was renewing my sf::Text object at the end of the turn but kept the options I put outside the iteration so it wasn’t creating new ones. When I finally put it in there everything worked out correctly. I just need to fix the bugs and it’s all done!

Screenshot 2014-03-14 11.50.20

Sorry for the WALL OF TEXT but hey, it’s nice to get this all out,
Cheers.