Skip to content

Conversation

@taciturnaxolotl
Copy link

No description provided.

@taciturnaxolotl
Copy link
Author

I also have a very janky branch on my fork that clears the pheromones, kind of like a soft reset. It currently is using unsafe rust, however, so I don't think it would be good to merge.

@bones-ai
Copy link
Owner

bones-ai commented Aug 6, 2023

Hey, thanks for creating the PR, I finally got some time to test it.

The only problem I found with the behaviour is that when there are multiple food sources, the ants eventually end up going to the source that is the closest, hence all other food sources are rendered useless.

Is there a way to make atleast some ants still follow other food sources mainly so that there's more activity on the screen?

@taciturnaxolotl
Copy link
Author

I was looking into that, but I don't understand how to properly code in rust, so my solution ended up using unsafe rust.

@taciturnaxolotl
Copy link
Author

My solution was to make the const food source tuple become a mutable tuple with an extra field for decay points. Every time an ant ate a bite of the food source, the counter would go down till it reached zero, where the food source would disappear. That way, the ants would path find to a different food source. It would also be possible to add food sources on the fly as well.

@bones-ai
Copy link
Owner

Yes the ants pathing to a different source once a food source is complete is a natural way to fix this problem.
I feel like the best way to implement this is to create a new plugin for food, then have systems in place to detect ant collision and decrement its food count (and maybe also food size)

@taciturnaxolotl
Copy link
Author

taciturnaxolotl commented Aug 11, 2023 via email

@bones-ai
Copy link
Owner

It can be done using bevy resources.
But I think in this case you wouldn't need anything static? Its just going to be a plugin that maintains a record of all food sources, then decrements the food quantity when an ant collides with it

@taciturnaxolotl
Copy link
Author

I'll look into how to do that. I have absolutely no idea how to create a plugin but its my goal to learn rust so I will figure it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants