I’m finally settling into a creature design. I’ve tried several other setups, but I still like having a generic creature struct with a function pointer for behavior. It fits well with the two roles that a creature has to fill, storing information about its state, and determining what to do next time it gets a turn. Any properties specific to that creature are stored in its
This is how the plant is currently defined.
get_variables is pulled out to keep the action method a bit cleaner. I think I can come up with a much better way to get these variables. The main issue is that I don’t know which
Property variation a given property is going to have. I have two thoughts about this. One is that I might be able to make a macro that handles this cleanly, but I’m not ready to dive into macros yet. The other is to make every property an
Property enum currently looks like this:
HashMap<String, Property> to
HashMap<String, f64> would make it much easier to deal with property values, and it would pretty much cover every case except for
Text which I probably don’t even need.
In other news, I made my own struct for the turn queue that uses a HashSet to track duplicate entries. Now it’ll ignore any
push that contains a value that’s already in the queue. Works like magic and everything is still lightning fast. Hooray!
Adding a ground layer. This will be for stuff like plants that creatures can walk on top of without taking their space. This feature is the main reason I’m so concerned about performance since it’s going to double the size of my grid. It should be cool though. It’ll behave just like the existing layer so I’ll basically have two simulations going at once. One to determine the landscape and one to determine the action that happens on top of that landscape.
Here’s a pretty picture.