View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# storing level data

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1proanim  Members

Posted 19 August 2014 - 02:30 PM

I am looking to create 2D game (maybe RPG, maybe rogue-like, maybe both ), but i am facing a problem coming up with a solution for storing level data. I want to create initial level structure through tile system, but I don't want game it self to be dependent on tiles.

All levels can be created with tiles, that is tiles for ground, walls and other stuff, but than I would like player and other characters to be moving in freely without being constrained tiles and have fallout type zig-zaging and such. What confuses me is the fact that tiles that were used to construct the level would be written in a file in a way that would make sense to a human.

How should i go around storing data for a character's position if its not constrained to tiles?

### #2Lactose  GDNet+

Posted 19 August 2014 - 03:03 PM

Tiled level layouts do not mean movement has to be from tile to tile. You can still have positions stored as float, and adjust position gradually within a tile, without having to snap to up/left/right/down tiles on movement.

In a topdown (non-isometric) level, with each tile being e.g. 128x156 pixels in size, you can move around as if the level weren't tiled. You can, however, use the tile system to figure out e.g. collisions.

Using some simple math you can figure out which tile you're standing on, and only check for collisions or whatever in tiles that are adjacent (or otherwise interesting).

In this case, you could figure out the tile by using pos.x / 128 and pos.y / 156.

This also works for isometric layouts, but the math is (slightly) more involved.

Hello to all my stalkers.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.