Uncategorized

Finally Back and Healthy, Switching to Godot from LibGdx

Image of LTGD Game Jam Game
Live Torment: Gary’s Damnation, our Let’s Talk Game Jam Game

Health Problems and Update:

It has been a very long time since I posted anything on my site.  It has been a rough couple of years, and I am looking forward to getting back into game development again.  Over the last few years, I started having a lot of health issues which mostly could be correlated with being overweight and not exercising at all.  I started having chest pain, shortness of breath, tachycardia, and other heart related issues.  I was also having stomach related issues including chronic gastritis, and now chronic esophagitis, and Gerd.  It turned out that I was having Gerd attacks from what I was eating, and it was giving me heart attack like symptoms.  They also found that I had a couple of partial blockages in my heart, which were not helping the situation.  After multiple trips to the ER and many, many procedures, and doctors’ visits over the years, I am finally starting to feel better.  I drastically changed my diet to a very low fat, acid reflux diet.  I determined that whenever I would eat fats except a few types like avocados it would trigger my chest pains, arm pain, shortness of breath, and other symptoms.  So, I have not been eating those foods for the last few years, and it seems that I will never be able to again.  Due to the drastic dietary changes, I lost about 150 pounds over the period of a year and a half, and I am in a lot better shape than I had been for many years.  I still occasionally have problems, but they are much better managed at this point.

Game Jam:

About 6 months ago a coworker and prior student of mine asked me if I wanted to do a game jam with him.  So, we worked on a game for the Let’s Talk Game Design Game Jam.  If you are interested the game, it is available for download on itch.io for free.  The only rule of the Game Jam was that the name had to be from the letters LTGD, and we had about a week to make the game.  Our game was called Live Torment: Gary’s Damnation.  It was about Gary, a man with a bucket on his head who ended up in hell.  His goal was to collect souls for hell’s number one live streamer Lilith.  So, basically the game was a weird, janky, 3d platformer where you would go around collecting souls.  It was a fun project, but we really didn’t have the time to polish the game in a week.  Overall, I learned a lot from the project because we had to build a full game in a week and publish it.  I also had never used the game engine we decided to make the game in (Godot), so it was a great learning experience. The game also got featured in the Youtube video on the Lets Talk Game Design Channel which was a bonus.

Switch from LibGdx to Godot:

After the game Jam I was really liking Godot. So, I decided that if I was going to make a game it would make sense to use the engine.  I like the fact that the engine is open source and would allow me to publish the game without paying them to use it.  In the past I used LibGdx and I was coding my game from scratch in Java.  I think this was probably a bad idea, since I had to create everything to make anything work.  I ultimately was struggling with the procedural map generation and kind of gave up on my project.  When I started playing with Godot it was just before the update to Godot 4.  So, I waited a bit for that to come out and when it finally did, I seemed to not have the time to work on the project, due to my other hobbies.  Mostly wildlife photography and astrophotography as well as 3d printing and building robotics projects.  With Godot 4.1 coming out now I am hoping to get back into the swing of things and start working on my game.  I think I am sticking with the same idea of a procedurally generated 2d Minecraft / Zelda style game.  But, I may change my mind once I start. Most likely I think I will continue from where I left off.  I will be making a lot of new sprites as I was not very happy with them, but the idea will be the same. 

Plans:

I am hoping that I will keep up with the project and look to post at least one to two times a month, maybe more if I get a lot done.  But I still work full time, so it must be realistic with the free time that I have.  I also plan on updated the website to better fit the updated project using Godot instead of LibGdx.  I will probably also make a section on my site to host some of my other hobbies, since a lot of people are interested in my photography.  But I still want my site to be mostly about my game development.  I look forward to keeping everyone updated on the project.  Until next time.                 

Finally Back and Healthy, Switching to Godot from LibGdx Read More »

Nearly Infinite Procedural Terrain Generation

Chunk Edge Errors
Chunk Loading implemented with errors along the edges of the chunks

I know it has been a little over 4 weeks since my last update. But I have been very busy with my class and full-time job. I feel like I have not made much progress with the game. About 3 weeks ago I modified the terrain generation to work using chunks and changed the generation to be nearly infinite.

Chunk System:

The game world now is limited by the max size of a 32-bit integer. So, the terrain generation can only modify x and y values between -2147483648 and positive 2147483648. Which if my math is correct, makes my game world about 2 billion pixels in each direction from the center. I am not the best at math, but the map would have a lot of tiles before causing issues. So that is why I am calling it nearly infinite. It would take a long time to see all the tiles of the game world. Also, each time you start a new game the seed can change and generate another entirely different terrain. Or if you keep the same seed the game world would be the same at the start. This is like how Minecraft world generation works, except mine is 2D.

Major Changes:

Due to this massive change I modified my terrain generation edge checking code to check the edges on each chunk. However, currently along the edges of chunks because it does not know what type of tile is next to the edge, it draws incorrectly. I believe I need to rewrite the code now to have all the current chunks load on the screen and then calculate the edges of the tiles that are visible. That way there are not just some tiles that do not change to edge tiles. Because I am loading in 16×16 chunks of tiles, I am loading about 25 chunks total to fill my screen. I think the best way to solve my issue is to load the chunks and then calculate the edge changes. Hopefully, this solution will work after I get a chance to implement it.

