I went to bed late last night with visions of sugarplums dancing in my head. I actually wrote that previous blog post from bed, my wife was asking me “what are you doing?” and I told her I just needed to get my thoughts in order. I had great hopes that click-to-move (I’m gonna use the acronym ‘CTM’ for now on) would be a holy grail. The bottom line is that it would save a tremendous amount of network messages that would normally get sent out many times per second, per user. So at the rate of 10 times per second, if you had 20 other people in the scene with you, you would be receiving 200 network/positional updates per second, and sending out 10 messages yourself.
CTM allows me to broadcast the requested target position of the player, and the code will set basically a navigation target marker. Then at your own leisure, you update the position of the target object until it is where it needs to be.
There is already a navigation pathfinding framework in Shiva which I tried to use. I’ve used it before for CastleGuard2, all the monster AI relied on it. Basically you build a level/map, and then you build a path node grid of navigation points. When you want to use it, you pick a target spot, ask the navigation system to tell you what the nearest navigation point is, and the system finds you the shortest path between those two points, using only the navigation grid. Then you move a navigation object along that path over time, and update your player to be near that navigation object to create a nice smooth transition. It works quite well.
Unfortunately it comes with a couple drawbacks. The first drawback is that you do have to build (manually) a navigation map for your entire level. That takes up memory (albeit probably not much) but could potentially be quite painstaking. I plan on having a free-roaming and possibly large game world, and some of it I wanted to procedurally generate. This means I can’t manually build nav meshes for every level.
One of the other drawbacks is the feel of it. As a player, I want precise control, as precise as I can get it. When you use a nav pathfnding system to move a player character, he will always face in the direction of the nearest path marker he is journeying to. However, the path might not be in a straight line, even though there might not be any objects between you and your destination. That’s due to the granularity of the navigation mesh. It’s way too expensive to have navigation nodes everywhere, so you pick a granularity number, say 1 unit, and nodes are placed every 1 unit. However you don’t move (or turn) in values of 1 unit, unless you’re making Frogger. So the effect is crooked paths to represent the shortest point between A and B. This is fine for enemies, as they can use it to avoid obstacles and what have you, but bad for players.
So I took a chance and ditched the navigation pathfinding experiment, and rolled my own. It works in a similar way in that a destination navigation target is set, and a navigation object is used also, which your player object updates itself towards in a smooth manner. The difference is that as soon as you place a new destination, your navigation object orients itself towards that destination object, and then moves FORWARD towards that navigation destination in a smooth manner. It also will continue to point at the destination. The end result is that you turn and point in the direction you wanted to go to, and you walk towards it. Just like you would in real life. This means no strafing possibly (unless I combined the CTM system with a tiny bit of normal multiplayer movement).
I am quite happy with the result, and it feels *great* so far. A heck of a lot less clunky than the FPS style movement or dual sticks that everyone complains about on the iPhone, and always draws comparisons to the latest greatest dual stick mover.
Time to have some breakfast with the family, and then see what’s next
How’s your progress?
Progress is fantastic. The experiment led me to get together a team of folks to work on an iphone mmo and begin design discussion. We are finalizing the initial feature list now. I’ll be posting more about it very soon (maybe tonight!)
Какие слова… супер, великолепная идея…
I went to bed late last night with visions of sugarplums dancing in my head…..
ща позырю заценю ….
I went to bed late last night with visions of sugarplums dancing in my head…..