Game dev – Programming – Rooms, collisions, pause state, textiles and prioritizing work
|
Intro Much has been done with the project, I will describe the different parts that I was a part of. Each part is described in detail in each section.
Rooms First of all, in our game we have objects called Rooms. There are 28 of these that make up the entire world of the game. Here is our current level design, made by one of my team mates Andreas Calmius: I made a manager that holds all these rooms, in the Initialize() function they are all created. It can handle rooms, like CreateRoom(), DrawRooms(), CheckCollisions(). This is the layout:
In the future, the plan is to only update rooms close to the avatar and make it so that enemies are part of each room. The idea is that with many enemies, updating them all across the map is not optimal. Avatar vs wall collision Me and Malin Lundqvist implemented her collision code to all the rooms, it took a few more hours than we planned in our weekly SCRUM. We had planned for 5 hours and it took about 6-7 hours. The collision she wrote is a line vs CircleCollider code. Each room reads from a text file with points in vectors. Each vector element corresponds with a part of the room that the player cannot cross. In this example room, one vector element (points that create lines) in this map is the top wall, another is the bottom wall. The text file contains position data with breakpoints between vector elements. The room is 2560 x 1440. Here are the current collision points in this room (breakpoint is 9001): 2558 876 The game took a step closer to being enjoyable to play with the addition of avatar vs wall collision. Pause state I added a pause state to the game. Jonas Lundgren built the StateManager and it works very well. It works a bit different from the one we learned about in the lectures. This has levels of states. The later added states can be set as Exclusive, which means that the earlier added ones aren’t updated anymore until the exclusive one is removed. To explain this further, here is a picture to describe it. The pause state is an exclusive one, so it “freezes” the PlayState below it. It still draws stuff so it look kind of nice. Here is a screenshot from ingame with the pausestate activated and the game logic “frozen”. Textile Manager I added textiles (the chests on the picture above) and a manager for them. The textiles are collected when the avatar collides with them. What actually happens when colliding is that the textile is erased from the vector and the AddOneX() function is called, X being the type of textile collected. The manager holds the current amount of textiles of each type collected and equipped. This is it’s layout of the manager and it’s functions:
It isn’t done, but I will probably finish it tomorrow. Prioritizing work We talked about adding pathfinding today after todays lecture on it. The pro’s are that we learn about doing it and it will probably be valuable knowledge since that is a common part of games. The con’s are a higher programmer workload. We discussed the matter and divided the different parts of programming among us. Malin was most eager to do pathfinding, so she starts doing this now. I will make an AI statemanager, based on the one I made for my earlier game “Boberman”. Jonas will keep working on GUI and since we arn’t sure that he will get it working until the alpha, I will program an alternate GUI for buttons in the customization menu. Here is a list of our priorities right now:
|