When I am testing currently I have only one chunk load in which is what you see in the video. But I can have more load in, and then you will not see the transitions because they would be off the screen.

Video showing the chunk loading one chunk at a time. It also shows the errors around the edges.

Other Issues:

Another major issue currently is that the map is generated using Perlin noise and a seed. Which works great for the terrain generation because it can use the seed to get the next chunk of terrain data. However, all the other items like trees or entities I need to come up with a system to not just randomly place them. Currently the game draws these objects at random when the chunk loads. But when the chunk unloads, I have not yet programmed in to remove the entities in the chunk. I need to come up with a system to save this information. I am thinking I will need to create id’s for the chunks and check if they have already been seen by the player. If they have then I will need to load them from a file of chunks. This will also require me to be able to save this same data to a file each time a chunk is unloaded.

An additional part that needs to be implemented is saving the entire game and loading from a save file. I have not yet implemented this. I may need to get this working before starting to save chunks. The game should be able to save a game and then reload that point so you can come back and play at another time. Because the game world is so large, and I want it to be an adventure I need to be able to save the current game. Also, you should be able to start a new game if you so desire.

Game Outlook:

Because of the amount of work required I think I put myself in a tough spot and I lost some of my drive to work on the project. I am hopeful now that I can start working towards solving these problems and getting the project back on track. I started working on serialization code, but I have not really tested it yet. My hope is that saving this data will not cause issues with delays. I may need to separate this data into smaller files, but I think many chunks should be saved in each file. My only concern is that if I have multiple files, I will have to check each file to see if the player has seen the chunk before loading the chunk. Or I would need an index to reference which file that information was stored in. I’ve never coded anything like this before so it will be difficult.

I think if I start tackling one piece at a time, I will be able to overcome these issues. I just think that it is going to take me a long time. Winter Break at the college is fast approaching so that may help me be able to work more on the project. I will do my best to post more soon. Until next time.

Full Change List:

Coded: a chunk system to load tiles in a 16×16 grid to allow less to render at a time. Currently the game loads 25 chunks in total, a 5×5 grid of chunks to cover the entire screen.
Updated: The game map system to handle chunks and level data.
Updated: Replaced the original level generation with chunks to have a nearly infinite world.
Bug: Fixed attack animations and arrow shooting after the map update bugged the code.
Bug: Fixed the spawning system after the map update bugged the code.

Nearly Infinite Procedural Terrain Generation Read More »

Player Attack Animations and New 2D Grass Tiles

I know it has been about 3 weeks since my last update. But I have been very busy with my class and job. But I worked on the game a lot over the last couple of days. I made many improvements that I was very pleased with. I was able to fix several bugs that I was encountering as well.

Bug Fixes:

The first major bug was that the edge of the game world was not rendering and when the player crossed the edge of the map the game would crash with an out of bounds exception. After redoing the map rendering code, I was able to fix the issue and now the player can walk around past the edge of the world. Which will be fixed when map collision is turned back on. Currently I have it off for testing, and the fact that I am spawning in on a mountain. If I had terrain collision on, I would not be able to get off the mountain currently, because I have not implemented anything to create a path down.

I also had a lot of bugs when resizing the game window. There a still a few issues when the screen size gets very small. But I think I am going to limit the size of the screen to certain ratios. After the fix I implemented, the screen scales much better and the map is rendering properly no matter the size of the screen.

Attack Animations and Sprites:

The largest project I undertook was created the sprites for the player attack animations. Then I also implemented them into the game. So, the player can now attack in all four directions. After implementing that I needed an actual way for the player to attack. I created a new system for collision detection that is much cleaner than my old code. It is working great so far but I do have a small issue with sprites of different sizes working with the same collision code because, the rectangles that detect collision are not being set to the right scale. I will need to fix this in the future.

HUD System:

Furthermore, I worked on a new HUD system for the game. I need to add much more to it, but I was learning just how to create one. Now that I was able to get the game world time to show up in the upper right corner, I would like to add more art to the HUD. The HUD also needs to show much more information than it currently does, but I did get it started. I would like to have it show the players health and have an items bar at the bottom. That will probably be done down the road once I have a better understanding of how to implement it.

Default Grass Tile Update:

Updated Grass Tile
Image showing the updated Grass Tile

The last update over the last few weeks was changing the default grass tile. I updated it using a noise pattern of different green colors. It seems to have worked well so far, and I am quite happy with the new look. I also updated the other grass edge tiles to match it. Additionally, I want to work on other default tiles that are basically just a color. I want to change them to have more details. I think it just makes everything look better. Once the basic tiles are updated, I am going to start working on other objects that will be above the base layer that the player can interact with, to make the game world seem more alive.

I am hopeful that I will be able to post every two weeks again starting next time.

Full Change List:

Added: Player attack animations for all 4 directions
Coded: A HUD interface to show the time of the game world. More coming soon.
Coded: A new collision detection system to determine when the player attacks are hitting other objects in the game world.
Updated: The grass tile to look more like thick grass.
Updated: The other grass related tiles to match.
Bug Fix: Issues with resizing the screen causing map to not render properly.
Bug Fix: Solved the issue with the void space at the edge of the world not rendering properly. Game was crashing when reaching the edge of the world.

Player Attack Animations and New 2D Grass Tiles Read More »