An offline business simulator, designed to be persistent and large scale taking advantage of multithreading
No followers yet
Once you ship this you can't edit the description of the project, but you'll be able to add more devlogs and re-ship it as you add new features!
Minor backend refactoring update. I refactored the ID system for the assets and companies for easier scaling later. I did the same for the currency system, so why not use a new wrapper for the IDs too. Turns out, the blast zone of the was quite a bit so I had to go back and change all of the parts that previously used a raw u64 as the ID. This should make mixing IDs pretty much impossible now, and the code for generating new IDs is a lot smaller as it is just one short function rather than having to type and fill out an atomic operation function for every ID.
I don't have much to show for the frontend even after 9 and a half hours but the backend now sends player factory info to the frontend. Additionally, factories will now passively produce products over time. No news on the AI front yet, the player can't interact yet as well.
Next is going to be allowing the player to manage some things such as buying factories and selling products to the economy. Once I test the system and it works, I will get to creating primary and secondary industries before creating a save/load system.
I hate the Trial HSC btw, oh well
After almost 6 hours apparently, I have finally managed to get the generation to work. Apparently, my old system for preventing time drifting wasn't implemented properly leading to the entire core being eaten up and the tick system not working. It took me way to long to realise that and I did eventually figure it out. Then it turns out, after looking at my power and CPU usage, the crate I was using was probably used a spin sleep system. This made the tick timings more accurate and prevented time drift a lot, but the issue is that it does this by basically keeping the CPU awake, hence using up way too much resources and battery life.
Also, prior to fixing that bug, the window would become un-interactable the moment the 'server' backend started, and the RAM usage would start creeping up at a constant rate. I'm not sure why or how the memory was leaking, but it was something to do with that crate apparently, because now that I'm not using it, the memory usage is only 6MB! Prior to that, it crept up to 1GB before I ctrl + C it. I eventually made my own implementation of the tick cycle system. It went from 13% of a core to just 1% on release mode where it was 60 ticks/second and at 0.1% for debug mode at 10 ticks/second. To be honest, I think that smaller games would run better at 1 tick/second but I want to scale it to an extent where more ticks of smaller sizes are more effective.
Right now, the AI companies do nothing, but I can generate 1000 of them on one core basically instantly. I'm using shipyard ECS for the component management, which should heavily assist in the operation of the game thanks to its parallelism. I want the game to run at a constant tick rate with the minimal amount of work per tick so that the game can easily run a million AI companies while staying smooth. I think this goal can be achieved with good optimisation. Best case scenario, the primary bottleneck will be memory, not CPU.
In terms of the economy, for now, I intend to just have one currency, but this will probably be expanded into way after hackclub ends. The current currency system that I have keeps track on money as i128 microdollars for a very high degree of accuracy in terms of finances. I don't even keep that level of accuracy in my math exams, but apparently stock exchanges keep 4 decimal places of accuracy in their prices, so microdollars should be fine. Additionally, even if your currency happens to be Zimbabwean Reichsmarks, the insane range of i128 is more than enough to maintain even the most inflated of inflated currencies without any integer overflows.
Also, mandatory I don't know what I'm doing, Rust documentation is never clear and there's a lot of experimentation to ensure that my CPU doesn't catch fire or my RAM stick doesn't undergo nuclear fusion towards Fe56.
Added the initial create game page, future versions will feature more parameters. The game is designed to scale as high as your CPU can, with Rust multithreading underneath to support large amounts of AI companies. The game is planned to be an offline business simulator will you compete and co-exist with thousands (or millions with a good PC) of other companies that you will need to work with or against to thrive.