Author Topic: Unique Pure BASIC Scrolling Tilemapper  (Read 7026 times)

0 Members and 2 Guests are viewing this topic.

Offline FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Unique Pure BASIC Scrolling Tilemapper
« on: January 03, 2011, 05:08:51 pm »
This tilemapper that I made is unique in that it uses pictures for the source.
Generally Pure BASIC scrolling tilemappers use strings, which while a little faster, they can be much larger.
So I tried to make one of these kind of mappers before, but I didn't handle it quite right, and it was incredibly slow. This one is much faster than the old one that I've since lost.
I've only run this on an SE, so I don't know how fast it is in 6 mHz.
Attached is the engine and the map I used in the screenie.
« Last Edit: January 03, 2011, 05:09:40 pm by FinaleTI »


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #1 on: January 03, 2011, 06:42:48 pm »
Looks cool. I'll check it out sometime soon hopefully. What do you mean though by it uses pictures as source?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #2 on: January 03, 2011, 06:54:26 pm »
I mean it determines your map from the pixels in a picture.
So if a pixel is on, it draws a wall tile, but if the pixel is off, it draws a floor tile.
The tiles are stored in Str2, in the order of floor tile, wall tile.
So you if you want 'L' to be your floor and 'F' to be your wall your Str2 would be "LF".


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #3 on: January 03, 2011, 07:15:13 pm »
Reminds me of Illusiat 12 :)
/e

Offline FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #4 on: January 03, 2011, 07:22:18 pm »
Yep. The Illusiat games are what made me wanna make this, although the mapping style is closer to that of Illusiat 11.
I did use a map from Illusiat 12 to test with. That's the map I used in the screenie.


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #5 on: January 03, 2011, 07:23:08 pm »
Fascinating!

This is just about the coolest tilemapper I've ever scene.  I really like it.  Map props, man. ;D

