Author Topic: New Tilemapping Tutorial With Example  (Read 22011 times)

0 Members and 1 Guest are viewing this topic.

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: New Tilemapping Tutorial With Example
« Reply #30 on: November 13, 2013, 09:52:33 pm »
I have a question. If you want to change the GDB easily by changing one row instead all the rows how can you do that because then I can make like you can have a building being built.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: New Tilemapping Tutorial With Example
« Reply #31 on: November 14, 2013, 01:41:24 am »
"GDB" is nothing but a name. You could have put "°TheMap" or "Str12" instead of "GDB1". I just say that because some people confuse pointers with objects and feel like they're declaring some structure when doing →GDB1.

And changing an element is easy. If you want the first byte in the free RAM area starting at L1 to be 1, you do 1→{L1}, right ?
Well if you want your 58th byte in the RAM area that is your map starting at GDB1 to be 18, you do 18→{58+GDB1}.
And if you can change each element, you can change tows, etc.

Just note that, as I said, that works everywhere in RAM (even in places you shouldn't write to) but nowhere else, so if you compiled your code as an app, it will be run from Flash and you "can't" modify anything there, so you'll have to use workarounds like appvars, or to copy data in free RAM areas first. But if you didn't compile as an app, forget that last sentence.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: New Tilemapping Tutorial With Example
« Reply #32 on: November 14, 2013, 01:01:12 pm »
But if you make the program edit it's data, just make sure that you can also save it back, because if you don't, all the changes will remain if the player starts a new game.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: New Tilemapping Tutorial With Example
« Reply #33 on: November 15, 2013, 05:52:05 pm »
I have another question. Is every two character in the gdb as one byte or is it 2?

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: New Tilemapping Tutorial With Example
« Reply #34 on: November 15, 2013, 05:53:57 pm »
Two characters within square brackets are compiled to 1 byte (each hexadecimal character represents 4 bits), but in the source code, they are 2 bytes.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: New Tilemapping Tutorial With Example
« Reply #35 on: November 16, 2013, 02:03:20 am »
I have another question. Is every two character in the gdb as one byte or is it 2?
I see you didn't read what I wrote.
"In the GDB" doesn't mean anything, the GDB is a number, a pointer, not an object with numbers inside.
And every pointer points to one byte, but you can read 2 bytes at once, or 4 if you want, or interpret a sequel of 11 bytes as a string, etc, they don't have a size, it is just you deciding when putting them in your program what they represent.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: New Tilemapping Tutorial With Example
« Reply #36 on: November 18, 2013, 09:51:39 pm »
I have another question. I converted my map data to {C}, and then I do [21]→{127+C} and after that I write [22]→{128+C} but then when I run the program it shows me a picture of something completely different. 

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: New Tilemapping Tutorial With Example
« Reply #37 on: November 19, 2013, 01:50:13 am »
You still didn't read, or you didn't understand and did not ask.
First of all, "I converted my map data to {C}" really doesn't mean anything. Not just because we're in Axe, this time. I don't think that could mean something in another language.
Then, "[22]→{127+C}" tries to store a pointer to [22] (which is not the hex value 22 but a 2-byte number) in the one byte located in 127+C. Same with "[22]→{128+C}".
So I think you didn't "convert" anything (because there is no such thing as "conversion" in Axe), then you stored random numbers in two bytes, so I don't see why your picture would not be completely different.

Would you mind sharing the complete code ?
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: New Tilemapping Tutorial With Example
« Reply #38 on: November 19, 2013, 10:42:11 pm »
Do I have to type the code out or is there an easier way to do it?

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: New Tilemapping Tutorial With Example
« Reply #39 on: November 20, 2013, 12:37:36 am »
You can transfer your code to the computer (which would make a backup of your code, useful too) then open it with TokenIDE (doesn't need any installation (except the .NET Framework if you don't have it)) and copy-paste the content. Instead of using TokenIDE, you can also use TI-Editor, which is an online tool for that, but this is a bit weird to read the produced code because it is a Basic IDE, with Basic tokens, not Axe ones, while TokenIDE supports both languages.

Or if you are lazy, you can also just attach the code to your post, but you should know that other people are lazy too (me in particular), and find it harder to download than just read :P
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline TheCoder1998

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 434
  • Rating: +20/-2
  • my art is written in code, not in graphite
    • View Profile
    • My website :D
