Omnimaga
Calculator Community => TI Calculators => TI-BASIC => Topic started by: TIfanx1999 on September 28, 2007, 02:07:00 pm
-
I'm sorry cause i know this question will sound a bit noobish. I was just wondering exactly what a tilemapper does. From what i understand it stores map data in a matrix, but exactly what data does it contain regarding the map and what all functions does it handle? If someone could post some commented code(or psuedo code), this would help greatly as well.
-
Tilemapping is the method of producing a grid-like map using sprites based on a matrix/list. A matrix can represent the map you want, and the individual elements are numbers that correspond to a certain tile pattern. If you have a 10x10 map and 4 different tiles, then you would put a 1-4 in each part of the matrix.
The most common (non-asm program) method of displaying this is using a for( loop with text sprites. You start a for( loop that goes through each element of the matrix and at the corresponding point in the map, the sprite is displayed. More information on textsprites can be found http://tibasicdev.wikidot.com/graphics.
Basically, tilemapping is simplifying how to display/store maps.
-
ok then, what about individual tile data? For example is the tile walkable or not, is the tile a door that takes the character to another place in the map, ect. does a tilemapper deal with these also or is that handled by another subroutine?
-
usually it's handled with another routine indeed
-
Ah ok, i want to make an RPG but i dont really understand how some things work. moving a char around a map and maniupulating map data is what im trying to figure out. That helps :)
Thanks for replies guys.
*EDIT* I've still got alot to learn :)
-
Really I love this. Tilemaps are basically the introduction to how collision detection is handled even in the 3D games of today. There is always simplified data that corresponds tot he graphical data that people don't realize.
So basically what this means is when your character moves around the map, don't think of him as moving in the graphical world, but the collision detection world. This means that he can have a corresponding position in the collision detection world.
So take this for example. An 8x8 sprite in a 8x8 tilemapped world of:
1,1,1,1,1
1,0,0,0,1
1,0,0,0,1
1,1,1,1,1
He can move on the 0's, but not the 1's. So put the character at the position of (2,1) given as (right offset, down offset) and then say the player presses the right key. Then you check (3,1) before you move the player. (3,1) is a 0 so you can move the player.
That is basically how it works.
-
That is pretty much what i figured, 1s are not walkable 0s are, and a test is done before movment(after a key is pressed) in order to see if that space is movable or not.(Makes logical sense). If you have the map data stored in one big file, where would u store the active map data in which the character is moving? Would u just copy it from the main map into a smaller one that represents the current player viewable area? and how would you have the charcter move within the map without corrupting the map data itself (IE if a character is on a tile in the map the data would have to reflect this and it would seem that it would overwrite the tile information)
-
The 1s and 0s are walkable/not-walkable only in that example, but the values you'd use could be anything.
The map data would be temporarily stored in a matrix/list/string so the actual map data wouldn't be corrupted.
The way most large RPGs handle maps is having the whole map divided into chunks, and when the player reaches/gets near an edge the map data for the next block is loaded, so you don't have to have one humungus matrix/list/string.
The location of the player isn't actually put into the tilemap, but only on the screen the sprite is displayed over the location they should be. All you have to do is make sure that the corresponding location isn't already occupied.
-
I was specifically refering to dragon warrior style where the map is scrolling and scrolls a set amont any time the player moves. I assume the "temp map" would have to be updated every step. I suppose you could have the "temp map" buffered several tiles in all dirrections and just update it when it gets to the edge of the buffer. Again im unsure of how it would be done in this sort of game.
-
yeah but then the map would be too huge to fit in RAM and it would be a bit slow unless you used tifreak8x technique in Pokemon purple. I recommend using smaller maps where it doesn't scroll at all and when u reach the edge of the screen it go to next part of the map
-
i really should look at his code and see how it works ;)

-
Good idea, also check out Metroid Pi source code if you decide to have dual layer ASCII :)
-
yea, i think i will. Gonna have to dig up my old graphlink software though because for some crazy reason TI-connect doesnt have a program editor..... Go figure.
-
Yeah there was a version of TI Connect with a program editor back then but it was so buggy they removed it