Author Topic: OmniRPG - Coding  (Read 67551 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: OmniRPG - Coding
« Reply #90 on: December 10, 2012, 09:59:08 am »
I modified mine, but it is not nearly as impressive as that o.o Without the tilemap built in, mine is the size of an OS picvar (767 bytes). On the plus side, to shift the map and player position you can do:

sub(SML)  (Shift Map Left)
sub(SMR)  (Shift Map Right)
sub(SMU)  (Shift Map Up)
sub(SMD)  (Shift Map Down)

I also need to optimise the left/right shifting. Since I am going by 8 pixels, I don't need some of the old code for boundary checking. Also, this updates the LCD every pixel it shifts (instead of every 2). The map size is stored in W and H, respectively, allowing for variable sized maps. Scrolling left/right gets 60FPS and scrolling up/down gets 70FPS and it is quite noticeable, the speed difference.
EDIT: I tried scrolling two pixels at a time, too.

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: OmniRPG - Coding
« Reply #91 on: December 10, 2012, 10:04:42 am »
I don't mind the speed difference, it looks great, you all are such godlike coders :o
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: OmniRPG - Coding
« Reply #92 on: December 10, 2012, 10:08:08 am »
I updated my post with another screenie scrolling at two pixels at a time. Now comes the next step-- animated tiles XD

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: OmniRPG - Coding
« Reply #93 on: December 10, 2012, 10:12:12 am »
looks very impressive (matref doesn't has 8px smooth scrolling, so maybe code's +- equal? )

None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: OmniRPG - Coding
« Reply #94 on: December 10, 2012, 10:21:00 am »
I only have to change the *2 in the two getkey lines to *n to scroll n pixel each frame. Also Xeda, your 2nd screenie is at 15MHz btw ?
« Last Edit: December 10, 2012, 10:21:23 am by Matrefeytontias »

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: OmniRPG - Coding
« Reply #95 on: December 10, 2012, 10:22:28 am »
No, the second is at 6MHz. 15MHz looks like this:

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: OmniRPG - Coding
« Reply #96 on: December 10, 2012, 10:22:40 am »
Matref: Yeah i know, but then it's not smooth scroll... xeda does it as following... he scrolls 4 times 2 px at a time.. and then waits for next keypress...

you do: keypress: 2px, wait for next keypress..., 2px..
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: OmniRPG - Coding
« Reply #97 on: December 10, 2012, 10:23:52 am »
@stevon8ter: That is smoothscrolling >.> I should post an example of "hard" scrolling at some point.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: OmniRPG - Coding
« Reply #98 on: December 10, 2012, 10:27:30 am »
Oh yeah I see. Well, I think I can do that in quite a few code, I'll post a screenshot.

Also Xeda, nice intro effect :D I think that I thought your 2nd screenie was at 15MHz because since you wait for a keypress (which is slow) every 4 frames instead of one, it's faster, right ?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: OmniRPG - Coding
« Reply #99 on: December 10, 2012, 10:29:46 am »
No, it is faster because it only updates the LCD every two pixels that are scrolled instead of each pixel (the LCD updating is a major bottleneck for speed).

Now, if I did 4 pixels at a time, I could completely rewrite the left/right scrolling codes to be very fast, but then it would look choppy >.>

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: OmniRPG - Coding
« Reply #100 on: December 10, 2012, 10:31:08 am »
My engine also updates the LCD each two pixels ... so I think that in fact mine is VEEEERY slow compared to yours :P

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: OmniRPG - Coding
« Reply #101 on: December 10, 2012, 10:36:40 am »
Yours has the benefit of being much smaller, though. My engine on its own is 646 bytes, almost 150 bytes bigger than yours o.o

EDIT: As an update, I just removed 24 more bytes of code from the left/right shifting. The only impact the code had was to remove 5056 t-states for each pixel shifted left/right (saving about .006741333... seconds at 6MHz, every time the map scrolls 8 pixels >.>)

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: OmniRPG - Coding
« Reply #102 on: December 10, 2012, 10:42:11 am »
Yeah, but do we want a fast or a light smoothscroller ? I don't think my engine will ever be as fast as yours, but maybe yours will be as light as mine :P

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: OmniRPG - Coding
« Reply #103 on: December 10, 2012, 12:35:04 pm »
I think speed is more important in this case. We don't know what else will be added that might slow things down.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: OmniRPG - Coding
« Reply #104 on: December 10, 2012, 12:49:05 pm »
I think of a way of using animated tiles that would fit amazingly on my engine but difficultly on yours :/

The thing is that with our tiles (let's say they are at Pic1TILE), we have a cumulated offset corresponding to the number times 8 you need to add to Pic1TILE to have the right frame of the right tile to be displayed. Let's do some pseudo-code :

Code: [Select]
[...->Pic1TILE
.Our animated tiles here

Data(0,2,5,8,10,11...)->GDB1OFST

.I skip the code to draw the entire map
DispTile(X,Y,{{Ytile + Xtile + GDB1MAP} + GDB1OFST} * 8 + Pic1TILE)

Let me know if you don't understand something :P