Devlog 1 - Core systems


Devlog 1

I should have written an update last week but unfortunately got sick at the start of the year. I still managed to complete a few tasks and learn a couple of new things along the way.

Tearing finally fixed

The solution for tile tearing from the last update was not 100% effective so I did a little bit more research and finally figured it out.

I packed the tile set into a Sprite Atlas. This adds a few pixels of padding for every tile and sprite packed in this way.

To add a Sprite Atlas you just create it somewhere in the assets folder (create - 2D - Sprite Atlas). After you do this you just need to add the tile set to Objects for Packing in Sprite Atlas inspector. This solution seems to be working perfectly now.

Scriptable objects

I looked into Unity’s Scriptable Objects for the first time. They seem like a perfect fit for a few of my features. Specifically, trap items and enemy types.

Trap Scriptable Object contains data every trap type has to define (hp, damage, sprite, trap recipe...). It is much easier to update and add new trap types like this than using a prefab for every trap type. 


When the player places a trap on the map, trap Prefab is instantiated. Then, depending on which trap player has selected, that Scriptable Object is assigned to the spawned prefab.

Hud

Hud has been reworked from the ground up. Everything is decoupled from the rest of the code now. Hud elements subscribe to different game events and respond to them. When a player spawns a trap, resources are consumed from the inventory and new resource amounts sent in the form of an event. Resource counters are then updated within a script listening to those events. I also added a minimap and actionbar to the hud.


Conclusion

Despite a few setbacks I am still satisfied with the progress I made. I did no work on the graphics so this will be left for the next week or two. I must also rework the system for gathering resources as well as design a few basic traps for players to spawn. I also hope to release a playable version for everyone to try. Until next time!

Get The Farm

Leave a comment

Log in with itch.io to leave a comment.