Stefano here, it's been a great working week for Project_BuildTutto and I'm so much excited with how it is growing quickly that I can't wait to share the progress I made!
First of all here you can find Monday, Tuesday, Wednesday, and Thursday timelapse videos. I still want to improve them and I would like to add some background music and some caption to explain to the viewer what is watching, hopefully I'll be able to do that for the future videos.
So, let's talk a bit more in depth of the major changes this week:
Job sharing between guys
This was a feature already in the project the past week but on Monday I managed to improve it and make it more reliable. The jobs/orders are a crucial point to the game and I took particular care in this part because I wanted to make that structure robust. The jobs are created from a controller object (Level) and are organized in a tree-like graph, where the root of the tree is the final order and each node child is an order that have to be completed before taking care of that node parent. I did it this way because Guys can then ask the controller object to get a random leaf(a node without any child) from the tree and begin to execute it without stealing jobs to other guys or without taking an order that still has some work to be done before completing it.
On Monday I also managed to fit in the implementation of proper item stacking. Previously if you tried to place an object on the same tile it would have simply create a new instance overlapping the previous one, but this method was crazy ugly and totally inefficient. Now if you try to place an item in a tile where there is already another item with the same ID the object there, first it'll add to his internal stack counter one and then it'll delete the new one. This way if you have a stack of 1000 item you will still have one single object with a stack value of 1000, instead of 1000 objects with 1 item each. This approach complicated few things a little bit, like object reservation and the creation of the orders tree, but now it should be all working correctly again.
Weights and properties to objects with .CSV and Google Spreadsheet
The main idea of the game is that you will be able to build everything starting always from basic raw resources. So these resources need to have tons of properties and detail to define their behavior. So on Tuesday I added a pretty handy system to manage all this information and fill it in the game. In fact I made a sheet on Google Spreadsheet where I'll store a table with all this data, then I'll export this table as a commas-separated-value file (.csv) and feed this file in the game through a function that will parse the file and create a 2D vector of all this information. Then I'll use these 2D vector to create a map of all this information to be able to quickly and simply access to any information I need by simply asking the game controller to get the value of the map at *object_material* + "_" + *property_I_want* (ex: "iron_weight").
Guys ability to change the orders tree to simplify or improve efficiency of orders
With the weights and item stacking done, I wanted to limit the maximum lifting weight to guys to 50kg. So now if there is an order to get 8 pieces of iron (10kg each) the guy will not be able to grab them all, but instead will callback the controller object in order to change the build tree and make it easier for him. The build tree will split the nodes relative to that job creating 1 new grab node and 1 new place order. So instead of grab8 and place8 there will be grab5, place5, then grab3 and place3. In this way the Guy will be able to complete the job.
Another change similar to this one is the Node joining. Basically it's the opposite of the previous one.
In this case there is a Guy (that can lift 50kg) and 4 grab orders of one piece of iron each in different location of the grid. Before, the guy would take one, place one, take other one, place that, etc... But now with node joining the guy can recognize that grabbing a single piece of iron is an easy job for him and it could take more, so he callback again the controller object asking if there are other grab orders similar to the one he is doing now. In this case the controller will modify the tree joining nodes so the guy can then grab all the resource he needs one after the other, stacking them in the object he already have, and then place all 4 piece in a single place order.
Guys helping each other to lift heavy weights
Another cool features made possible with weights is the ability from the guy to call help to lift something. For example if there is a single item that weights 70kg, and this item need to be grabbed and placed somewhere in the map, that job cannot be completed from a single guy. So when a Guy take that order, he recognize that the item is too heavy for him, and he search if there is another guy nearby. If there is another guy, he will call him to help and they will both go at the item location and grab it together. This feature supports up to 5 guys helping each other to lift a 250kg object.
Ability to choose which save file to load in-game
Lastly, I changed the "load" button. Before it was loading the last savefile done, now it will prompt the user a list of all the save file he find in the "saves" directory of the game giving the user the power of choosing which file to load. This features come particularly useful in this state of the development since there are many "scenes" that need to be tested any time I add a new feature that could break them.
Keep in touch
If you are curious to see how things will go feel free click any of these links to join our community:
Discord Server: Discord.gg
YouTube channel for Timelapses: Youtube.com