• Content count

  • Joined

  • Last visited

Community Reputation

105 Neutral

About CarlosNavarro

  • Rank
  1. Al principio yo suponía que sería ingeniero, pero la idea de tener que gastar mi energía creadora en cosas que hicieran la vida cotidiana práctica cada vez más refinada, con una sombría ganancia de capital como objetivo, se me hacía intolerable. ¡El pensamiento, por sí mismo, como la música! A. Einstein
  2. Tile-based multiplayer

    First of all: Sorry if I don't express myself very well, I'm not very fluent in english :'( I'm developing a multiplayer tile-based game (imagine habbo) and having some trouble with the movement. The idea is to click on a tile (target tile) so your avatar moves there and everyone can see you moving there. In order to do that, there's a pathfinding function. My first approach was to run the pathfinding function in the client and everytime the avatar moved a pixel (guided by the pathfinder), the client sent a message to the server which broadcasted this update. This was obviously crazy... My second approach was to send to the server just the target tile. The server broadcasted this target tile, and each client ran the pathfinding function for each avatar in movement. I found problems with this because of synchronization: imagine two users moving that pass through the same tile at different times, maybe in one client with a little lag it happens that they pass through the same tile at the same time, so the pathfinder will stop one of them, as you can't walk over another avatar. This would lead to different positions in each client. I've read some cases where the pathfinder runs in the server, the client just send the target tile and receives every x mseconds an update from the server with the pathfinding calculations for every avatar in movement (even himself). The problem I find here is how to set this "x mseconds" and that it might mean a lot of load to the server, handling all the pathfinding calculations... So, has anyone deal with this problem? What would you do? Thanks a lot, Carlos
  3. Multiplayer HTML5

    Hi! I've been working on some simple games on HTML5 connecting them with DBs (using AJAX to update them), and I've think on advancing a little more and create something multiplayer. My first thought was to create a game of turns, that is, first one player, then the other (example: almost any card game), using exactly the same method I've been using until now (AJAX(Client)>PHP>MySQL>PHP>Client). But the real deal would be something a little more dynamic, character moving and so. Of course, depending on the complexity you can also use the ajax>php>mysql method I talked about (example: just sending to server the new x,y coordinates where the user wants to move to), but if there are things between you can't walk through & stuff it gets more complicated. Then I remembered when I used Flash for a thing like this, the sockets, servers & all that, so I wonder, creating games with JS also requires that kind of stuff? How data is sent to the server? I hope you've understand me, sorry for my awful english :S And another doubt: when I tried Flash & multiplayer I was mad about something related to movement, which data should I send to the server? Because updating every pixel the character moves was insane, I was updating the position in the server a lot of times per second per user and that caused a lot of lag... Sending just the final position (where the user clicked) was not a good idea neither, because if there was anything not-walkable with movement (such as other characters), the user ended in different positions in each client... Thank you in advance. I'm not asking for code, just some 'light'.