### Author Topic: Tile mapping tutorial? for axe?  (Read 9766 times)

0 Members and 1 Guest are viewing this topic.

#### saintrunner

• Custom Spriter: You ask it! I'll Make it!
• LV10 31337 u53r (Next: 2000)
• Posts: 1787
• Rating: +115/-11
• Flogging Molly
##### Tile mapping tutorial? for axe?
« on: November 17, 2011, 03:58:50 pm »
I'm looking for a really good tutorial for tile mapping! keep in mind I have never done it before, but I am very interested!
Thanks guys

GAMES:
Spoiler For Spoiler:

#### AngelFish

• Is this my custom title?
• LV12 Extreme Poster (Next: 5000)
• Posts: 3242
• Rating: +270/-27
• I'm a Fishbot
##### Re: Tile mapping tutorial? for axe?
« Reply #1 on: November 17, 2011, 04:00:35 pm »
We have a tutorials section on the website that happens to have two tilemapping tutorials on it.

Here you go:

http://www.omnimaga.org/index.php?action=articles;cat=12
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

#### saintrunner

• Custom Spriter: You ask it! I'll Make it!
• LV10 31337 u53r (Next: 2000)
• Posts: 1787
• Rating: +115/-11
• Flogging Molly
##### Re: Tile mapping tutorial? for axe?
« Reply #2 on: November 17, 2011, 04:10:53 pm »
can you also direct me to an example program I can look at?

GAMES:
Spoiler For Spoiler:

#### aeTIos

• Nonbinary computing specialist
• LV12 Extreme Poster (Next: 5000)
• Posts: 3915
• Rating: +184/-32
##### Re: Tile mapping tutorial? for axe?
« Reply #3 on: November 18, 2011, 08:12:59 am »
Most tutorials have an example program with it. You build one while you are learning.
I'm not a nerd but I pretend:

#### Scipi

• Omni Kitten Meow~ =^ω^=
• LV10 31337 u53r (Next: 2000)
• Posts: 1547
• Rating: +192/-3
• Meow :3
##### Re: Tile mapping tutorial? for axe?
« Reply #4 on: November 18, 2011, 08:49:30 am »
If you have any questions pertaining to the actual logic, I can help you. I've made several programs utilizing Tile Mapping as well as a Tile Map Editor so I can definitely help.