Re: New Tilemapping Tutorial With Example
« Reply #40 on: November 20, 2013, 03:14:50 am »
thanks! this really helped me ;D
my ticalc acc:

http://www.ticalc.org/archives/files/authors/113/11365.html

Spoiler For The Best Song Ever:


follow me on tumblr :)
www.rickdepizza.tumblr.com

check out my anilist :D
http://anilist.co/animelist/29701/Rickdepizza

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: New Tilemapping Tutorial With Example
« Reply #41 on: November 20, 2013, 10:36:08 pm »
Here is the code:
Code: [Select]
.STARCRAF

.CHARACTER
[0000000000000000]->Pic1
[FF818181818181FF]
.STORE YOUR SPRITE DATA FIRST, I'M ASSUMMING YOU WANT MONOCHROME SPRITES
prgmSTARCRAD
.MAP DATA, REMBER THOSE NUMBERS? ADD 0's RIGHT BEFORE THEM, AND STORE THEM TO A POINTER
[020202020202020202020202020202020202020202020202]->GDB1
[020202020202020202020202020202020202020202020202]
[020202020202020202020202020202020202020202020202]
[020202020101010101010101010101010101010102020202]
[020202020100000000000000000000000D0D0D0102020202]
[020202020100000000000000000000000D0D0D0102020202]
[020202020100000000000000000000000D0D0D0102020202]
[020202020100000002030400000000000000000102020202]
[020202020100000005060700000000000000000102020202]
[020202020100000008090A00000000000000000101010202]
[0202020201000000000B0000000000000000000000000202]
[0202020201000000000B0000000000000000000101010202]
[0202020201000000000B0000000000000000000102020202]
[020202020100000000000000000000000000000102020202]
[020202020100000000000000000000000000000102020202]
[020202020100000000000000000000000000000102020202]
[020202020100000000000000000000000000000102020202]
[0202020201000000000000000000001B18191A0102020202]
[020202020101010114151614151614151C1D1E1F02020202]
[020202020202020202020202020202020202020202020202]
[02020202020202020202020202020202020202020202020202]

.ENGINE

.P AND Q ARE THE LOCATION OR THE TOP CORNER OF THE MAP DATA
0->P->Q->V->H->I->J->theta->{r1}->G->K->L->M->W

GDB1->C

rand^20+1->D

Repeat getKey(15)

Z->Y

