this post was submitted on 28 May 2024
20 points (100.0% liked)

Programming

17354 readers
310 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

I am looking to program something similar to a simulation game, but free-form in its customization and scripting to the point where no strategy game will get me close enough.

I initially thought to start from scratch, simulating all the basics. Simulating money, people, resources, maps, etc. Obviously this is very ambitious.

Are there any libraries or frameworks that could help me with this? I don't want something opinionated that decides the model for how to simulate, for example, money or a person. I want to preserve the ability to simulate those with the models and math of my choosing. But maybe a library that has the foundations of simulation in general, so that I don't have to build everything completely from scratch?

I understand what I said sounds very vague. This will be something I will discover as I do more of it, so forgive the vagueness.

you are viewing a single comment's thread
view the rest of the comments
[–] StrikeForceZero@programming.dev 1 points 5 months ago* (last edited 5 months ago)

With such a complex system like that it would probably be beneficial to actually build the parts you care about and take advantage of libraries handling the querying of Data like ECS and rendering with bevy. Otherwise you'll run into the risk of being limited by the library in one way or another.

Define a bunch of structs that you can use compositionally in bevy's ECS. Create specific systems that react to components being added, removed, or changed. Set conditions like Burnability, Durability, Temperature.. etc. React to those conditions or thresholds being met. Your reaction could even be a component. Damage(5), IgnoreArmorDamage(3), CurrencyUpdate(-5), GiveItem(Item::Sword(Stats {..}))

It basically gives you a foundation that feels like scripting but with the power of compile time safety for virtually everything. You get to "model" the data how you want instead of being limited or overwhelmed. And with ECS it really helps make things feel like Lego blocks that you can easily reuse across the entire project.