Imma Cat! =^_^= (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:

Spoiler For OldSig:

Spoiler For Projects!:

Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

#### shmibs

• しらす丼
• LV11 Super Veteran (Next: 3000)
• Posts: 2132
• Rating: +281/-3
• try to be ok, ok?
##### Re: Tile mapping tutorial? for axe?
« Reply #5 on: November 18, 2011, 11:39:39 am »
^the same goes here for smoothly scrolling a tilemap, which can be tricky to make fast. good luck on whatever you're doing.

#### saintrunner

• Custom Spriter: You ask it! I'll Make it!
• LV10 31337 u53r (Next: 2000)
• Posts: 1787
• Rating: +115/-11
• Flogging Molly
##### Re: Tile mapping tutorial? for axe?
« Reply #6 on: November 18, 2011, 05:02:36 pm »
Yeah I kinda get all of the sprites and map stuff, but I don't get the actually main loop stuff! ? Could someone make a real quick tutorial for me? I'm really interested in working on an rpg. They sound fun to make!

GAMES:
Spoiler For Spoiler:

#### Scipi

• Omni Kitten Meow~ =^ω^=
• LV10 31337 u53r (Next: 2000)
• Posts: 1547
• Rating: +192/-3
• Meow :3
##### Re: Tile mapping tutorial? for axe?
« Reply #7 on: November 18, 2011, 05:15:30 pm »
Can you break it down to more specifics? With main loop are you having trouble drawing the tilemap each frame?

Imma Cat! =^_^= (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:

Spoiler For OldSig:

Spoiler For Projects!:

Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

#### saintrunner

• Custom Spriter: You ask it! I'll Make it!
• LV10 31337 u53r (Next: 2000)
• Posts: 1787
• Rating: +115/-11
• Flogging Molly
##### Re: Tile mapping tutorial? for axe?
« Reply #8 on: November 18, 2011, 09:51:40 pm »
Yeah I guess, I really just need a quick and easy tutorial explaining all of it

GAMES:
Spoiler For Spoiler:

#### Scipi

• Omni Kitten Meow~ =^ω^=
• LV10 31337 u53r (Next: 2000)
• Posts: 1547
• Rating: +192/-3
• Meow :3
##### Re: Tile mapping tutorial? for axe?
« Reply #9 on: November 18, 2011, 10:00:45 pm »
Well, the way I do it in TileCat is I have an array for the data. I use two for loops like so (You should be able to port this to Axe code):

Code: [Select]
for(int y = 0; y < MapHeight; y++)    for(int x = 0; x < MapWidth; x++)        {             tile = MapArray[x + (y * MapWidth)];             if tile == 0                 //Draw Something at x * 8,y * 8             if tile == 1                 //Draw something else at x * 8,y * 8         }
This will iterate over each tile in the array and read its value. Depending upon the value draw a sprite at X * 8 and y * 8

Note: There is a way you can modify this for scrolling by using two variables to keep track of where your view is and replacing MapWidth and MapHeight with those variables plus a value, say, 16 and 8 respectively. You will also want to make sure you don't go off the map though when doing that or going outside the array.

Imma Cat! =^_^= (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:

Spoiler For OldSig:

Spoiler For Projects!:

Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

#### C0deH4cker

• Posts: 258
• Rating: +11/-1
##### Re: Tile mapping tutorial? for axe?
« Reply #10 on: November 18, 2011, 11:12:44 pm »
dont use an if statement for it.

I use nibbles, which can be any value from 0-F (0-15). So, since each pic is 8 bytes in length:

Code: [Select]
[HEXCODE]->Pic1[MapDataInNibbles]->GDB1For(A,0,95)nib{A+GDB1*2}->BA^12->XA/8->YPt-off(X*8,Y*8,B*8+Pic1)End
I usually use something similar to this.

Therefore, just define your pics right after each other like this:
[HEX]->Pic1
[MoreHexForPic2]
[EvenMoreHexPic3]
etc.
« Last Edit: May 14, 2012, 07:03:13 pm by C0deH4cker »

#### Jonius7

• python! Lua!
• LV10 31337 u53r (Next: 2000)
• Posts: 1918
• Rating: +82/-18
• Still bringing new dimensions to the TI-nspire...
##### Re: Tile mapping tutorial? for axe?
« Reply #11 on: November 19, 2011, 05:35:38 am »
That's definitely more optimised, C0deH4cker good job. I'm not sure if i get what nibbles is for. Is that a variable name?
 Programmed some CASIO Basic in the pastDJ Omnimaga Music Discographist DJ Omnimaga DiscographyMy Own Music!
My Released Projects (Updated 2015/05/08)
 TI-nspire BASICTI-nspire Hold 'em Health Bar Scissors Paper Rock TI-nspire LuaNumstrat TI-nspire Hold 'em LuaTransport ChooserSecret Project (at v0.08.2 - 2015/05/08) Spoiler For Extra To-Be-Sorted Clutter: Spoiler For Relegated Projects: TI-nspire BASICBattle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)Axe ParserDoodle God (stalled while I go and learn some Axe)

#### saintrunner

• Custom Spriter: You ask it! I'll Make it!
• LV10 31337 u53r (Next: 2000)
• Posts: 1787
• Rating: +115/-11
• Flogging Molly
##### Re: Tile mapping tutorial? for axe?
« Reply #12 on: November 19, 2011, 02:34:20 pm »
can I have an example?

GAMES:
Spoiler For Spoiler:

#### epic7

• Chopin!
• LV11 Super Veteran (Next: 3000)
• Posts: 2200
• Rating: +135/-8
• I like robots
##### Re: Tile mapping tutorial? for axe?
« Reply #13 on: November 19, 2011, 02:45:00 pm »
Yeah, I'm not understanding this

#### shmibs

• しらす丼
• LV11 Super Veteran (Next: 3000)
• Posts: 2132
• Rating: +281/-3
• try to be ok, ok?
##### Re: Tile mapping tutorial? for axe?
« Reply #14 on: November 19, 2011, 02:54:35 pm »
jonius: a nibble is four bits, or half a BYTE
saintrunner: c0de fellow posted a decent example there. here it is explained, though:

Code: [Select]
[HEXCODE]->Pic1 //this is the place where you put the hex data for all of your sprites, one after another.[MapDataInNibbles]->GDB1 //this holds the map data in nibbles, which basically just means that every four bits holds a binary number from 0 to 15 (or 0 to F) to describe what tile to draw in what location. here they are listed in rows of twelve.For(A,0,95) //a for loop. 12*8 (the screens width and height in increments of 8) is 96, so it has to run from sprite 0 to sprite 95 in order to cover the whole screen.nib{GDB1*2+A}->B //this gets the sprite that is to be drawn next. it uses a "nibble pointer" rather than a "byte pointer" (i'm not sure what these are actually called...), so the "byte pointer" location of GDB1 has to be doubled. A is then added to determine which one to draw currently.A^12->X //a modulus 12, or the whole integer remainder that would remain after A is divided by 12 is stored to XA/8->Y //the integer value of A, were it divided by 8, is stored to YPt-off(X*8,Y*8,B*8+Pic1) //drawing sprites to the screen. because B holds a value from 0 to 15, multiplying this by 8 and adding Pic 1 slides the pointer to the spot where you stored your sprite data and then jumps forward to the number desired.End
« Last Edit: November 19, 2011, 02:55:46 pm by shmibs »