Hello Saeges!
Over the past week or so we have been redesigning completely the way that crops work (internally) in Farmwand. This was a task we were not necessarily looking forward to since our previous system worked quite well, but we had two very important reasons for the revamp.
First, we are already implementing the whole save/load mechanics of Farmwand. We are quickly entering the alpha stage and the ability to save/load the game is a must, even if just for testing more complex scenes.
When you save a game, you are only storing information. Little numbers, texts, true/false statements, etc. That beautiful farm you made gets turned into a list of values and then, when you load, those values are read so the game can "re-plant" the farm matching exactly the recipe contained in your save file. In our previous system each plot of land was its own self-contained thing. This made coding for it easy but saving the game...not so much. That level of "independence" between each crop made organizing them in the save file kind of messy.
The second reason (also super important) was performance. While Unity and our PCs can handle very large amounts of crops without issues on our old crop system, we still plan to release the game for more limited and slower devices like some non-gaming laptops and eventually the Nintendo Switch (fingers crossed!). We want Farmwand to have a great port, where the main change is the screen size and not the quality or performance of the game. And while we had our discussions about how big of a farm is too big, by checking on other titles actual sizes for their farms we decided to run a few stress tests on older and newer devices.

So far so good, almost 90FPS, but still not good enough. Those FPS will drop after adding the landscapes, the towns, the animals and decorations. We needed a bit more margin if we want to be able to hit that 30FPS spot on lower end devices without issues.
Enter version 2 of our system. A full rewrite that turned all of our crops from "objects" into simple values within a table and now handles the processing of those values and their displaying as beautiful crops through the power of multi-threading, that is, using every little bit of processing power available on your device.
The math was scary, setting up all the data to work as efficiently as possible and finding a Unity version where everything worked without errors involved a healthy dose of hair pulling and more than a spoonful of programmer's tears but in the end, we managed to make it all work. And the results speak for themselves.

Our field went from 1024 (32x32) crops in our early stress test to 3000+(we've gone as far as 6000+) with version 2. There are still some more tests to be done, but with a field more than 3 times bigger and almost a 300% performance boost, we think we are on the right track :D
But what is left to do? We are taking out some of the third-party assets we've been using for foliage, terrains and other world-related stuff and replacing them with our in-house tools. This will allow the game to run much better in smaller consoles and devices and, hopefully, with enough power to spare so that the graphical quality does not get impacted negatively (no one likes a bad port where you get 10% of the game's visuals running at 20% of the speed).
A lot of work lies ahead, but once again, things are on the right track.
So, thank you for coming to our Ted talk, and until next time!
[ 2023-08-07 18:39:01 CET ] [ Original post ]