Author Topic: Smoothscrolling tilemapper  (Read 36199 times)

0 Members and 4 Guests are viewing this topic.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Smoothscrolling tilemapper
« Reply #45 on: November 07, 2010, 11:53:12 pm »
I've been debating making a super-optimization guide for Axe. Should I?

PLEASE.  I would love to code like this - I still treat Axe sort of like TI-Basic, and I never really learned how to optimize that either, beyond the normal tricks.
(I just printed out your code - I'm going to be poring over it before I go to bed! :))
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Smoothscrolling tilemapper
« Reply #46 on: November 08, 2010, 12:10:04 am »
Quote from: runer
The answer is carried from if statements, but that was an !If statement which activates when the expression following it equals zero, so zero carries to the next line.
wow, i don't think i've derped that badly in some time. thanks for your patience XD

Quote from: runer
Quote from: Builderboy on Today at 23:02:34
I wonder if this can be modified to scroll in arbitrary distances... (up to 8 pixels of course)

I'll try my best Tongue
that would be EXCEEDINGLY helpful!

Quote from: builderboy
I've deduced that scrolling more that 1 pixel per frame means that you would have to display more than 1 column of sprites per scroll, so it would be slower for sure, but i don't think the speed difference would be that large hopefully.
wait, so i got something right?

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Smoothscrolling tilemapper
« Reply #47 on: November 08, 2010, 12:18:12 am »
Yeah, it seems i was unaware of how many sprites my engine was displaying O.O I was convinced i was only doing 1 column but it seems i was accidentally doing 2 columns.  I was mistaken before by what you meant by 2 columns, i thought you meant 1 column each side of the screen (for some reason o.O) since i was convinced only 1 column was needed for a scroll up to 8 pixels

Now to find out how i managed to write a scrolling tilemapper with this incorrect knowledge...

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Smoothscrolling tilemapper
« Reply #48 on: November 08, 2010, 12:57:01 am »
/\i do that type of thing all the time(get a hunch as to how something could work, write it out as quickly as possible, and, if it doesn't work[which is usually], fiddle with it blindly until it does). after this process, i usually fall asleep(it tends to occur when i'm really tired), and then read over it in the morning, try to understand it, and re-write it from scratch.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Smoothscrolling tilemapper
« Reply #49 on: November 08, 2010, 01:28:00 am »
Great job on the optimizations!  By the way, you can use this for convenience:

Zeros(1024)->GDB1

And it will work the way you expect it to, no need to use the [] before it.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Smoothscrolling tilemapper
« Reply #50 on: November 08, 2010, 01:41:35 am »
The old engine only scrolled 1 pixel per frame, so it got 60 fps, but therefore it only scrolled 60 pixels per second. Behold, the new engine that can scroll an arbitrary number of pixels from 1-8 per frame! In the example screenshot (which probably looks like crap and doesn't accurately reflect the realistic performance) I'm scrolling 3 pixels per frame (controlled by the value of S set in the program) and get about 35-40 fps, giving scrolling rates of 100-120 pixels per second!

Also, with the old engine I didn't realize how interested people would be in this so I didn't bother to optimize it much. This time I went ahead and optimized it to the fullest of my abilities.

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: Smoothscrolling tilemapper
« Reply #51 on: November 08, 2010, 03:26:57 am »
This is great! You should definitively write a small guide showcasing some hardcore optimizations.

One thing, though: make sure to provide both the optimized and unoptimized/easier piece of code that do something and screenshots. Try to not do this Axe optimizing guide the Asm28day way, where it provides no real example of code and just stuff that does nothing. That way, your tutorial will be useable not only by people who understand fast through text, but also visual people.

Offline Ti-DkS

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 143
  • Rating: +21/-1
  • In retro, we trust !
    • View Profile
Re: Smoothscrolling tilemapper
« Reply #52 on: November 08, 2010, 05:52:12 am »
Hello there !
I have a question concerning the former ztrumpet's smooth scrolling tilemapper :
I tried to increase width by changing the right variable and adding bytes at the end of each line in GDB1 but it doesn't worked. Though to increase height I added some rows to GDB and it worked...
does anyone can help me please ?

ps: i'm not english nor american and I still learning that language then I apologize for my possible mistakes :)
« Last Edit: November 08, 2010, 12:19:05 pm by Ti-DkS »

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Smoothscrolling tilemapper
« Reply #53 on: November 08, 2010, 08:43:48 am »
@Runer: That really looks fantastic! Nice work!
@Ti-Dks: Hello, welcome to Omnimaga! I don't have much experience with Axe, but I'm sure someone here will be able to help you. Don't worry about the language too much. We have users from all over the place, many speaking French or Dutch as their first language. Have a look around, and we hope you enjoy your stay here. Feel free to introduce yourself in the introduction section here:http://www.omnimaga.org/index.php?board=10.0

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Smoothscrolling tilemapper
« Reply #54 on: November 08, 2010, 08:53:42 am »
hello!
do you mean the smoothscrolling engine in this topic?
if so then z is probably the best person to answer your question.

and don't worry about language stuff; everyone can understand you perfectly =D

also, you should introduce yourself here!

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: Smoothscrolling tilemapper
« Reply #55 on: November 08, 2010, 11:02:36 am »
Hello there !
I have a question concerning the former ztrumpet's smooth scrolling tilemapper :
I tried to increase width by changing the right variable and adding bytes at the end of each line in GDB1 but it doesn't worked. Though to increare height I added some rows to GDB and it worked...
does anyone can help me please ?

ps: i'm not english nor american and I still learning that language then I apologize for my possible mistakes :)
Hi, welcome to Omnimaga! :)
Adding bytes to the end works pretty easily, as you've noticed, but adding bytes on the side is much harder.  This is how to do it on my tilemapper:
Change W (I think this is what you did).
Change O to the number of total columns.  For example, the demo I made had 10 columns, so O=10.  If you want to add 3 columns, O would have to equal 13.
Finally, change the tilemap itself.  Let's say it looks like this:
Code: [Select]
00010203040506070809000102030405060708090001020304050607080900010203040506070809And let's also say that you want to add 3 new columns on the right.  Add those where I put 'XX's:
Code: [Select]
0001020304050607080900XXXXXX0001020304050607080900XXXXXX0001020304050607080900XXXXXX0001020304050607080900XXXXXX
I hope this made sense to you. :)  Good luck. ;D

Offline Ti-DkS

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 143
  • Rating: +21/-1
  • In retro, we trust !
    • View Profile
Re: Smoothscrolling tilemapper
« Reply #56 on: November 08, 2010, 12:12:29 pm »
Okay ! Thanks for your answers  :D I will try this as soon as I can !
( I hadn't seen var O  :-\)
« Last Edit: November 08, 2010, 12:18:01 pm by Ti-DkS »

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: Smoothscrolling tilemapper
« Reply #57 on: November 08, 2010, 02:08:12 pm »
Hey Ti-DkS, welcome here :)

Offline Ti-DkS

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 143
  • Rating: +21/-1
  • In retro, we trust !
    • View Profile
Re: Smoothscrolling tilemapper
« Reply #58 on: November 08, 2010, 02:47:03 pm »
thank you Dj ! I'm going on omnimaga for a while to find things about Axe, for example when I have problems in my code and I think its forum is very useful, mainly because there are many members with a very good knowledge of Axe, then I registered :)

ps for ztrumpet : your code worked perfectly of course :D

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: Smoothscrolling tilemapper
« Reply #59 on: November 08, 2010, 02:58:47 pm »
Ah glad to hear. I can't wait to see some of your programs :D