Gabriel #1 Since you're essentially using a 2d lookup table, why not just us an array? Index your lights and entities numerically and then it's a straight lookup, no time spent hunting for things.