PDA

View Full Version : Movement Algrothums.



Mentor
11-03-2007, 05:31 AM
Ok, i need a few ideas for my movement algorithms in an isometric gamy thing im making.
My main problem is in syncing the movements across multiple players, while limiting the amount of server requests made.

The current way things are moved is, that when u click a cell the co-ords are stored in a buffer, then on the next connect cycle (when it makes a server request) these are sent off and stored, the server then sends back a list of user ids and co-ords, (aka where they were moving to and were sent by them, from there own buffers). The system will then set in place a movement algorithm which should be relatively predictable so basic sync would be acheaved.

My problem comes when i want to be able to click and view a users details. The current method uses a click able grid, with an array storing whats in each cell. if i want to use this method, i would need to make a request for every cell moved by each user (which is alot) as both the where there going co-ords and where they are now co-ords would need to be sent.

An alternative i came up with was to have a floating invisible image that followed the users, which was above the grid layer, so i could use onclick to easly get the users details.

The problem here, is then, when a new person enters the room, and players are placed, how will the system know where to put em. since i wont be storing the current co-ord positions.

In the js once a character image reaches a cell location it checks to see if its new location to go has changed, and it should forget current avoidance data and set off towards the new heading, or instead carry on to its destination. Although id much rather this be in the js and not directly liked to the request cycles.Since thats alot of requests and youd get jumpy movement, all the characters would stop at each cell, then move, rather than just carry on threw o.0

Anyone got an idea which could ether do both or at least compromise between request usage and fluent motion and sync?

Any ideas appreciated, ill probs be somewhat more successful myself when not half asleep anyway

Splinter
11-03-2007, 08:33 AM
What you really need to do is create a map detailing where each user is and when a user wants to move you can set a path between that point and their current position. Its a confusing problem because I take it you are talking about the movement from one position to another and not just from one point to another. Ill try doing some research.

Mentor
11-03-2007, 05:46 PM
What you really need to do is create a map detailing where each user is and when a user wants to move you can set a path between that point and their current position. Its a confusing problem because I take it you are talking about the movement from one position to another and not just from one point to another. Ill try doing some research.
Well point to point movements easy, although since the obsticals can move the algorithm has to check its path as it goes, to avoid walking threw something that wasnt there when the move started and the original path was plotted.
The problem is, when a new user enters the room, they need to know where that user is exactly, mid move.
Which means keeping a constant record of where they are at any time, which puts alot of strain on a server with so many requests, which is somthing i want to avoid.

Oni
11-03-2007, 05:51 PM
Well point to point movements easy, although since the obsticals can move the algorithm has to check its path as it goes, to avoid walking threw something that wasnt there when the move started and the original path was plotted.
The problem is, when a new user enters the room, they need to know where that user is exactly, mid move.
Which means keeping a constant record of where they are at any time, which puts alot of strain on a server with so many requests, which is somthing i want to avoid.
This is the exact same problem I had when creating a flash one. Hang on it answered the problem in a book I had ill try to find it.

Splinter
11-03-2007, 06:09 PM
The only real way I can see is to relay each square they move into to get the up to date information..
Maybe keep to pieces of information destination and current location.. the destination will determine the path and the current location will be the latest place on the way to that path.

Want to hide these adverts? Register an account for free!