Spaceer wrote:
Started working some days ago on learning APE for creating a
javascript MMO online game Engine, am just in the starting phases and
working on theories how to as effeciently as possible set up in
things.

Playin around with the idea how to position players around the map in
realtime atm, but cant really figure out a good way that seems
reasonable to be able to support a lot of players, I'll explain how
I've set up the engine so far. I'm using an canvas to draw a map of a
hash created of an SQL table that represents the map, maptiles are
represented in X and Y for positioning, evry draw (about 20 FPS) the
draw function takes out the relevent maptiles from the hash and draws
them correctly relevant to the actual X and Y which is seperated from
the X and Y of the map hash ( to create a fluent walk and not just
walking over tiles). So far so good, but when rendering players, i
need to be able to something similarly, check a hash, or the user list
properties of the Pipe to find out if other players are within view-
range of You, and then draw them accourdingly.

This i've accomplished trough using mootools each on the user list of
the pipe, what i'm worried about however is that running an each 20
times a second on the ENTIRE list of pipe users is not viable
longterm, that when the list of user grows. Imagine running this each
on thousands of hashe objects 20 times a second. I'm unsure though how
the mootools each and hash works though. Is this approach even viable,
if not, what would a smart solution be?



I am not sure I fully understand what you are saying ...

... why do you have to redraw the (presumably static part of the) map all the time?

My first reaction to you scanning a list 20 times a second is that you should convert to some form of event based approach, sending an event when someone/something moves.

Why don't you have a separate pipe for each geographic area, subscribing to the 9 pipes that make up the 9 regions/tiles immediately surrounding your position. When YOU move, you send a message down the pipe representing the region/tile you are currently in, when you cross a boundary you sent a leaving region message down one pipe and an entering region message down another. When someone else moves, you receive the corresponding events.

Locally, you keep an array of known players in the 9 regions around you, and update from the movement events coming down the pipes. Add a person to the hash when not previously found, remove them when you receive an event that they have left the 9 tiles you are currently looking at.

When you draw each frame (20 times a second), you just use your local record of player positions and only update those that moved in the last frame. You use a flag in each player record which you reset each frame and set when a movement event has occurred. That way, you only have to draw an updated player position when they have actually moved.



--
Alan Chandler
http://www.chandlerfamily.org.uk

--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

To unsubscribe from this group, send email to ape-project+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.

Reply via email to