Explain pixel perfectness.
#1
Posted 24 July 2007 - 06:11 AM
What are the best ways to go about it?
#2
Posted 24 July 2007 - 06:17 AM
They control the char set data.
Use the vlayer as a place to store your sprites, with the vcoX,Y counter.
See spriter.txt as an example.
: "justentered" copy block at "('thisx'+1)" "thisy" for 2 by 1 to "$s" 44 set "charset" to "$s" load char set "&charset&.chr" load palette "&charset&.pal" loop start set "byte" to "('loopcount'%14)" set "char" to "('loopcount'/14)" set "vco('loopcount'/14),('loopcount'%14)" to "('char'>31*'char_byte')" loop for "(256*14-1)" copy block at 9 4 for 82 by 27 to 94 4 : "l" set "spr" to 0 wait for 1 load char set "&charset&.chr" copy block at 9 4 for 82 by 27 to 94 4 set "nchar" to 128 if "spr" < 1 then "l" set "a" to 0 : "l2" goto "#sp" inc "a" by 1 if "a" < "spr" then "l2" goto "l" : "#sp" set "board_x" to "('s&a&_x'/8+85)" set "x2" to "('s&a&_x'+32%8)" set "board_y" to "('s&a&_y'/14)" set "y2" to "('s&a&_y'+28%14)" if "board_x" < 94 then "#return" if "board_x" > 174 then "#return" if "board_y" < 4 then "#return" if "board_y" > 29 then "#return" goto "#0" inc "board_x" by 1 if "x2" != 0 then "#1" dec "board_x" by 1 inc "board_y" by 1 if "y2" != 0 then "#2" inc "board_x" by 1 if "y2" != 0 then "#3" goto "#return" : "#0" if "board_char" > 127 then "m0" set "char" to "nchar" inc "nchar" by 1 set "byte" to "y2" loop start set "char_byte" to "('vco('s&a&_c'),&loopcount&'>>'x2'o'vco&board_char&,('y2'+'loopcount')')" inc "byte" by 1 loop for "(13-'y2')" put "('board_color'/16*16+'s&a&_co')" CustomBlock "char" at "board_x" "board_y" goto "#return" : "m0" set "char" to "board_char" set "byte" to "y2" loop start set "char_byte" to "('vco('s&a&_c'),&loopcount&'>>'x2'x'char_byte')" inc "byte" by 1 loop for "(13-'y2')" goto "#return" : "#1" if "board_char" > 127 then "m1" set "char" to "nchar" inc "nchar" by 1 set "byte" to "y2" loop start set "char_byte" to "('vco('s&a&_c'),&loopcount&'<<(8-'x2')o'vco&board_char&,('y2'+'loopcount')')" inc "byte" by 1 loop for "(13-'y2')" put "('board_color'/16*16+'s&a&_co')" CustomBlock "char" at "board_x" "board_y" goto "#return" : "m1" set "char" to "board_char" set "byte" to "y2" loop start set "char_byte" to "('vco('s&a&_c'),&loopcount&'<<(8-'x2')x'char_byte')" inc "byte" by 1 loop for "(13-'y2')" goto "#return" : "#2" if "board_char" > 127 then "m2" set "char" to "nchar" inc "nchar" by 1 set "byte" to 0 loop start set "char_byte" to "('vco('s&a&_c'),('loopcount'+14-'y2')'>>'x2'o'vco&board_char&,&loopcount&')" inc "byte" by 1 loop for "('y2'-1)" put "('board_color'/16*16+'s&a&_co')" CustomBlock "char" at "board_x" "board_y" goto "#return" : "m2" set "char" to "board_char" set "byte" to 0 loop start set "char_byte" to "('vco('s&a&_c'),('loopcount'+14-'y2')'>>'x2'x'char_byte')" inc "byte" by 1 loop for "('y2'-1)" goto "#return" : "#3" if "x2" = 0 then "#return" if "board_char" > 127 then "m3" set "char" to "nchar" inc "nchar" by 1 set "byte" to 0 loop start set "char_byte" to "('vco('s&a&_c'),('loopcount'+14-'y2')'<<(8-'x2')o'vco&board_char&,&loopcount&')" inc "byte" by 1 loop for "('y2'-1)" put "('board_color'/16*16+'s&a&_co')" CustomBlock "char" at "board_x" "board_y" goto "#return" : "m3" set "char" to "board_char" set "byte" to 0 loop start set "char_byte" to "('vco('s&a&_c'),('loopcount'+14-'y2')'<<(8-'x2')x'char_byte')" inc "byte" by 1 loop for "('y2'-1)" goto "#return"
However, it is unoptimal and has some flaws. I suggest you only use it as a reference.
#3
Posted 24 July 2007 - 06:21 AM
#4
Posted 24 July 2007 - 07:23 AM
#5
Posted 24 July 2007 - 11:31 AM
Most people just use a distance thing. or checking on a character basis for blocks that would stop a pixel from progressing through the next character... and SOME might want to use a pixel detection algorithm it see if an individual pixel would bloke movement (of course the fastest is checking by static blocks and distances between other bypixel moving things.
Basicly, look up material on entry level 2d game programming and concentrate on collision detection. There are various methods.
#6
Posted 24 July 2007 - 03:06 PM
Koji, on Jul 24 2007, 06:31 AM, said:
Yeah for like the three or so people who have really done it.
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#7
Posted 24 July 2007 - 04:18 PM
Exophase, on Jul 24 2007, 08:06 AM, said:
Koji, on Jul 24 2007, 06:31 AM, said:
Yeah for like the three or so people who have really done it.
Thankfully for gameplay reasons I never actually needed to figure out collision detection!
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
#8
Posted 24 July 2007 - 09:09 PM
There are many ways to go about pixel perfectness. other ideas I had included using about 4 or 8 mzx chars that would kind of wrap around so that although the character existed on the mzx board it would still appear pixel perfect. Using char edit a whole row of pixels can be moved either north or south on the screen with ease, but left and right is another issue.
Micah if you have question about this feel free to ask me on irc where I can explain in more detail.
#9
Posted 24 July 2007 - 11:49 PM
#10
Posted 25 July 2007 - 01:48 AM
christ go use some builtins
#11
Posted 25 July 2007 - 05:49 AM

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#12
Posted 25 July 2007 - 06:03 AM

But those games by Logicow sure do look sweet...

koji: SCRUMTRELLESCENT!
#13
Posted 25 July 2007 - 07:03 AM
Lancer-X, on Jul 24 2007, 10:49 PM, said:
Actually, what always appealed to me (and still does) about megazeux was the concept of trying to accomplish a lot with something so limiting.
All things considered with regards to SFmzx development, converting the combat engine to pixel perfect was a HUGE gain for gameplay with such a small amount of time to implement.

<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
#14
Posted 25 July 2007 - 11:08 AM
ANYWAY best way to learn is to find a pixel perfect game and look at how it was implimented, most of the time they really are pretty simple.
#15
Posted 25 July 2007 - 12:24 PM
To have acceptable gameplay, platformers have to either use pixel perfectness, huge sprites or slow and accurate movement coupled with good level design.
Most 1x1 mzx platformers are much too fast, and that makes jumps on 1x1 platforms really hard. Plus, they tend to have this strange triangular jump that makes jumping look stupid. And, in my opinion, they don't make you jump high enough.
Its code is very straight-forward, and has little to no exception cases, compared to other things such as multi-robot bosses and textured polygons. Those were horrible.
Another problem is the collision detection, which you will be left to do on your own.
I did suggest implementing part of it into megazeux to make it easier.
#16
Posted 25 July 2007 - 01:12 PM
But I like the idea and I'd love to see a pixel-perfect game - doesn't matter if MZX "isn't made for it" - just let Logi do what he wants to, cuz I love his graphic 3D things.

*pastes code in MZX*
EDIT: eh, it doesn't work. Nevermind.
This post has been edited by HappyFoppy: 25 July 2007 - 01:15 PM
#17
Posted 25 July 2007 - 05:40 PM
Logicow said:
If you can create a per-pixel engine then collision detection should be simple enough. Not like bounding box/circle is difficult or anything.

#18
Posted 25 July 2007 - 06:08 PM
LogiCow, on Jul 25 2007, 08:24 AM, said:
To have acceptable gameplay, platformers have to either use pixel perfectness, huge sprites or slow and accurate movement coupled with good level design.
Most 1x1 mzx platformers are much too fast, and that makes jumps on 1x1 platforms really hard. Plus, they tend to have this strange triangular jump that makes jumping look stupid. And, in my opinion, they don't make you jump high enough.
http://www.digitalmz...showtopic=10960
http://www.digitalmz...showtopic=10636
http://www.digitalmz...?showtopic=9191
There should be a thread about a pixel perfect platformer with comments twice as applauding as these, since pixel perfectness "helps your gameplay _so much_"
#19
Posted 25 July 2007 - 06:57 PM
LogiCow, on Jul 25 2007, 08:24 AM, said:
If people don't want these things happening, that doesn't mean they have to go pixel-perfect or use massive sprites. All they have to do is make a better engine. I know from experience that all of these problems are easily avoided, because I'm making a game that does right now.
#20
Posted 25 July 2007 - 08:04 PM
LogiCow, on Jul 25 2007, 10:24 PM, said:
Funnily enough, a lot of the jumping sequences in Galatea were quite a bit harder than similar sequences in many 1x1 platformers (Sponkgo's Legendary Journey, CJA and Guy's billion and a half platformers that are all exactly the same, your own Spaceship Crusade etc. etc. along with many other games).

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#21
Posted 25 July 2007 - 08:36 PM
Lancer-X, on Jul 25 2007, 03:04 PM, said:
LogiCow, on Jul 25 2007, 10:24 PM, said:
Funnily enough, a lot of the jumping sequences in Galatea were quite a bit harder than similar sequences in many 1x1 platformers (Sponkgo's Legendary Journey, CJA and Guy's billion and a half platformers that are all exactly the same, your own Spaceship Crusade etc. etc. along with many other games).
That's exactly what I was thinking.
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#22
Posted 25 July 2007 - 08:39 PM
Then again, when I think of tough jumping in MZX games, Adlo and Bocco's game comes to mind, which were downright MEAN.
<Exophase> HES STEALING MAH AIRSHIP!!!!!!11111111
#23
Posted 25 July 2007 - 08:48 PM
#24
Posted 25 July 2007 - 11:29 PM
The best way to implement pixel movement sprites is to use counters to call for sprites to be drawn.
Basically, you need X, Y, char and color.
then you have a counter keeping track of the amount of sprites on screen.
to add a sprite, just set s&spr&_x, s&spr&_y, s&spr&_c, s&spr&_co and increase spr by one.
Then your drawing robot draws sprites from zero up to spr, and sets spr back to zero for the next cycle.
also, I don't think pixel movement is necessary for platformers, but you need to be careful:
1) Avoid small platforms such as 1x1 and 2x1. If you use them, do so at places where failing the jump will not hurt you, or where they are right next to each other so that it is easy.
2) Avoid enemies that move randomly. Since you have low precision for your attacks, you need to be able to predict the enemy's movements in advance in order to reliably kill them.
3) 1x1 platformers arn't like other platformers, so level design that looks good for regular platformers may not work.
4) You can use speed 2 and program in high delays, so that your character moves slowly, but reacts instantly. I know it sounds strange, but it makes a difference.
5) As a general rule, avoid delays between the time where you hit a button and the your character reacts on the screen. They just ramp up the learning curve, making your game less intuitive to play, and offer little in return. (ex: in Galatea, when you attack, there are two frames where your guy starts swinging his weapon and doesn't actually attack yet. However, it's offset by the fact that you see the guy attacking as soon as you hit the button. And it looks cool.)
6) This is not a console game. This means the player will be using a keyboard, and occasionally, a crappy laptop keyboard. Avoid requiring the player to hold keys to run or to aim diagonally. I highly suggest using z to jump, x to attack. You don't need anything else. If you need to be able to fire in all directions, have the player stop moving when he is attacking, and let him aim with the arrow keys.
7) Things that move faster than one character per cycle need to use special collision detection, otherwise they might skip past things. This shouldn't happen if you keep your game at speed 2.
8) Don't make things move too fast, always give ample reaction time. If the player gets hit, it should be because he made an obvious mistake. You can have specific parts of your game require trial and error, or require memorizing enemy patterns, but players get frustrating quickly. It might seem stupid at first, but the meat of your game should just be breezing through, jumping over slow enemies and dodging easily expected traps.
9) Not everything should have the same size. Even though the chars are 8x14 pixels, you can have enemies smaller than that. Your bosses should really be bigger than 1x1, too. Same with background tiles: there can be small blocks, big blocks, wide blocks, tall blocks...
There are many more tips I could give you about this.
This post has been edited by LogiCow: 25 July 2007 - 11:57 PM
#25
Posted 26 July 2007 - 12:32 AM
LogiCow, on Jul 25 2007, 07:29 PM, said:
The best way to implement pixel movement sprites is to use counters to call for sprites to be drawn.
Basically, you need X, Y, char and color.
then you have a counter keeping track of the amount of sprites on screen.
to add a sprite, just set s&spr&_x, s&spr&_y, s&spr&_c, s&spr&_co and increase spr by one.
Then your drawing robot draws sprites from zero up to spr, and sets spr back to zero for the next cycle.
also, I don't think pixel movement is necessary for platformers, but you need to be careful:
...
4) You can use speed 2 and program in high delays, so that your character moves slowly, but reacts instantly. I know it sounds strange, but it makes a difference.
5) As a general rule, avoid delays between the time where you hit a button and the your character reacts on the screen. They just ramp up the learning curve, making your game less intuitive to play, and offer little in return. (ex: in Galatea, when you attack, there are two frames where your guy starts swinging his weapon and doesn't actually attack yet. However, it's offset by the fact that you see the guy attacking as soon as you hit the button. And it looks cool.)
There are many more tips I could give you about this.
Hmm, this is good stuff. Maybe you help us all code our own Shiny Pixel Perfect Engine Thingy! That speed 2 tip is a really good Idea, I just hava a few questions about it...
Do you use Speed 2 over Speed 1 for a reason (I wonder if it has something to do with timing over different PCs or something.)?
How would you code an engine so that it runs at an apropriate speed? I wonder...
and about no. 5)... Is it me, or do dead enemies hurt you in your latest DOZ platformer? It would be nice for a game to kill off you enemies immediately, so that you could run through the game (almost)
<phthalocyanine> they make experiences.
<Nadir> demos, more like
<Nadir> a glimpse into what could have been if mzx wasn't such a bore to work with
<Nadir> actually, i'm being unfair
<Nadir> i would have made mzx games if it was capable of running on more than 20 computers worldwide in 1998
<Nadir> >:D
<%Alice> functor
<%nooodl> i hear C++ has a thing called functors and they're completely different from Haskell functors...
<rorirover> the result is the most horrid thing in C++, it's basically black magic and it transforms any code you're writing into some eldritch monstrosity
#26
Posted 26 July 2007 - 01:20 AM
However, the player's weapon deals a small amount of damage every cycle, rather than one big amount when it hits. That's why double KOs can sometimes happen.
I know it's not the ideal situation, and one big amount is better, but it would require enemy temporary invulnerability when they get hit, which I didn't feel like doing.
This post has been edited by LogiCow: 26 July 2007 - 01:22 AM
#27
Posted 26 July 2007 - 01:22 AM
Speed 2, on the other hand, has an artificial delay of 16ms, so it will always be 62.5fps as long as the computer running it is fast enough to reach this. Speed 3 uses 32ms, speed 4 48ms, speed 5 64ms and so on.
As a result, it is best not to use speed 1 for ANYTHING. There is no reason for it, apart from using obscure cycle-ending commands quickly (which are usually unnecessary)

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#28
Posted 26 July 2007 - 01:27 AM
The main advantage for menus is that the cursor position is refreshed more often, so it feels snappier. But speed 2 is still fine for that.
#29
Posted 26 July 2007 - 01:36 AM

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#30
Posted 26 July 2007 - 12:14 PM
BTW, interesting thread. There's a lot more to platformer gameplay than I'd realised.
--ajs.