Author Topic: Some limitations of platformers using pxl-test  (Read 23915 times)

0 Members and 2 Guests are viewing this topic.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #15 on: March 15, 2012, 02:34:23 pm »
Free RAM areas? Well there are 2 display buffers. Normal and popup. Sadly, I don't exactly know how to properly draw graphics on the popup.

If I used variables to store the location and type of pixels, how exactly would I do it?

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: Some limitations of platformers using pxl-test
« Reply #16 on: March 15, 2012, 02:55:57 pm »
I know you have been posting in the Grammer threads, too, so I will explain how to do it in Grammer (and probably Axe/Asm) and see if you can do it on the NXT:

First, can you draw or pixel test on other buffers? If so, for what I have been doing today. For each enemy, I have two sprites. One to be displayed and the other contains the hit as pixels on. For example, I draw this sprite to the viewing buffer:


Then on the other buffer, I draw this hitbox at the same location:


There is no need to make it like this, either. You can have a huge hitbox for enemies with some kind of aura or things like that. Anyways, then all I need to do is whenever I move, I just pixel test the location I am moving to. If there is a pixel on, it means it is in the hitbox. so you just don't move there.

The nice thing is, you can have several buffers for other things. For example, one buffer for collision, one buffer for killzones, et cetera.

Again, this all relies on the ability to pixel-test other buffers. I don't know if this helped clarify things or not :/

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #17 on: March 15, 2012, 02:59:44 pm »
Wait... You can create buffers??

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: Some limitations of platformers using pxl-test
« Reply #18 on: March 15, 2012, 03:00:32 pm »
I am not sure about the NXT, but in Grammer, yes (and in Axe/Asm)

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #19 on: March 15, 2012, 03:06:40 pm »
When you say buffer, do you actually mean that it really is a real buffer?

EDIT: The way I do it is I just turn off screen refreshing, draw the solid pixels, test the pixels, then draw the 
kill pixels, test the pixels, then draw what you actually see. Then I turn on screen refreshing, so you only see the last picture. But the problem is, is that the more different types of pixels, the slower it will go and the worse the grayscale will be.
« Last Edit: March 15, 2012, 03:09:25 pm by nxtboy III »

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: Some limitations of platformers using pxl-test
« Reply #20 on: March 15, 2012, 03:10:11 pm »
When I say buffer, I mean, in this case, that if you were to display it, you would see all the hitboxes.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #21 on: March 15, 2012, 03:13:43 pm »
So it is as if each buffer is a layer of the screen?

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: Some limitations of platformers using pxl-test
« Reply #22 on: March 15, 2012, 03:15:49 pm »
Exactly :) I was going to call it a layer, but I decided not to to avoid some confusion. But yes, that is how I think of it :) I think of them as layers of the screen and you are just pixel testing what is underneath.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #23 on: March 15, 2012, 03:17:40 pm »
I wish I could create buffers on my NXT... :(
But that is basically what a map is for a tile-based game. A layer.

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: Some limitations of platformers using pxl-test
« Reply #24 on: March 15, 2012, 03:19:26 pm »
Eh, I think of tilemaps as just being able to get detailed pixels and showing the detail by blowing it up in scale. When you are still checking a tilemap, you are just "pixel testing" it, but getting more than a 1 or 0 result.

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #25 on: March 15, 2012, 03:23:45 pm »
I have another question/problem:

In my pixel-perfect game, there are enemies. When you move up, everything else moves down, since it scrolls. Which also means the enemies move down. But a lot of times I have a problem that the enemies aren't in the exact position they are supposed to be. They might be one pixel off. I think it is because the velocity of player increases as you go down. Same with the enemies. Somehow it is messing up the enemy's Y position. How can I fix this??

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: Some limitations of platformers using pxl-test
« Reply #26 on: March 15, 2012, 03:25:12 pm »
Are you applying the same acceleration to the enemies? Also, do you have FP support, or just integers?

Offline nxtboy III

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 795
  • Rating: +26/-1
  • NXT!
    • View Profile
    • Program NXT
Re: Some limitations of platformers using pxl-test
« Reply #27 on: March 15, 2012, 03:26:50 pm »
Yes, I am applying acceleration to the enemies, but only on the Y axis. Same with the character. And yes, floating point is supported.

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: Some limitations of platformers using pxl-test
« Reply #28 on: March 15, 2012, 03:30:13 pm »
Ah, okay, try starting both you and the enemies at a half pixel location. That is the way I solved it before :)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Some limitations of platformers using pxl-test
« Reply #29 on: March 15, 2012, 03:33:08 pm »
Your problem might be this, your code might be doing things in the wrong order, such as:

Move Player
Update Screen
Move enemies

As you can see, in this example the enemies only get moved *after* the screen is updated, so they will always be 1 frame behind in their animation.  Might this be what is happening to you?