Hi everyone,
I'm creating an isometric tile-game-engine in HTML 5 (canvas) for a project.
I've already created a simple two dimensional array with different tiles, a two dimensional array of objects and a two dimensional array of persons.
I manage to paint them correctly and have even got some simple scrolling, pathfinding and a mapeditor working.
Now I'm considering if I'm going down a wrong path. Because I'd like to have bridges too, where you can pass under it, as well as go over it. And it seems like that would be a bitch too implement the way I'm going.
What I'm considering is throwing out the tile array, and only having the "object" array, which now should include tiles too. And then somehow have a height attribute on that too, and then make some logic, so that characters can go from walkable object to walkable object if the object height is no less than 30 pixel from the one the character is coming from.
Does this sound smart at all? Or is it stupid? Since I'm new to this whole thing, I don't know if I'm doing it all wrong
(I tried to both google and look in the forum for similar topics, but I couldn't find anything. But maybe it's because I don't know what terms to search for).
I don't know if it's helpful at all, but I've attached a screenshot from the game.
[attachment=4044:tilegamescreenshot.jpg]
Thanks in advance,
Martin.
Building a map and navigating
The way i would approach this is to have certain special tile types labelled 'bridge', and a height attribute on each moving object. The bridge square would allow travel underneath it if your height is <= 1, and over it if your height attribute was >= 2.
You would have to add special rendering code to decide wether or not to draw the bridge tiles or character first (to determine what appears 'on top', z-ordering) dependent on the height value of the character.
I would also implement sloped tiles, which allow transition from height 1 to height 2 and vice versa, these being the only way to transition in height to avoid the complicated idea of having to guess at where the character is going to go.
Please let me know if you need further clarification.
You would have to add special rendering code to decide wether or not to draw the bridge tiles or character first (to determine what appears 'on top', z-ordering) dependent on the height value of the character.
I would also implement sloped tiles, which allow transition from height 1 to height 2 and vice versa, these being the only way to transition in height to avoid the complicated idea of having to guess at where the character is going to go.
Please let me know if you need further clarification.
The way i would approach this is to have certain special tile types labelled 'bridge', and a height attribute on each moving object. The bridge square would allow travel underneath it if your height is <= 1, and over it if your height attribute was >= 2.
I'm pretty sure I understand you. But let me change my requirement to "I'd like to have 3-4" story houses, where characters can walk on each story simultaneously.".
- Now I probably won't need this, but since I'm making the game-engine myself, and don't really have a deadline, I'd like it to be as flexible as possible.
Also, what I'd really like is for tiles and objects to be "the same thing".
The way I'm thinking, I'd make it so that tiles were just objects, with a height (or depth, or whatever you'd call it). That way I could make a "stair object" which would be possible to ascend, or a sloped tile, or hanging platforms. And it would also be possible to stack objects on top of each other.
That way I could by having one simple box object, create most of the figures here: http://2.bp.blogspot...ractise.001.jpg (just an example I found). - That seems pretty flexible.
Am I making sense?
One way to make it is to view tiles as nodes in a graph. Connections between nodes represent movement possibilities. So for a stair, in one direction, you would connect to another tile that is higher and in the other direction, the tile that is lower. You could also allow the player to jump down from the stairs(stair go North-South, jump East on the floor), but not jump up the stair from the ground, so you would have a one way connection.
For bridges, the tile below and the bridge will not be directly connected making movement between the 2 impossible.
Nice thing about it is pathfinding will become easy since your world is represented as a graph already.
For bridges, the tile below and the bridge will not be directly connected making movement between the 2 impossible.
Nice thing about it is pathfinding will become easy since your world is represented as a graph already.
Tiblanc:
That sounds like exactly the thing I want to do. Do you know of any tutorials about that kind of engine? (or if it's called anything specifically so I can google it myself).
That sounds like exactly the thing I want to do. Do you know of any tutorials about that kind of engine? (or if it's called anything specifically so I can google it myself).
Not sure if there's a specific name for this. Articles on nagivation graph/mesh could get you started.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement