Hello, Reading your mail remind me a game dev design named quadtree to subdivise the screen or map and permit you to search inside smaller part instead of searching all the map for game object. It is widely used for collision detection when we have to know where are all objects and check if each objects enter in contact with each others. There is a lot of way to perform quadtree subdivision and it is huge source of discussion on game development. May be it could help.
regards, Sofiane Akermoun [email protected] 2014-05-15 12:12 GMT+02:00 Daniel Friis Lindegaard <[email protected]>: > Hi, > I'm developing a multiplayer game using Socket.io. > Because the amount of players and other game objects can potentially be a > lot, I want to be able to select the game objects from an area (x and y > coordinate) of the game. > > A simplified version of how the gameObjects are stored inside node.js is > below: > var gameObjects = { > "0": {x: 0, y: 32, name: "lol"}, > "1": {x: 0, y: 32, name: "lol2"}, > "11": {x: 0, y: 32, name: "lol3"} > } > > There can be thousands of game objects at the same time.. > > Should I create a multidimensional array (x and y) to hold references to > the game objects? Should I just filter the gameObjects or?? > What would you think as the best practice? > > -- > Job board: http://jobs.nodejs.org/ > New group rules: > https://gist.github.com/othiym23/9886289#file-moderation-policy-md > Old group rules: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/nodejs/97c67f0f-8f46-4a85-a29b-c22f46fa4649%40googlegroups.com<https://groups.google.com/d/msgid/nodejs/97c67f0f-8f46-4a85-a29b-c22f46fa4649%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Sofiane AKERMOUN [email protected] -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAN0_x-JqByZzQw93iQqGhcLv-HnrQQRE8NKdveVMfX9%3Dr%2BW1Tg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
