|
-
Originally posted by martin47
How would you do the "thinking" on the server?
well the server i use is based on java so i ported the pathfinding code to that(!) - as a function.
I created a new function which stores the Grid Array. Say Map[2][2] = "Blocked" and so on.
The server has listen handlers so when it receives at string with "GetPath" in it - it calls the pathfinding function. I could do this because I could extend the functions that the server has available. Because everytime an object move's the result is stored in the server side grid array, all I need to pass from client to server is - The Grid Pos the client wants to go to e.g. (4,5), The clients unique ID.
The server does it's stuff then spits back an array as an xml object to the client. Then the server updates its grid array and thats that.
The client is free'd from doing complex recursive math and doesn't need to store the entire grid with all the properties in memory, as if a square is blocked clientside - it is unclickable.
I hope that explains how I'm tackling this problem. I have no results on load testing or how long it takes to send/receive the path.
There are pro's and cons to either doing it client side or client/server. With the first the CPU is the limiting factor, with the second its CPU speed on the server (but this should be less of a problem) and Bandwith - If your client has to travel very far then you got a very long xml string back into flash and parsing that takes a long time! so it might take 3-4 seconds to get your path which could be unaccepteable.
I would love to hear anyones opinions on this.
yikes!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|