Dev Log 1 - Goodbye Unity
As my goal was to create a survival villager sim fully made with my own pixel art, and I knew of Unity's reputation as the go-to engine for 2D games it was the obvious choice. Over the course of two to three years, (weekend and outside full time work) I dedicated myself to game development using Unity.
Unity's dominance in the realm of 2D game development made it a natural choice for my project. Its user-friendly interface and extensive documentation streamlined my workflow, enabling me to make significant progress. With Unity, I built the foundation of my game and tackled various challenges along the way.
Despite Unity's strengths, policy changes within the platform forced me to reassess my development tools. This prompted me to explore alternative engines, ultimately leading me to Godot. While the decision to transition was difficult, I was drawn to Godot's reputation for ease of use and its open-source nature.
Transitioning from Unity to Godot presented its own set of challenges. Familiarizing myself with Godot's interface and adapting existing codebases required time and effort. However, Godot's intuitive design and supportive community eased the learning curve, allowing me to quickly acclimate to the new environment.
As I continued to work with Godot, I discovered a wealth of features that accelerated my development process. Godot's built-in tools for 2D game development surpassed my expectations, offering a level of flexibility and customization that Unity lacked. Specifically the Terrain and Tilemap tools sold me as I had struggled making a system in Unity to handle this. Tasks that once felt cumbersome became more manageable, leading to increased productivity.
The Abandoned Unity Work
If anything this dev log is great place for me to consolidate all the work I achieved on Unity, perhaps it will be interesting / useful to see the progression since then in future dev logs.
I will discuss these features in detail in future dev logs when I discuss my progress in Godot. Just to show you the progress made in Unity that I unfortunately had to abandon. In hindsight I have been able to reproduce these features in far superior ways in Godot now, every cloud has a silver lining right!
UI Progress
Create Villagers Screen
This is one of the sorest spots for me as I was really happy with my Villager Creator UI specifically, but I still have all the graphical assets, and the code is still in C# in Godot so should be mostly transferrable.
The menu would randomly create 5 villagers, with different roles, stats, traits and relationships. I think the art style is pretty cute and very clear. I was really happy to get the randomization working specifically with the relationships was a challenge. Where if you randomized one character they could potentially join an existing family, so each other villager would need that new villager added to their family also. Etc etc. In hindsight I can make this menu cleaner in Godot when I come to it.
Map Generation Screen
This one I'm not so bothered by, as you will come to find out in my next dev log (Map Generation) I have greatly improved this system/UI screen. Although I still don't have integration of the Map Type / Disasters, as I haven't got to this gameplay yet!
Hotkey Bar and Villager Info Screen
This was the start of the in game UI, I created a basic hotkey bar which animated when hovered/clicked on, the only menu I had created functionality for was the 'Villager Information' screens. These were two screens I am proud of as they updated and displayed your active villagers and their roles. You can also click to go directly to the villager. The 2nd tab on the Villager Info screen would allow to change their roles. This was when the game was more of a villager sim, and it has developed since slightly.
Loading Screen
This is a basic one of course, but it leads nicely into our next section, map generation in unity. As you can see the bar is frozen at 90%, this is because the map generation I had working in Unity ran entirely on the main thread. So although it looks like its loading the map generation, in reality it was just loading the 'Game Scene' and when that was done, it would begin the map generation calculations, freezing the main thread, and causing freezing. How naive I was at the time to believe this was a good map generation system, and moved on, anyway we will talk about this and solve this problem in the next devlog (map generation in godot).
Map Generation
This topic again will be quite vague as the next dev log will be focused on the map generation work I've been doing in Godot. Let me just say its FAR superior than what I had in Unity, but I had to learn what I did in Unity to make what I have in Godot now! Anyway... onto the Unity memories...
My goal for map generation in my game was to have a large expansive world made using perlin noise, so that it would be random every time you play. Much like minecraft, however unlike minecraft I want to have smooth terrain joining tiles instead of a blocky look. This is where the complication arises, and where we need to look into Bitmasking. Basically setting up rules for which graphical tile should be placed, based on its surrounding neighbours. (Again more on this in next dev log)
vs my tiles with joining edges
And that's just one type of terrain (grass). So you can imagine the complexity this can create for the computer to process.
The world would generate based on the above UI selections small/medium/large, being 500/800/1000 tiles wide/high respectively. I used layered perlin noise to create different heights and biomes in my terrain, to produce sand/grass/dirt/forest/mountains etc. I created my own bitmasking rules in C# code, which was incredibly messy in hindsight, but it technically worked... and this produced the following maps... ( small map - in retrospective far too small to play on really)
The minimap in the bottom right was created by drawing coloured pixels using the same noise pattern. Again, more on this in Godot, next dev log!
Chunking System
Now in order to load this many tiles (and trees, rocks, any objects) we had to create a Chunking system to only load what was visible by the camera at the time. This was again very overly complicated because of my multiple layers of terrains (sand/dirt/grass/forest etc). In the end I got it working but I wasn't completely satisfied with it. As I had zooming in and out with the camera it lagged suddenly when zooming out (loading those extra chunks) and the speed of loading chunks wasn't excellent. This will all be addressed in Godot!
In combination with our chunking system we also created an Object Pooling system for our trees. This was important to handle memory management, instead of instantiating and deleting trees everytime we spawned/despawned chunks, we instead hide/moved the tree objects to their new locations when they were visible. This saved on memory but added complexity, for example when a villager was cutting a tree that would then go off screen, you would sometimes see a tree appear during its 'cutting down' animation.
Villager Tasks / Pathfinding
My world was based on a grid, and so I created a pathfinding grid and used A star algorithm to find the fastest route to the target. I had to research and follow a bunch of tutorials to get the pathfinding right, and even now looking back at it, on a large map clicking really far away, it would cause lag figuring out the correct path to take. This is another problem I solved in Godot. Using this pathfinding and a task system, I created two villager tasks of chopping down a tree and handing in the collected wood/fruit to the nearest stockpile. (And all the art and animations that go along with it)
Thankfully I'll be able to use the majority of the animations, but will have to remake this process in Godot. Thankfully it looks way simpler to do in Godot through the use of the Behaviour Tree, and Pathfinding comes in Godot through usage of NavigationAgents and NavigationRegions. Which made this whole process much easier! More on that in a later dev log!
Unity Wrap Up
I'm sure there a bunch of small features that I added to the Unity project, hair/skin colour shader, animations, etc anyway we will go over them in detail as we recreate them in the real project in Godot!
After loading up the Unity project for the first time in over a year, I'm glad to have left it behind, as it wasn't very performative, and a lot of the features I made, I'm not entirely proud of the codebase. As always as a developer, you look back on your work a few years ago in horror. I learned a lot about the fundamentals of games programming that most players of games might not even consider. Chunking, memory management, pathfinding, graphics being made of tiles with tilesets and rules, etc etc. Most of all, I am proud of my pixel art and thankfully I can take that forward to my Godot project!
Village Chan (dev title)
Villager Simulator with harsh survival mechanics
Status | In development |
Author | Ant |
Genre | Simulation |
More posts
- Dev Log 3 - Task System & Pixel ArtJun 06, 2024
- Dev Log 2 - Map GenerationFeb 17, 2024
- Dev Log 0 - Game ConceptJan 12, 2024
Leave a comment
Log in with itch.io to leave a comment.