2d RPG game - grid/coordinate movement VS per-pixel movement

Started by
0 comments, last by badjim 14 years, 1 month ago
Hi guys, For couple of weeks now, I've been writing small online RPG game in C#. I decided to implement 'grid' based movement - where map has i.e. 100x100 tiles, and player can move diagonally between neighbouring cells. I'm using pathfinder for NPC movement, and few other algorithms to let them wonder around more naturally. But now, when I'm working on my networking module, I'm stuck with one big issue: is grid-based-movent really a good idea? The problem is, when I want to move player on the neighbouring cell, I am checking, if cell is free: if (this.Map.Tiles.IsWalkable(Direction.Up)) { } When method returns false - it means tile is already occupied by other player/npc. BUT when I use this method I must ensure local grid is updated as frequently as possible to avoid synchronization issues... My questions are: 1. How do you normally cope with 2D movement where you need to respect blocks created by other players. 2. How should I deal with packet round trip time? In theory, I should use dead reckoning and move character up as soon as player presses UP arrow, but what if my method returns false, what do I do then? I can't gradually push player to another position, as he would end up in completely different place, on different coordinate. 3. Using grid system I must update position of every element EVERY time when it changes its coordinate. Isn't that bit of the overkill? Compare to per-pixel, where all I need to know is ending point of current 'walk' and few checkpoints on the path. I would appreciate your help, santod
Advertisement
"In theory, I should use dead reckoning and move character up as soon as player presses UP arrow"

Save that for Quake. In most RPGs a 1/4 second delay between clicking and getting a response is acceptable. Make that concession and your synchronization problems are gone.

This topic is closed to new replies.

Advertisement