GameDev 2019 Week 4: Slow Progress
a lot of small things27.01.2019 - 13:57
I actually finished last weeks blogpost in time on the weekend, so I started the new week by implementing a game state ui which shows which state the game is in and how much time is left or has passed, depending on the state - when building the time goes down telling the players how much time they have left to finish building and while the mobs are running the time goes up to give the players a sense of how "good" their maze is, if the mobs run longer it's generally better. I also added a few more stats to the tower details window and moved the attack speed to the blueprint files to be easily changable. Then I changed the build ui to square buttons, eventually the buttons will have an image of the tower, but I'm not sure how I want to implement this yet, either generate the images on the fly or create an image for every button before hand. Finally I noticed while spam building towers for testing that there was no way to delete them if I blocked a waypoint completely, so I rectified the situation and implemented tower deletion.
As mentioned before one of my favorite things in tower defenses is mazing and I want the ability to have a cheap tower which cannot attack that can be used to create a maze. So I created a mazing rock tower with a very simple model and also gave the blueprint files the option to specify a tower as non attacking. The day before when spam building towers and watching the mobs path find through them I noticed a few inconsistencies. Under some conditions the path smoothing smoothed a bit too much and the mobs walked through towers which we obviously do not want and after a little while I found the bug and fixed it. Also while implementing the initial path following I was lazy and just checked if the entity was closish to a waypoint and if so set the next waypoint as the new target, so they always changed directions before they actually reached the waypoint and it didn't look quite right. Therefore I changed it and they now always go to the exact waypoint before going to the next one. Additionally the game will now deduct lifes from the player directly if the player completely blocks a waypoint, so dont do it ;)
I wasn't feeling well and wasn't really motivated so I took a little break from programming.
Today I experimented with custom tower renderers. So far every tower was just a static model and the render code was the same for every tower. But I wanted the ability to have more fancy towers which can be animated. To achieve this I refactored a lot of the tower rendering code and worked in a way to have custom render classes for specific towers. To test it I added a tower which has a rotating energy ball on top of it. It's working for now, but it's not really optimized and it could be a little easier to use aswell, so it needs another pass some day.
For month I had a bug in my map editor that some things were rendered weirdly when zooming in or out - the depth relation between the objects was off, but it wasn't that noticable so I never really looked into it and I also though that it might be one of the nvidia / amd differences because I changed my graphics card from amd to nvidia last year and never noticed the behavior with my amd card. However, at some point I had changed the projectiles to move up from the tower and then go to its target. And the projectiles had the same weird depth issue, even though I spawned them inside of the tower, they were rendered in front of it, which looked super weird. So I did a bunch of googling, changed the depth precisions of every framebuffer, but the issue remained. But, like 99% of bugs that occur, I realized that I'm stupid. For some reason the map render class had its own projection matrix and everything that belongs to the map, like trees/stones and also the towers, was rendered with a slightly different projection matrix than the rest such as the projectiles... I gave the map renderer the same projection matrix and everything worked, a lot of time wasted though :/
One of the main things I need to do is to create a bigger map. So far I was only using a very small test map, but to test things properly I need a map in a size which I would be using for an actual map in the game. However, the map editor had a few annoying bugs that I needed to iron out. It now saves and loads the textures tiling information properly and objects will not get placed out of bounds and won't float either when scatter placing them and the elevation changes. Then I worked on more textures, I made a grass texture and a red rock texture, which both look and tile decently. And I also tried to create transition textures when the terrain changes from dirt to grass for example, but I'm not satisfied with the results, it either looks boring or the tiling is extremely obvious. I'm not sure what I want to do about this yet, it'll take some more experimenting.
I wanted to work on the bigger map, but I realized that I needed more features in the editor. So I added a mass model placing feature, which can place a large amount of models quickly. You can set the min and max elevation, the number of models, some scale variation and some x/z angle variation for example to place slightly differently sized trees which may grow slightly tiled. And I also added a mass texture placing feature also with a min and max elevation option and a chance if the tile is placed or not to create some variation, e.g. if I had 3 different grass tiles I could set the chance to 33% and have a nice mix. Then I used the new features and placed a lot of models on the map, the building areas are probably too cluttered, or at least the models in there are too big, but this was mostly to test the editor features.
Then I saved the editor project which was completed in a reasonable amount of time and tried to load it again aaaand ... it took 37 minutes :D The loading literally places every instance alone and then updates the buffers, which is super slow, I have a faster way of doing it but I hadn't updated the project loading to use it yet. But there's probably still some improvements to be done there. The game uses a different exporter and importer, but I haven't tried how fast it is yet.
by Christian - 27.01.2019 - 13:57