Here's the very interesting code, if anyone else was baffled by the incredible speed:
Spoiler For Code:
:ClrDraw
:ClrHome
:RecallPic 2
:Disp
:44→A:14→B
:34→K
:"LN"→Str2
:"
:For(θ,0,7
:For(Z,0,15
:Ans+sub(Str2,pxl-Test(θ+A,Z+B)+1,1
:End
:Output(1,1,sub(Ans,2,length(Ans)-1
:End
:sub(Ans,2,128→Str1
:Repeat K=45
:Output(1,1,Str1
:Output(4,8,sub("ÌÏÌ      ÎÎ",K-23,1
:Repeat max(K={24,25,26,34,33,45
:getKey→K
:End
:If K=33
:Then
:Text(0,0,"
:Repeat getKey=45
:Pxl-Change(A+3,B+7
:End
:Pxl-Off(A+3,B+7
:End
:If K=26 and B<79 and not(pxl-Test(A+3,B+8
:Then
:B+1→B
:"
:For(θ,0,7)
:Ans+sub(Str2,pxl-Test(A+θ,B+15)+1,1
:End
:sub(Ans,2,8
:sub(Str1,2,15)+sub(Ans,1,1)+sub(Str1,18,15)+sub(Ans,2,1)+sub(Str1,34,15)+sub(Ans,3,1)+sub(Str1,50,15)+sub(Ans,4,1)+sub(Str1,66,15)+sub(Ans,5,1)+sub(Str1,82,15)+sub(Ans,6,1)+sub(Str1,98,15)+sub(Ans,7,1)+sub(Str1,114,15)+sub(Ans,8,1→Str1
:End
:If K=24 and B and not(pxl-Test(A+3,B+6
:Then
:B-1→B
:"
:For(θ,0,7)
:Ans+sub(Str2,pxl-Test(A+θ,B)+1,1
:End
:sub(Ans,2,8
:sub(Ans,1,1)+sub(Str1,1,15)+sub(Ans,2,1)+sub(Str1,17,15)+sub(Ans,3,1)+sub(Str1,33,15)+sub(Ans,4,1)+sub(Str1,49,15)+sub(Ans,5,1)+sub(Str1,65,15)+sub(Ans,6,1)+sub(Str1,81,15)+sub(Ans,7,1)+sub(Str1,97,15)+sub(Ans,8,1)+sub(Str1,113,15→Str1
:End
:If K=34 and A<55 and not(pxl-Test(A+4,B+7
:Then
:A+1→A
:"
:For(Z,0,15)
:Ans+sub(Str2,pxl-Test(A+7,B+Z)+1,1
:End
:sub(Str1,17,112)+sub(Ans,2,16→Str1
:End
:If K=25 and A and not(pxl-Test(A+2,B+7
:Then
:A-1→A
:"
:For(Z,0,15)
:Ans+sub(Str2,pxl-Test(A,B+Z)+1,1
:End
:sub(Ans,2,16)+sub(Str1,1,112→Str1
:End
:End
Generated by SourceCoder (http://sc.cemetech.net)
© 2005-2010 Cemetech (http://www.cemetech.net)
Excellent job! :D

Edit: Do you mind if I take a stab at making one of my own? O0
« Last Edit: January 03, 2011, 07:25:29 pm by ztrumpet »

Offline FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #6 on: January 03, 2011, 07:31:41 pm »
Thanks. I'm really surprised with the speed I got, especially since the old one was so slow.
And feel free to make one! I'd love to see what you come up with.
I'm sure I can optimize mine in a few places, and I'm wondering about a few things that could slightly increase the speed.


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #7 on: January 03, 2011, 10:02:57 pm »
Looks cool! But how do you read from the pictures in pure basic?

Offline FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #8 on: January 04, 2011, 06:32:53 am »
pxl-Test(). It's one of the fastest methods of collision detection in BASIC.


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

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
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #9 on: January 04, 2011, 03:34:57 pm »
The code is huge so it confuses me, but do you actually pixel test, store an additional string char to the map, pixel test again, store another char, and that until you got 128 characters, then display the string? reading data from strings is slow but from pixel-test it's faster, so is it why it's much faster?

Offline tifreak

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2708
  • Rating: +82/-3
  • My Kung Fu IS strong...
    • View Profile
    • TI-Freakware
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #10 on: January 04, 2011, 03:37:53 pm »
Actually, if you look on ticalc.org, there was a Zelda game made on that principal. That was a goodly 8 years ago.

Nice job getting it figured out though. :)
Projects: AOD Series: 75% | FFME: 80% | Pokemon: 18% | RPGSK: 60% | Star Trek: 70% | Star Trek 83+: 40% | TI-City: 5%

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
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #11 on: January 04, 2011, 03:39:09 pm »
Really? I never really saw that one.  Back then all BASIC games were in one section, though, so it was ridiculously hard to find anything there.
« Last Edit: January 04, 2011, 03:39:39 pm by DJ Omnimaga »

Offline FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #12 on: January 04, 2011, 08:46:57 pm »
The code is huge so it confuses me, but do you actually pixel test, store an additional string char to the map, pixel test again, store another char, and that until you got 128 characters, then display the string? reading data from strings is slow but from pixel-test it's faster, so is it why it's much faster?
The way I do it is I render the initial field upon start up of the program (I create the 128 char string through pxlTest()'s).
Then, say I move left.
Your X coordinate (B) is incremented.
The program pxlTest()'s the next column based on my coordinates (A+loop,B+15) in a loop, adding the generated tile to a string in Ans.
I end up with a 9 char string, so I chop off the starting space.
Then I add 15 chars from each line to each char in Ans, like the first line would be:
Code: [Select]
sub(Str1,2,15)+sub(Ans,1,1)+sub(Str1,18,15).....
This is all in the big concatenation thing at the end of each keypress If-Then.
Then it goes back to the beginning of the loop, displays Str1 and your character and waits for another keypress.

My old version of this engine didn't utilize Ans where I should have and instead I had it rebuild the string during the pxlTest() loop or something, so it was painfully slow.
I've also slightly modified the engine since I posted it and I think it's *barely* faster. :)

Actually, if you look on ticalc.org, there was a Zelda game made on that principal. That was a goodly 8 years ago.

Nice job getting it figured out though. :)
I saw that Zelda game, but unless I'm mistaken, the 83 version uses some sort of ASM code to help with the map drawing.


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #13 on: January 04, 2011, 09:44:11 pm »
I created my own version of this...
My old version of this engine didn't utilize Ans where I should have and instead I had it rebuild the string during the pxlTest() loop or something, so it was painfully slow.
...and it rebuilds the string in the loop instead of after. :)  I'll have to post mine sometime. ;D  (I may be building a game around it - Stay Tuned!!)

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
Re: Unique Pure BASIC Scrolling Tilemapper
« Reply #14 on: January 05, 2011, 02:46:01 am »
Hmm I see. I am surprised so many sub() concatenations is so fast, though O.o

@Ztrumpet that would be cool!