Author Topic: Some limitations of platformers using pxl-test  (Read 26568 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
Some limitations of platformers using pxl-test
« on: March 15, 2012, 12:55:41 pm »
Hi,
I was wondering if everyone could list off some limitations of platformers that use pxl-test for collision (I mean pixel-perfect collision, no tiles). That is what I am doing, and I want to know what is bad about it.

Here's some:
-Enemies cannot move off the screen or they will have no collision
-Takes up more storage than using tiles

Could everybody tell me more? And if possible, a solution to it?
« Last Edit: March 15, 2012, 02:03:26 pm by nxtboy III »

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 #1 on: March 15, 2012, 01:36:05 pm »
Another disadvantage is the storing of your level data.  Since you are not using tiles, your levels become a lot larger to store and display.  Plus, you also have to keep in mind the size of your enemies and player when designing them. 

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Some limitations of platformers using pxl-test
« Reply #2 on: March 15, 2012, 01:50:25 pm »
it's typically slower than tile-based collision as well.

a possible solution would be to keep your map storage and drawing tile-based and then implement a pixel-testing system that looks for "pixels" within the tile data rather than on the actual buffer.

what i mean is that the character/enemy or whatever would first determine what tile is underneath it and then, rather than pixel testing on the screen buffer, would check pixels in the sprite that is used for that tile instead.

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 #3 on: March 15, 2012, 02:02:55 pm »
Well actually the pxl-test-like function I use for my NXT robot goes about 2,100 times a second. That's how fast it is.
So any other limitations and/or solutions?
Also, what is an efficient way to have multiple types of pixels, like destroyable pixels, killing pixels, etc?
« Last Edit: March 15, 2012, 02:03:02 pm by nxtboy III »

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 #4 on: March 15, 2012, 02:05:43 pm »
The only real way to have different types of pixels is to have a different image for each property.  The destructible image (often reffered to as a mask) would not be displayed, but instead used to test whether or not a pixel is destructible or not.  As you can imagine this can increase your file size by large amounts, which is why people generally use tilemaps.

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 #5 on: March 15, 2012, 02:07:03 pm »
Is that the only way?

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 #6 on: March 15, 2012, 02:08:49 pm »
Can you store color onto your images?

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 #7 on: March 15, 2012, 02:13:32 pm »
sadly, no.

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 #8 on: March 15, 2012, 02:16:03 pm »
Then you are quite limited on how you define what type your pixels are.  You can either use the multiple image method, which gives you a good speed, or you could store the position and type of all the 'special' pixels, which is likely going to be space efficient, but also quite slow.

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 #9 on: March 15, 2012, 02:18:29 pm »
???
How will using multiple images have good speed? I would have to draw every image, and each image takes about 3 milliseconds to draw. 3 milliseconds is a lot if you're making it grayscale.

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 #10 on: March 15, 2012, 02:19:21 pm »
no, you would draw the images at all, they would just be used for determining the type of a pixel.

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 #11 on: March 15, 2012, 02:21:08 pm »
But, how can you use pxl-test if they are not drawn??

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 #12 on: March 15, 2012, 02:22:27 pm »
Oh can you only do pixel testing on the screen, not on images?  In that case the second method I suggested would be one of the only ways

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 #13 on: March 15, 2012, 02:24:57 pm »
Well, I am doing this on my NXT, and it is possible to turn on and off the screen refreshing. What I am doing now is turning off the screen refreshing, showing the solid and other type of pixel (kill pixels), then showing what you actually see, then turning the screen refreshing back on, so you only see the last picture. Is there a faster way to do this?

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Some limitations of platformers using pxl-test
« Reply #14 on: March 15, 2012, 02:30:01 pm »
do you have other free-ram areas you can store to, though? you could store your images there. it may mean writing your own pixle test routines, but should still be faster.