GameDev 2019 Week 11: Minimap
Minimap, Content16.03.2019 - 18:38
Wrote last weeks blogpost and in the evening worked on an updated arrow tower model that is covered in spiked vines. It will be a poisoned arrow tower and is an upgrade from the normal arrow tower and as the name suggests it will also poison the enemies.
I was contemplating whether I want the game to have a minimap or not, but in the end decided in favor of a minimap. So today I started to implement one. I created a specialized label that can display small dots, which represent the buildings. And I also made another ui element in the top right of the screen which contains the minimap and additional ui buttons like the shop and wave browser buttons, which were previously just floating around somewhere. Next to the map I also added a smaller reset camera button. The camera can be moved and rotated freely, but some people may prefer to have a fixed angle when playing, so the button resets the cameras angle to the default. At this point the minimap label had just a green background for testing, but obviously it will need a proper display of the map and also obviously I wouldn't want to have to create the minimap images by hand. Therefore I started to add a feature to my map editor that automatically creates the minimap images. The idea is quite straight forward, render the map with the correct bounding box and an orthographic projection directly from above, but the implementation was a little bit more annoying. I had to create new shaders for most of the components, because the minimap does not really care about lighting or shadows.
Starting the day I had to continue with the minimap renderer, because I wasn't able to finish all shaders yesterday. Once all shaders were done I added some more utility features to it like anti aliasing the image and then I could finally add the minimap image to the actual game. Because it looked weird on the default menu background I then worked on the background texture for the ui and also made new button textures for the shop, wave browser and reset camera buttons. On of the most common uses for the minimap is quick navigation, so I added a click functionality to the minimap, which repositions the camera to the clicked position and I also made an icon that represents the camera move on the minimap along with the normal camera. So this is the minimap:
Rendering the minimap to an image also reminded me of another feature that I want to have: Screenshots! Obviously the default windows ALT+Print or just Print always works to create a screenshot, but it's not the most convenient to open paint every time, paste the image and save it. Therefore I added a screenshot function to the game, that automatically saves the screenshots in a screenshot folder in the games directory when F2 is pressed ( I didn't want to use the Print key, because I still want to have the option to screenshot the whole screen, and minecraft uses F2, so it must be good ;) ). And as I realized later in the week, having a quick and easy screenshot function is incredibly convenient for example when trying to catch arrows flying in the air.
One feature that was still missing from the minimap and the game in general were player colors. Because this is a feature that a lot of games need I added a utility class to my engine which provides a few colors to chose from and has functions to automatically fill buffers with the correct values based on a colorID. With this class I changed the minimap building dots to use the player colors and I also added a colored square in front of every player in the multiplayer stats section.
One of the softer goals for the next time is to start testing the game with friends, but therefore it needs a semi balanced and playable map. I added a few more waves to my wave file, but was unhappy with the way the flying and boss attributes were handled, so I combined them to a single field in the csv that just lists all modifiers the wave has. The wave data files always had a model field but up until now the game just ignored it and made all walking mobs slimes and all flying ones birds, so I also changed how the game loads models and un-ignored the model field and the entities are now rendered with the model from the wave data file. To have a little bit more variety I made red and blue slime variants. Another thing that I let kinda slack a little bit were file system paths, a lot of files were lying around on my Desktop on were hardcoded in the game, which obviously isn't portable at all. So I spent some time creating more folders in the games asset directory for tower models, entities, projectiles and particle effects and moved a lot of the files there and referenced them from the asset directory root. I probably missed a few, but for the most part the files are now properly stored in there and I need to be more diligent in putting them in the correct directory when adding new files. Finally - for today - I created a new in between screen when clicking on the multiplayer button, where the player can select an ip address to join. So far I was only testing the multiplayer on localhost, but if I want to test the game with other people I need to have a dedicated server running on my linux server and there has to be a way to connect to it ( The last linux build was more than a month ago though, I hope it still works :D ).
Continuing with file system clean up, I changed the tower button creator program to place the tower button images in their own directory because the tower directory was becoming cluttered. Then I added the startup time and the building time as options to the game data file, so it can be changed easily and isn't a hardcoded constant in the game. When cleaning up some debug prints I also noticed a game crash that could occur when building, I hopefully fixed it. I also fixed a bug where non attacking towers were attacking anyway. Then I played what I would call the first actual round of the game, even though it wasn't really balanced because the upgraded aura tower has still ridiculous values and a 500% attack speed buff to the pirate effect which yields gold on hit results in a lot of gold. Creating a well balanced map is going to be a challenge.
In the evening I added a dps counter to the game, because I love statistics ;). It can be activated by the /dps command in the console and will open a window which calculates and display the dps of every player in total and in the current wave. The time is measured from the start of the wave until the last entity either dies or reaches the goal.
In the morning I made a rough plan on what kind of towers I would like to have in the test map. Later in the day I created a new ice trap model and a fireball tower model in Blender and also created the tower blueprint files for them. The fireball tower has a large bowl on top of it and I wanted to put a burning fire in it, so I did just that:
Today I finally added multi target attacks into the game. The tower blueprint files can specify the number of targets the tower can attack at once, it was actually fairly easy to implement, I mostly just had to add another function that returns a list of entities in range.
by Christian - 16.03.2019 - 18:38