Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: Poe on March 31, 2012, 09:22:32 am

Title: speeding up event lookup
Post by: Poe on March 31, 2012, 09:22:32 am
this way that rmxp has to cycle through all events on the map, just to know if an event is even on a certain tile, it's seriously excessive. which quickly becomes apparent when you have several events doing this regularly. has anyone ever tried to speed this process up?

i was thinking with a hash or a table make a grid with all possible positions on the map as keys, the value being an array with all event id's currently on that position. then in game_character's moveto method, remove from current key and add to new. then one could simply call it like e = $game_map.event_positions[[x,y]], and cycle through e. what i don't understand is why they didn't make it like this in the first place, because they did with everything else. is there a reason for that?
Title: Re: speeding up event lookup
Post by: Blizzard on April 17, 2012, 09:36:43 am
I have tested this a long time ago and it turns out that the speedup is barely noticeable even with numbers of events like 100+. So it's not really worth the hassle.