Output(1,1,P>Dec,[i]
Output(1,5,Q>Dec,[i]

Q*24+P+126->Z

.P+(getKey(3) and (({Z+1+GDB1}=0) or ({Z+1+GDB1}=11) or ({Z+1+GDB1}=13)))-(getKey(2) and (({Z-1+GDB1}=0) or ({Z-1+GDB1}=11) or ({Z-1+GDB1}=13)))->P

.Q*24+P+101->Z
.Q+(getKey(1) and (({Z+24+GDB1}=0) or ({Z+24+{L1}}=11) or ({Z+24+{L1}=13)))-(getKey(4) and (({Z-24+{L1}}=0) or ({Z-24+{L1}}=11) or ({Z-24+{L1})))->Q

If getKey(3) and (I=0) and (J=0) and (({Z+1+C}=0) or ({Z+1+C}=11) or ({Z+1+C}=13) or ({Z+1+C}=9))
1->I
32->{r1}
End
If getKey(2) and (I=0) and (J=0) and (({Z-1+C}=0) or ({Z-1+C}=11) or ({Z-1+C}=13) or ({Z-1+C}=9))
-1->I
64->{r1}
End
If getKey(1) and (I=0) and (J=0) and (({Z+24+C}=0) or ({Z+24+C}=11) or ({Z+24+C}=13) or ({Z+24+C}=9))
1->J
0->{r1}
End
If getKey(4) and (I=0) and (J=0) and (({Z-24+C}=0) or ({Z-24+C}=11) or ({Z-24+C}=13) or ({Z-24+C}=9))
0-1->J
96->{r1}
End
If getKey(1) or (getKey(2)) or (getKey(3)) or (getKey(4)
theta+1->theta
If ({Z+24+C}=13) and ((L!=P) or (M!=Q))
D-1->D
P->L
Q->M
End
If ({Z-24+C}=13) and ((L!=P) or (M!=Q))
D-1->D
P->L
Q->M
End
Else
0->theta
End

H+I+I->H
V+J+J->V

If H-8=0 or (H+8=0
P+I->P
0->H->I
End
If V-8=0 or (V+8=0
Q+J->Q
0->V->J
End

If getKey(54) and (G=0) and (K=0)
1->G
End

If (getKey(54)=0) and (G=1) and (K=0)
1->K
End

If getKey(54) and (K=1)
0->K
0->G
End
If K=0
Pause 80
End

.If Y!=Z
sub(MAP)
.End

Pt-Off(40,32,Pic1+8
.Pt-Off(40,24,Pic1+{r1}

DispGraph


If getKey(55)
[20]->{127+C}
[21]->{128+C}
End
End

Lbl MAP

Q*24+P->Z

ClrDraw
For(B,0,9
For(A,0,13
Pt-On(A*8-8-H,B*8-8-V,{B*24+A+Z+C}*8+Pic0
End
End


.This is prgmSTARCRAD
..DATA
.GROUND TILE,1
[0000000000000000->Pic0
.EMPTY SPACE,2
[FFFFFFFFFFFFFFFF
.RIGHT BAR,3
[0101010101010101
.LEFT BAR,4
[8080808080808080
.CRYSTAL,5
[E395994A4C24261E
.LEFT VESPENE GAS,6
[001C223E2241C03F
.RIGHT VESPENE GAS,7
[0038447C820183FC
.TOP LEFT SIDE,8,9,A,B
[FF808080EAFF8098
[FF000000AAFF0030
[FF000000AAFF00F8
[FF000000AAFF00F8
.BOTTOM LEFT SIDE,C,D,E,F
[A79F807F00000000
[C9F000FF00000000
[55F800FF00000000
[54F800FF00000000
.TOP MIDDLE SIDE,10,11,12,13
[FF00000055FF007C
[FF00000055FF007C
[FF00000055FF007C
[FF00000055FF007C
.BOTTOM MIDDLE SIDE,14,15,16,17
[AA7C00FF00000000
[AA7C00FF00000000
[AA7C00FF00000000
[AA7C00FF00000000
.TOP RIGHT SIDE,18,19,1A,1B
[FF000055FF00001F
[FF000055FF00001F
[FF000055FF00000C
[FF010157FF010119
.BOTTOM RIGHT SIDE,1C,1D,1E,1F
[2A1F00FF00000000
[AA1F00FF00000000
[930F00FF00000000
[E5F901FE00000000
.BARRACK,20,21,22,23,24,25,26,27,28,29,2A,2B,2C,2D,2E,2F,30,31,32,33
[0C0C0C0C0C0C0C0D
[0000000000001FE0
[000000000000F807
[30303030303030B0
[0E10204C8D8D8D8C
[000738C03C4381C2
[00E09C4781C23C03
[70080432B1B1B131
[CCECFCFEFFFFFFDF
[3907000000E0FFFF
[1CE000000007FFFF
[33373F7FFFFFFFFD
[D7D5D5D5D5D55535
[FFDF404C52524C40
[FFFD8199A5A59981
[F5D5555555555556
[0F00000000000000
[E01F000000000000
[83FC000000000000
[F800000000000000
.UFO LAB,34,35,36,37,38,39,3A,3B,3C,3D,3E,3F
[0000000F708080F0
[03047890100C0300
[C0201E090830C000
[000000F00E01010F
[FFFFE7C3C3E7FF7C
[80FFFFE7C3C3E77F
[01FFFFF3E1E1F37F
[FFFFE7C3C3E7FF1F
[090A0A0A0A0A0A00
[FF01010101010100
[4040404040404000
[C828282828282800
« Last Edit: November 23, 2013, 08:13:23 pm by Omegaxis213 »

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: New Tilemapping Tutorial With Example
« Reply #42 on: November 21, 2013, 07:45:48 am »
Please use the [code ][/ code] tags (without the spaces) to put your code in.
« Last Edit: November 21, 2013, 07:46:08 am by Matrefeytontias »

Offline Omegaxis213

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +5/-0
    • View Profile
Re: New Tilemapping Tutorial With Example
« Reply #43 on: November 23, 2013, 11:17:02 pm »
I figured out my problem I did [21]→{C} instead of 21→{C}