Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

I'm wondering if you can help me with something.

Currently when you unspawn a saved event, the event ID it was using remains "in use" as in it wont be overwritten by future spawned events. I was wondering, if it's possible, if you could tell me how to change this behavior so future spawned events will overwrite the IDs of deleted events. It's fine if it breaks the restoring deleted events function.

Note: I'm using v1.4 as the newer version doesn't work with my game.

The image shows the events of the current map. There were originally 6 "Weed" events, I then destroyed 2 (red arrows) and spawned 2 more (blue arrows).



I want the newly spawned events to overwrite the IDs of the unspawned events. My game will have thousands of spawned events and I'm worried about the event data array getting out of hand. (Maybe this fear is unfounded?)

Hello! It appears you may just need to remove the saved event data when unspawning a saved event.

let eventId = this._eventId;
let removeSave = true;
Ritter.unspawnEvent(eventId, removeSave);

typically you would remove the saved event data unless there is a specific need for retaining the data and the event it was tied to, it's left available as an option but typically you'd be removing the saved event data when unspawning.

If you remove the save data when you unspawn a saved event the unspawned event should be returned to the pool and continue to be recycled as normal.

For all intents and purposes a saved event is a "real" event, it will always exist and it will be treated differently until the saved event data is removed.

as a side note your fears are not unfounded, if you aren't removing saved event data then you will end up with thousands of events on the map which will cause performance issues. As long as we're managing our saved events properly and keeping the number of events active at once in check (ie not having 5000 events active on the map at once) then you should be able to spawn millions of events and never have those performance drops which are caused by too many events on the map.

Thank you and I hope this solves your issue! Good luck with your project!

I am removing the save when I unspawn it. Reading your reply that it should be removing it from the maps event list caused me to do more digging and it turns out its a conflict with another plugin causing  it to keep the event data after being removed.