pingpoli.de



GameDev 2019 Week 13: Lightning

Options, Window Textures, Lightnings

01.04.2019 - 12:03
Saturday 23.03

I started and finished the blogpost very early, and there were still quite a few loose ends with the sound system, which needed to be done. First I added sound groups. Sounds can be grouped by their category like music, sound effects or ui sounds effects ( or another custom sound group depending on the project ) and then the volume of the group can be set and all sounds in the group will update their volume. To actually control the volumes in the game I added an options menu to the game with sliders for every sound group and a master volume slider.

Sunday 24.03

Because the range stat was always a bit of an arbitrary number, I created a range display for towers, which can be activated by pressing R when the tower is selected to better visualize the range of a tower. However, I realized that having the range indicator only accessable after the tower is build is kinda stupid, because you would want to have it before placing the tower so you can decide where to place it to optimize its coverage. Therefore, I also added the range indicator to the tower building hover display.



Then I added the ability to mute sounds and sound groups to my sound engine, you could have achieved the same by just setting a volume of 0, but having a quick way to mute and unmute sound without losing the volume setting seemed like a good idea. To do this in game, I put a mute checkbox behind the volume control sliders. And I also added the building, upgrading and destroying sound effect, which I made last week to the game.



Monday 25.03

One of the parts of the ui that didn't have a proper texture yet, were both the entity window and the building window. Mostly because my window class didn't support custom title bar sizes and close buttons. I implemented those features, but broke a lot of other ui elements in the process, and had to spent some time to fix all of them - "never change a running system" is so very true. Anyway, once the window class was able to handle wider title bars I created a texture for it and also increased the size of the hitbox for all entities so it is easier to click on them, especially when they are moving quickly.



The building windows was a bit more complicated, because there is a lot more information and options for buildings. I rearranged the elements until I found a layout that I was happy with and then went ahead and created a texture for the building window. The only thing that I'm not too happy with is the location of the demolish button, it's probably fine where it is, but I may change it later one, even though that would mean, having to change the window texture too. There may still be additional options for buildings which would require a redesign anyway. I really like the texture of the demolish button itself though, the crumbling tower looks nice and depicts what the button does - I still added a hover tool tip though.



Finally, I noticed a bug in the volume and mute sound controls. Sounds that were added after changing the volumes/mutes would not be affected by the settings, so I had to fix that too.

Tuesday 26.03

After a lot of hours yesterday, I took it a bit slower today. One of the most important things yet missing in the sound options was the ability to actually save and load the settings. So I added a class to do exactly that and the game loads the options from the file on startup. I chose to save the options in a normal textfile instead of binary. It may be slightly slower to read and parse, but it enables the players to change the settings directly in the file if they want to. Then I added an options menu to the main menu, so far there was only an options menu when in game, and created an apply and cancel button below to save the options to the file when clicking apply. Additionally, I changed the volume sliders to int, because having a volume of 56.82543 looked kinda weird ;)

Wednesday 27.03

Today I added a new attack type into the game: Line Attacks. Basically a tower connects to an entity with a line and deal damage per second as long as it is connected to the entity. To render the lines efficiently, I came up with a geometry shader based solution which only needs the starting and ending points of each line and will automatically create a vertical and horizontal quad along the line, which can be textured.



Thursday 28.03 - Lightning Texture Creator

The main look I had in mind when creating the line attacks were some kind of Lightning Beams - and eventually Chain Lightning attack, the lines cannot bounce yet, but I want to add that at some point. But how to get a texture for them? I obviously cannot and will not take a random texture off google, and I ain't got the money to pay someone, and also where would be the fun in that? I could probably create some kind texture in photoshop or even blender, but that would involve a lot of manual labor and I don't think I could ever create an animated texture with these programs, and even if I could, I couldn't create a lot of different ones if I wanted to try a slightly different look. So, lets create our own tool to create animated lightning textures instead ;)
Unfortunately, I didn't get as far as I would have hoped today, most of my tries either didn't work out at all, or didn't produce good results, or at least were missing more details. It turns out it was a little bit more complicated than I thought.

Friday 29.03

Continued to work on my lightning texture creator and I was finally getting somewhere, the results started to look a lot more promising. By the end of the day the class got to roughly 1k lines of code and had like 50+ changable parameters, which were hardcoded, but it was able to produce images like these:






I may have went a bit crazy with some parameters here, but it looked kinda cool ( even though it was physically wrong, the bright light in the back wouldn't be covered by the dim blue shine or lightnings in front of it, but rendering it correct with this many lightnings would just be a whole lot of white, so I left the incorrect rendering option in there as a parameter, because as long as it looks cool it doesn't matter if it is correct :D )

Saturday 30.03

Again more work on the lightning texture creator, I added the animation part to it, so it can render multiple frames into a texture that can be used with OpenGL. So far the animation is fairly random, but my thoughts where that lightnings behave quite irrationally anyway, so it might be okay. Then I also spent a bunch of time and cleaned up some of the code and added a seperate settings class to have all changable settings in one place - I didn't finish this yet though. Anyway, I had a texture which I could use in the game, so I added it, and it didn't look as good as I had hoped. I think I still overdid it on some of the settings and I need to dial them back, and I also realized that the vertical quad of the line attack doesn't really add anything and instead makes it look worse, at least with the texture I had, so unfortunately, I still have to experiment a bit with different settings to create a lightning that also looks good in the game.




by Christian - 01.04.2019 - 12:03


Comments

Social Media:  © pingpoli.de 2020 All rights reservedCookiesImpressum generated in 1568 ms