So here's the problem: given an (x, y) position (on the map), return all events on that position
Currently, the way the game does it is to simply loop over every event on the map and select all of the events whose x and y values match the specified position.
def events_xy(x, y) @events.values.select {|event| event.pos?(x, y) }endIs it necessary to find ways to improve this?How much of a bottleneck does this approach really have, given that on average maps do not have more than 1000 events anyways?
I mean, it's only called every step you take so realistically it's not too bad, since the default engine assumes that only the player will need to actually check every event on the map at every step.
Currently, the way the game does it is to simply loop over every event on the map and select all of the events whose x and y values match the specified position.
def events_xy(x, y) @events.values.select {|event| event.pos?(x, y) }endIs it necessary to find ways to improve this?How much of a bottleneck does this approach really have, given that on average maps do not have more than 1000 events anyways?
I mean, it's only called every step you take so realistically it's not too bad, since the default engine assumes that only the player will need to actually check every event on the map at every step.
Last edited by a moderator:
