Temple of The Roguelike Forums
Development => Programming => Topic started by: gideon_stargrave on May 08, 2013, 01:49:09 AM
-
If it's possible, that is.
Logically 3D. ASCII display with the ability to move up and down the z-axis.
Whatever pointers/hints you can provide would be appreciated. If you could give a general sketch of the implementation rather than specific code, that would be great - learning experiences are valuable.
Thanks in advance!
-
What do you mean by a 3d world?
You can use noteye if you want quick and easy 3d.
-
Logically 3D (dwarf fortress) or Graphically 3D (Diablo 3)?
-
Logically 3D (dwarf fortress) or Graphically 3D (Diablo 3)?
Logically 3D. ASCII display with the ability to move up and down the z-axis.
-
The easiest thing that comes to mind is just adding another dimension to the array. Using a 3d array for the map instead of a 2d array.
-
You need to make a distinction between the player's view and the game's map. This wouldn't be much different from a logically 2D game.
All you do is use a 3D array - [y][z] and store whatever z-value the player is currently viewing from. This is no different from a normal game, where the view target of your proverbial camera can be described as the coordinate from which the viewing area is drawn.
In a fixed view roguelike, such as Brogue, the 'camera' is always pointing at the center of the viewing area, whereas in ToME, which follows the character (to some degree anyways) points at the character.
It can be useful to make the camera it's own entity so that you have the freedom to move it around with a 'look' command or what not- especially for a 3D roguelike.
-
You need to make a distinction between the player's view and the game's map. This wouldn't be much different from a logically 2D game.
All you do is use a 3D array - [y][z] and store whatever z-value the player is currently viewing from. This is no different from a normal game, where the view target of your proverbial camera can be described as the coordinate from which the viewing area is drawn.
In a fixed view roguelike, such as Brogue, the 'camera' is always pointing at the center of the viewing area, whereas in ToME, which follows the character (to some degree anyways) points at the character.
It can be useful to make the camera it's own entity so that you have the freedom to move it around with a 'look' command or what not- especially for a 3D roguelike.
I tried to do something akin to that, but I couldn;t get libtcod to display anything. I'll take another crack at it.
-
Do the map as a Map[z]
- [y], and pass the Map[z] into the drawgrid thingy. I haven't used libtcod but I imagine that's the sort of pseudo-code you need.
-
Do the map as a Map[z]- [y], and pass the Map[z] into the drawgrid thingy. I haven't used libtcod but I imagine that's the sort of pseudo-code you need.
Maybe I'm just thick, but I'm having a little trouble envisioning what you are suggesting here. Could you elaborate a little?
-
err- sorry, the formatting messed up somehow.
Make the Z component of your map come first. So that you have a bunch of 2d arrays with respect to a Z-component Array.
In other words, your map is of the form Map[z][x][y].
Now, when you want to draw something, you simply pass Map[z] into your grid-drawing function. The grid-drawing function expects a 2d array of x and y coordinates- Map[z] is a 2d array, whereas Map is a 3d array. Get it?
Edited with tags >_<.
-
This might be a good place to use [ code][ /code] tags.
-
err- sorry, the formatting messed up somehow.
Make the Z component of your map come first. So that you have a bunch of 2d arrays with respect to a Z-component Array.
In other words, your map is of the form Map[z]
Now, when you want to draw something, you simply pass Map[z] into your grid-drawing function. The grid-drawing function expects a 2d array of x and y coordinates- Map[z] is a 2d array, whereas Map is a 3d array. Get it?
I think so. I'll mess around and see if I get something to work. I think so long as I can get something to show up on the screen I'll be able to jury-rig the rest.