Stefano here, and this is Project_BuildTutto eleventh update! I'm exited for this one because the past weekend I decided to shift all the working schedule by a week since I wanted to work on the rest of the resource/objects types (like fluids and chemicals) before adding the pipes and all the object to manage that stuff in-game. But, surprisingly, I was able to add all that stuff on Monday, giving me all the rest of the week to work on the pipes and liquids handling system like it was planned to be in the first place. On the other side, on that system there is much more work than what I was planned so I'll be working on that next week too... But hey, life of a developer, I guess. Like every week, here are the timelapses and the changelog:
3 New object classes: Alloys, Liquids, and Chemicals
In the changelog you will see a lot the word "OALC", which is an acronym for Objects, Alloys, Liquids, and Chemicals. When you see that it means that I was working on something which involved all these different resources types.
- Objects: These are the classic ones, like raw_iron/raw_wood and all the objects made from those.
- Alloys: These are a bit different, every time you will make an ingot (object) of some material it will appear in the alloy tab. There you will be able to mix those ingots trying to make new materials from that. For example you'll be able to obtain bronze by mixing copper and tin ingots. When you will discover bronze you will be able to craft it and make objects of that material instead of limiting the player with only the raw resource that he will able to buy.
- Liquids: These will be needed to some machines to be able to work, and will be managed by the pipes system (more on that later). The player will be able to mix them creating solutions and other stuff like he’ll do with alloys.
- Chemicals: I still have to think about this but the main idea is that those will be mainly gasses and will be handled by the liquid pipe system. Can be combined too.
With all these new stuff some menus have been restyled, in particular the blueprint menu now has different tabs for the different resources and the buy resource menu has alloys, liquids, and chemicals in its scrollable list.
Since the solids and liquids management is deeply different, two different resources trucks are now in the game: one for solid objects and one for liquids and chemicals.
This last truck type will require no guy to offload but it will automatically connects to a pipe nearby and will starts to offload its content in the pipe.
Liquids handling: Pipes, pumps, and tanks
The liquid handling system at the moments counts of 3 different objects: Pipes, Pumps, and Tanks.
- Pipes are the obvious basic piece of every liquid system. They take one tile of space and automagically connects to any pipe, pump, or tank near them. They *should* hold one liquid type at the time. I wrote "should" because they *can* hold one or more liquid type, but if that will happen the liquids will mix together obtaining liquid waste and that will be something you will not want to happen. To avoid that liquid waste thing the player will have to design carefully all the system with pumps and filter pipes (the latter isn't implemented yet)
- Pumps are also pretty self-explanatory. Pipes will always try to balance liquids between them and their other connected pipes, Pumps will always try to push all their liquid and the one from their input side into their other connected pipes. These objects will be pretty useful to be sure to empty one pipes section before pulling in a different fluid type in order to avoid the liquid waste. Pumps will be also useful to pump liquids into Tanks, since a normal pipe doesn't have enough pressure to fill it up completly.
- Tanks are big 2x2 tiles objects which will capable to store big quantity of liquids. Can connect to pipes in any of their side. Not much more to say here.
With these basic objects type a somewhat decent liquids system can be made, but I plan to add more stuff to improve the usability of these system and to deeply expand its mechanics.
There will be also a Controller class called LiquidController (WIP in this moment) which will manage all the pipes and will divide them into sections to have an easier control about the whole system that the player will design.
Just like cables have their electrical view, Pipes have now a "Liquids View" mode where the game will highlights all the pipes related object and show more information about them.
Small gui optimization
Between all the big features I always work on smaller thing when I encounter them. Lately I discovered the beauty of al_create_bitmap function and that showed me many ways to optimize my code here and there. Specifically, in the window class previously I was drawing them by drawing 9 different scaled bitmaps each frame.
I was doing that because I wanted to be able to make windows of any size, and that system made me able to do it by stretching the borders of all the extra pixel I needed. But I was still drawing 9 different scaled bitmaps each frame. With al_create_bitmap I'm able to create a custom bitmap each time I create a new window with something like that:
- Create the new bitmap of the needed size
- Move the drawing target to the new bitmap instead of the screen buffer
- Draw the 9 bitmaps with the right scale inside the new bitmap one time
- Move the drawing target to the screen buffer again
at the end of that process I have a single new bitmap of the exact size I needed and with the exact effect like before. The major difference is that now I only have to only draw that single bitmap without any scaling and the cpu is ready to move on other stuff.
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