GameDev 2019 Week 41: Slow Motion
Projectiles, Auras, Slow Motion, Pause06.12.2019 - 22:12
As mentioned some weeks ago we were planning to upgrade our server to the newest debian version and today we finally did it, although my friend did most of the work, he's like a server admin magician. Afterwards, I recompiled my game server on my ubuntu laptop and it runs on the server again because the servers debian and my local ubuntu are based on the same linux core again.
Today I was mostly writing last weeks blogpost, but when I wanted to post it, I noticed that mysql was broken again and my website didn't work properly - it got messed up during the upgrade. It was the same problem from a few weeks ago and of course I forgot how to fix it exactly so it took longer than it should have. At least I learned from my mistake and made a wiki entry with instructions on how to fix it, if it happens again.
Finally back to working on the game, I started by updating the web tool to work with the changes from last week. I added a table that can easily be filled with the data I gathered for all towers in an excel (LibreOfficeCalc) document. I included a dropdown in the building editing page and when a tower is selected, the scale, the launch height and the custom renderer ID (if there is one) are automatically filled, in fact the launch height and the custom render ID are hidden from the form, because they shouldn't be changed anyway.
Then I made another excel table with all projectiles and some of their properties and also added a drop down to the web tool with the projectiles and made it auto fill the appropriate values.
The next thing I wanted to look over again before adding more content were the projectiles. Billboard projectiles were mostly fine, but model projectiles could use some work. First I removed the scale because you don't really need to scale an arrow to some weird proportions anyway and this removes one matrix multiplication per projectile and makes them slightly faster. Because I had the dynamic scale before I never bothered to scale the models themselves properly. So I added rescaling to my model editor and rescaled all model projectiles to a proper size. I also noticed that friendly entities ( e.g. bees ) had hardcoded speeds and now they take the correct projectile speed from the blueprint file.
I started the day by creating two additional model projectiles: a spear and a trident. After fixing a bug in the scaling function where the hitbox wasn't scaled, I added them into the game. I tried a few things to see how they looked and I noticed that the arc projectile route was buggy when used with projectiles that need to fly in a line following their tip, like and arrow or a spear. I couldn't really narrow down where the problem lied exactly so to help with that I added a new functionality to the game: slow motion mode. It helped my to figure out what the problem was and even more so it looked awesome, I am definitely going to keep it in the game. Afterwards I was finally able to fix the projectile rotation bug, even though it took a few hours until it was right.
Because the slow motion mode from yesterday was such a success, I also added a pause functionality today. Unlike the slow motion mode, which is only client side, pauses get broadcasted to all clients. This was a little bit more complicated, because I also had to change a few things on the server so it doesn't continue its timers when the game is paused. Then I made sure the progressbars in the selection windows and the time displays all handle slow motion and pauses correctly and also added an indicator text at the top to tell if the game is in slow motion mode or paused. Finally, I enabled hotkeys for building: the keys 1-9 select the buildings and ctrl+1/2/3 switches between the building groups.
Unfortunately I made a big mistake last week when I changed the launch height of projectiles. I thought "hey, lets specify the launch height in percent of the tower height, so it changes when the tower height changes", which is a great idea, but I only realized after I converted it for all tower that I don't even save the tower height. And while the height of the tower could be retrieved from its hitbox the game model doesn't have access to this data. But the tower blueprint files save the scale of the tower, so it makes a lot more sense to save the launch height as an absolute value and then scale it with the tower scale. So I had to go through all towers again and save the correct value.
Sunday 01.12 - Tuesday 03.12
I may have been a bit too motivated to play minecraft. I built a wither skeleton farm, which needed big nether area slabbed. Because I didn't want to waste time slabbing areas that are out of range I looked for a mod or tool to show me a sphere or tell me where to place slabs, but I couldn't find a good one. So I looked into the creation of datapacks and made my own datapack that shows a text that tells me the distance to a block so I can tell if I am outside of the radius. While the datapacks are actually quite powerful, basically like light weight mods, the syntax takes a little time to get used to. What would be c = a - b; in a normal programming languague, look like this in the minecraft command syntax:
scoreboard players operation @p delta_x = @p player_x
scoreboard players operation @p delta_x -= @p target_x
And there isn't even a sqrt command, but luckily I found a solution in the internet where someone had implemented a sqrt approximation algorithm in minecraft commands.
I like learning new things and figuring out how this works was more interesting than more polishing work.
The last thing I went over in the blueprint files were the auras. I added auras very early on before I added the elemental damage, so there was no way to create an ice damage aura for example. So I completely changed how they are specified. Previously an aura could only affect one stat at a time and only the 5 old stats (damage/range/attack speed/crit chance/crit power) and only percentage increases, e.g. +20% damage, now they can either be percentual or fixed, e.g. +10 damage, they include all stats and they can also alter multiple stats at once, e.g. +5 damage to all elements. However, this broke the way how the aura icons were assign, so I instead made them customizable in the blueprint files as well.
Today I updated the web tool to work with the new changes, the aura changes required a slightly bigger update. And with this I think I have been over most blueprint file features, so there is nothing stopping me from creating more content and trying to balance it... yay ^.^
by Christian - 06.12.2019 - 22:12