• Content count

  • Joined

  • Last visited

  • Days Won


Nepoxx last won the day on October 31 2014

Nepoxx had the most liked content!

About Nepoxx

  • Rank
    Advanced Member
  • Birthday 03/01/1988

Profile Information

  • Gender
  • Location
  1. Infinite game

    The reason why you want to move the world and not the player is that if you remove the camera bounds, your player can reach a point where it's coordinates stop being accurate and becomes jittery. This is due to limited floating point precision and is inevitable. Now, you have to ask yourself how far do you realistically expect a player to reach. If you allow your player to teleport, this is definitely an issue. If your player can fly at insane speeds, again, this can be a issue (it also depends on your scale). However, if your player starts at (0, 0), and doesn't move amazingly fast, you might get away with a non-infinite world. That's what minecraft does.
  2. Infinite game

    I did not. none of the pre-built solution worked for me (wrapping, camera bounds, etc.) You'll need a custom solution. I tried "moving" the entire world back to the origin when exiting a cell, but there was a noticeable jitter when doing so. I think that too many of Phaser's rely on absolute coordinates instead of relative coordinates, which makes a "the world moves, not the player" solution very hard, if not impossible, to implement.
  3. Infinite World Bounds?

    I posted a similar question here: Hopefully the answers help you out (I never were able to achieve what I wanted, but there are good alternatives in there)
  4. Any update on this? I'd definitely be interested
  5. Infinite game

    Well that works somewhat, I get the intended behaviour with one major caveat, the world doesn't render outside the bounds. If you look at my picture above, if you are at the right edge of tilemap5, it will not render tilemap3 to the right of it. The behaviour I'm looking for is something like walking on a planet, if you keep going east you'll see your starting point ahead of you.
  6. Infinite game

    But it doesn't really wrap like I want it to. I'd like the camera to ALWAYS follow the player around. In that example, the camera doesn't follow the player around near the edges. Something similar to this, but where the camera always follows the player and the wrapping is not noticeable is what I'm looking for.
  7. Idea for automatic conversion to multiplayer

    This is like going to NASA and telling them you can go to Mars using a fork and some duct tape. Don't take this the wrong way, but no, this is not going to happen. You are either new to coding and have absolutely no idea what this implies or you are a coding genius, and know how to share states between client and server, what information is relevant to which, you know what updates to send, when to send them, how clients interact between each other and how they can affect the game state, etc. etc. etc. Again, no offense, but do you really need to ask who would like automagic conversion to multiplayer code? Here's a hint: everyone.
  8. Infinite game

    Oh, then this thread is potentially useless. Is there a way to make it "wrap" around? Since my tilemap's size will be limited, if it doesn't wrap around I'd have to have multiple tilemaps to be able to have an infinite world. In this image, the redsquare is the "screen" (what the player sees). When the player moves to tilemap 5, I would move tilemaps 0,3 and 6 to the right, and replace whatever content they had with new tiles. However I don't know if this is at all possible with tilemaps, or advisable.
  9. Tilemap scrolling

    Hey everyone, as explained in another thread I started, I'm trying to "move the world" instead of moving the player. For that purpose I want to make a tilemap scroll, but I'm not able to. I tried setting TilemapLayer.scrollX and TilemapLayer.scrollY and nothing happened. I even tried something like TilemapLayer.scrollX = player.x * 2; to no avail. How are you supposed to use those functions? /* Game logic */function create() { game.time.advancedTiming = true; game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = '#000000'; /* Map definition */ map = game.add.tilemap('map'); map.addTilesetImage('magecity', undefined, undefined, undefined, undefined, undefined, 1); map.setCollisionByExclusion([73, 74, 75, 81, 82, 83, 89, 90, 91]); ground = map.createLayer(0); ground.debug = true; ground.resizeWorld(); // Player sprite player = game.add.sprite(game.width, game.height, 'player'); game.physics.enable(player, Phaser.Physics.ARCADE); player.body.collideWorldBounds = true; player.anchor.setTo(0.5, 0.5);; HUD = new HeadUpDisplay(game, 'Head up display'); //cursors = game.input.keyboard.createCursorKeys(); upKey = game.input.keyboard.addKey(Phaser.Keyboard.W); downKey = game.input.keyboard.addKey(Phaser.Keyboard.S); leftKey = game.input.keyboard.addKey(Phaser.Keyboard.A); rightKey = game.input.keyboard.addKey(Phaser.Keyboard.D); socket = io.connect('http://poste-0432', { port: 8000, transports: ['websocket'] }); setSocketEventHandlers();}function update() { game.physics.arcade.collide(player, ground); ground.scrollX = 5; //does nothing ground.scrollX = player.x * 2; //nothing if (player.y < 10) { player.x = game.width / 2; player.y = game.height / 2; } if (player.body.deltaX() !== 0 || player.body.deltaY() !== 0) { socket.emit('update player', { x: player.x, y: player.y }); } player.body.velocity.x = 0; player.body.velocity.y = 0; if (leftKey.isDown) { player.body.velocity.x = -150; } else if (rightKey.isDown) { player.body.velocity.x = 150; } if (upKey.isDown) { player.body.velocity.y = -150; } else if (downKey.isDown) { player.body.velocity.y = 150; } player.rotation = game.physics.arcade.angleToPointer(player) + 1.57;}var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update});
  10. Infinite game

    Well that's exactly what I want to achieve (move the world, not the player), but I can't really move tilemaps around can I? I thought about using tilemap.scroll, but does that work with Physics? and how are the coordinates handled when working with scroll?
  11. Infinite game

    Awesome link gnumaru, thanks! The main issue is that I'm not sure how Phaser can help me. If I use a tilemap, I necessarily have to move the player around, and that won't work with an infinite world. So I kinda have to create the tiles myself using sprites and groups, however, at that point, am I better off using pure pixi instead?
  12. Infinite game

    "Minecraft viewed from above" describes it pretty well. I'm also interested in the theoretical aspects of it as well
  13. Infinite game

    Hey guys, I've been pretty busy lately trying to make an overhead game using a tilemap and arcade physics. I'd like the game to be functionally infinite in all directions, à la Minecraft. I came up with a few ideas to make this work and would appreciate some feedback or advice from people that re doing similar concepts. The first solution, to make the game limitless. What I mean by this is to not do anything particular to make it limitless, simply make the camera follow the player, and do not give any bounds.Pros:Trivial to implementCons:Limited by floating point precision, which may even vary by device Another common approach for this is to "move the world, not the player". The benefits of this is that you basically never encounter precision issues, because all the entities you see, including you, are at or near the origin.Pros:Virtually infiniteCons:Very hard to implement (everything has to be converted to local/world space all the timePhysics might not work with the existing systemsThe world might contain a lot of sprites, so moving the player implies moving a lot of sprites, which may not be efficientAn approach I thought of is to create a tilemap larger than the screen. When the player reaches the edge of the screen, the tilemap is shifted to the left, and the player is recentered at the origin. For example, imagine a square 3x3 tilemap and only 1 tile fits on the screen. If the player moves right, we destroy all the left tiles, shift all the tiles left by one, load 3 new tiles on the right, then recenter the player.Pros:Very few tiles loaded at anyone timeSomewhat easy to implementCons:When recentering everything, there will probably be a moment of stutter I'm open to suggestions/comments/ideas for this project/concept
  14. [Ask] Error Get phaser.Map

    If you don't plan on using the map to debug, you can prevent this behavior by removing the following comment from the minifed source: //@ Actually, you should remove that line from production code as it will prevent a totally unnecessary http get call (not that is it expensive, however).
  15. Phaser + Sublime Text (Snippets / Completions)

    Take a look at this: Works good IMO.