Tag Info

New answers tagged

0

From Datenwolf in this answer on stackoverflow: We can render tiles with a 2-loop: for m in 0 to M: for n in 0 to N: render_tile(n, m) where render_tile(n, m) starts by setting the viewport to the surface size (render target): glViewport(0, 0, W_t, H_t), for tile width and height W_t, H_t Somehow we've to shift the projection along with ...


0

All you have to to is set glViewport then invert its transformation. Create a matrix s= tilecount; for(int x=0; x!=tilecount; x++) for(int y=0; y!=tilecount; y++) [s 0 0 x] [0 s 0 y] [0 0 1 0] [0 0 0 1] And multiply it * your modelviewprojection


0

You just need to modify your A* implementation to exit when there are no acceptable tiles left and save all tiles meeting the condition. Start as usual and set a MaxCost value (that is max distance unit can walk). Then iterate possible tiles to go and add ones that are passable and whose cost is less than or equal than MaxCost to a list. Algorithm ends when ...


0

If you know the shape of the piece, and you know where you want to place it, I would assume you have determined the orientation of the piece already. If this is the case then I think the solution is fairly straight forward. You have a default orientation for each piece, and depending on the piece 0-3 possible alternate orientations. The number of rotations ...


4

I added another answer for an alternative explanation of the problem. You can think of this problem as Motion Planning in the Configuration Space of the tetris piece. The Configuration Space Define the configuration of a Tetris piece to be an (x, y) location and a rotation (t). The configuration of a Tetris piece is therefore three dimensional. We can ...


2

I am assuming that your problem is: Assume the placement location is known. How do I find the optimal sequence of moves to put the piece in the correct location? One answer to this question is to interpret the problem as an Action Planning problem. The simplest algorithm to solve it is probably STRIPS. There is another algorithm that is a more ...


3

I start with coordinate systems — the coordinates for grid locations are (x,y) but as Krom mentioned in a different answer, for walls there can be up to two walls for each grid location. That leads to a second coordinate system, for edges between tiles. In this article I used West and South so the edges can be (x,y,West) or (x,y,South), but you can pick two ...


1

Hopefully this C# is okay for you - my c++ is very rusty: abstract class MapFeature { public void Draw(); public bool IsWall(); } enum Direction { North, South, East, West } class Wall : MapFeature { public bool IsWall() { return true; } public Tile Front, Back; // Tiles on either side of the wall, otherwise null. #region ...


4

In each tile you can store walls it has on North and East. That way each tile needs to store only 2 more booleans (or ints, if you want to store wall type). Downside is that tiles along South and West edges cannot have walls on South and West unless you add a one more row of hidden tiles that will have them.


2

In each tile, it could store the neighbours (or connectivity) that it has access to. Perhaps as a bitmap. The walls are where the two adjacent tiles are not connected. This is very friendly with A*. The second approach is to store the connectivity of tile as a enumeration. For example, a fully open tile is 0, a tile with wall to north and rest open is 1, a ...


3

Going 3D when the game is basically a 2D game seems like an overkill. In your place, i'd rather use a 2D engine that handles already tiles and slopes, and just use a few tricks for the parts where a '3D' effect is required. Just a small example, a bridge : So for the player, that would look like : Now you can add some invisible trigger zones that ...


2

Add a logical third dimension and add logic to tiles by type. So a horizontal bridge will allow you to pass from left to right on Z = 1 and from top to bottom on Z = 0.(like flow bridges game) Now change the Z when walking up or down a hill. Allow jumping 1 unit high. That's about it. edit: here is an example tutorial- http://rpgmaker.net/tutorials/163/



Top 50 recent answers are included