Author Topic: tilemappers; what and how  (Read 3680 times)

0 Members and 1 Guest are viewing this topic.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
tilemappers; what and how
« 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.

Offline simplethinker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 695
  • Rating: +16/-5
  • snjwffl
    • View Profile
tilemappers; what and how
« Reply #1 on: September 28, 2007, 02:23:00 pm »
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.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true." -- Professor Robert Silensky



Chip's Challenge: ħ%

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
tilemappers; what and how
« Reply #2 on: September 30, 2007, 02:55:00 pm »
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?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
tilemappers; what and how
« Reply #3 on: September 30, 2007, 02:58:00 pm »
usually it's handled with another routine indeed

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
tilemappers; what and how
« Reply #4 on: September 30, 2007, 03:13:00 pm »
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 :)smile.gif Thanks for replies guys.
*EDIT* I've still got alot to learn :)smile.gif

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
tilemappers; what and how
« Reply #5 on: September 30, 2007, 03:22:00 pm »
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.
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
tilemappers; what and how
« Reply #6 on: September 30, 2007, 03:30:00 pm »
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)

Offline simplethinker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 695
  • Rating: +16/-5
  • snjwffl
    • View Profile
tilemappers; what and how
« Reply #7 on: September 30, 2007, 03:47:00 pm »
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.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true." -- Professor Robert Silensky



Chip's Challenge: ħ%

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
tilemappers; what and how
« Reply #8 on: September 30, 2007, 03:59:00 pm »
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.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
tilemappers; what and how
« Reply #9 on: September 30, 2007, 04:30:00 pm »
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

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
tilemappers; what and how
« Reply #10 on: October 01, 2007, 11:58:00 am »
i really should look at his code and see how it works ;)wink.gif

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
tilemappers; what and how
« Reply #11 on: October 01, 2007, 12:04:00 pm »
Good idea, also check out Metroid Pi source code if you decide to have dual layer ASCII :)smile.gif

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
tilemappers; what and how
« Reply #12 on: October 01, 2007, 12:38:00 pm »
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.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
tilemappers; what and how
« Reply #13 on: October 01, 2007, 12:43:00 pm »
Yeah there was a version of TI Connect with a program editor back then but it was so buggy they removed it