Ressource Management Prototype
Marth GameDev DK30 Spring 2021 5 6
Description
Time for another try. At least I refuse to give up those silly gamedev projects that I quit midway all the time. In this attempt I just wanna create some very very basic ressource management, inspired by The Settlers 2. End goal is to have a wood cutter that selects a tree, hacks it down, makes a log out of it and then it gets transported to a storage space.
Recent Updates
Day 62: Another setback. Got held up with work, YouTube stuff and speedrunning. And at the moment I am working on a way to manage the paths where the ressources should be transported along.
Update: Paths now register themselves at the handler. That class now has to create the topology and realize what borders what.
Day 46: I opened the project again and after a bit of confusion and frustration (I should really work on my coding habits at some point in life…) I understood where I was and what was planned next. And I continued where I left off.
Every path now gets its own script because they need some additional information so I can properly manage them and make pathfinding possible. Which brought me back to constructors which I need to look up next because my memory on them is a bit foggy.
Wasn’t much I did today but some progress is better than none!
Day 45: Well here we are again. My scheduling and time management completely fell apart and my mental well-being along with it. Was some hard weeks and I try to get myself back into gear.
I refuse to let this project go.
Day 17: Another day of tiredness hampering my progress. But the weekend is approaching slowly.
At least I made progress and finally figured out how those angles work. And the do work correctly now which made me very happy, but more on that probably in tomorrows update.
Next step is implementing Unitys Event system, which I personally never used but heard its awesome for communication between different Game Objects.
Day 16: Angles are hard…
I’ve always hated Quaternions. Even back in university. Luckily Unity can do calculations for you and I got everything except the rotation angle of the new road that gets created. Once that is figured out the paths will be put into a manager who then has the glorious duty of knowing where everything is and how to get something from A to B in the fastest way. Gonna be fun.
Also need to hinder the player from placing roads that overlap something else but that should not be that hard in the way I currently imagine it.
Day 15: The cheated version works… somewhat
So this at least shows what I want to do with it. Once you select the flag tool you can basically draw a line from one flag to another and the flag also anchors at existing ones (indicated by the green color, switches off when you move the mouse away from it) Here comes the truth: This effect is pretty much faking it by using a LineRenderer that is connecting the flag coordinates. While it looks fine its unusable for more because that function is for visual effects which makes splitting a path in two and checking for collision with objects impossible.
I do have some ideas how to adapt this to a homemade solution. But that is next on the To-Do List.
Still it makes me very happy to see this snapping into place and working.
Edit: Also green flag on green background might not be the best idea…
Day 14: This day was only a small bit of progress towards making the path building snappy. There are still a few problems to solve.
Day 13:
More Graphics, more elements, but not much more functionality so far. I updated the huts and made a sprite for the flags and those are connected by small lines. Next step is to create ways manually, which is why I put the UI things at the bottom in.
The idea is: Switch into Flag-Building-Mode. Cursor changes. Select Flag 1, Click it, Select a space in the world, Click there, New Flag lands and direct connection between both places gets created automatically.
Day 12: Motivation was not existent so I took a day off. But my brain was thinking about next steps.
Day 11: Small update. Nothing too visible on the outside. But you can now see when a worker is carrying a log.
There were quite a few changes under the hood, just to remove some error sources, and dealing with the point when there are no more trees in the vicinity. Some prep went into the handling of different kind of trees and the storage of them at the hut but wasn’t happy with the way it worked. I now understand why Flags exist in Settlers 2. Because having every building manage the stuff laying around would make it quite an annoying system to work with.
In other news I am a bit scared of the next step. Which is roads. That means I have to put a building system in the prototype first.
Day 10: But I got back to work yesterday and made lots of progress.
Behold the “Deforestation Simulator” :D
So I improved on the functionality. Each building now spawns a Worker which locates the nearest tree and reserves it for himself. Then walks towards it and cuts the tree down and walks home afterwards. Works with many buildings and workers active as seen in the image. This system is working a lot with Tags and Arrays but I am quite happy with it but also wanna test the scalability.
Next up is the actual managing of the cut down trees and delivering them to the home base.
Day 3 - Day 9: Have not been working on the project. Was occupied with other stuff and could not motivate myself.
Day 2: Late Update but I did some work yesterday.
The worker hut now spawns a worker which moves then to the nearest tree and stops in its vicinity. Next things are cutting the tree down and make the worker return it to the hut. Afterwards this system has to be adopted to a multitude of huts and workers.
Day 1:
Created the basics and the yellow worker is working towards the closest tree so basic functionality is given. He should move to a tree (brown circle), stop, cut it down, make a log out of it, bring it back to the home (brown square), and then it should get transported to the base (gray square) So lots of work ahead especially because I want to have some kind of intelligent pathfinding to avoid clipping through everything.
Estimated Timeframe
Mar 1st - Jun 30th
Week 1 Goal
Setup the basics and look into a smart way to do 2D pathfinding