BSi
10-24-2006, 10:30 AM
Hi folks,
I'm just finished a small platform game development in PPL (see screenshots) and found a couple of small but annoying bugs in PPL. At the time I started the development, the active PPL version was 1.4 but I tested them under 1.5 as well. After a couple of tests I found workaround for every described problem except for the WM2005 one, but they're still exists and made me some headache.
1. SetSpriteCollideRect() problem #1
When using animated sprites, if I try to set a smaller collide rectangle than the sprite's actual dimensions, PPL will position the collision box badly.
2. SetSpriteCollideRect() problem #2
Let we use a small image which we can replicate horizontally to form a long repeating sprite. In my game this sprite type is the spikes on my platforms: I have a small spike image (10 pixel width) and I replicate it to form a continouos spike line. For the horizontal replication I use SetSpriteTileX(). As far as I know tiled sprites doesn't collides well because they're using the original sprite images dimensions for collide rectange. So I set the SetSpriteCollideRect() as well for this sprites, but when I check collision with Collide(), only the original image rectangle collides, not the given collide rectangle. It seems that the SetSpriteCollideRect() is ineffective in this case.
Another weird thing is if I use Collide() from opposite direction, it gives me different results. I'll explain it by the following example:
// test player
p$ = LoadSprite(AppPath$ + "player.bmp", -1, 1, 0, NULL);
MoveSprite(p$, x$, y$);
SetSpriteId(p$, "player");
SetSpriteCollide(p$, "spike");
// create spike (spike.bmp is 10x10 pixels)
s$ = loadsprite(AppPath$ + "spike.bmp", g_rgb(255, 0, 255), 1, 0, NULL);
MoveSprite(s$, x$, y$);
SetSpriteTileX(s$, 10);
SetSpriteOptions(s$, SO_COLLIDE | SO_CHECKCOLLIDE);
SetSpriteId(s$, "spike");
SetSpriteCollide(s$, "player");
SetSpriteCollideRect(s$, 0, 0, SpriteWidth(s$) * 10, SpriteHeight(s$));
a) Collide(s$, SpriteX(s$), SpriteY(s$), cx$, cy$)
It will detects collision only if player hits the original spike image rectangle (10x10 pixels).
b) Collide(p$, SpriteX(p$), SpriteY(p$), cx$, cy$)
It will detencts collision correctly, using the given collide rectangle.
3. Another collision weirdness
If I set a sprite to SO_FIXED or SO_FIXEDX, the engine calculates no collision with it at all.
4. WM2005 exe warning
If I compile my program to WM2003/WM2005, under my Windows Mobile 5.0 device the exe gives me the following startup warning always: "Runtime Error: This program was built on a different platform, it might not work properly!". Annoying.
5. SO_TOPMOST
When I set SO_TOPMOST to a sprite (actually to my level border), all of my sprites which are ever scrolled out of the screen will be immediately deleted by the engine. Strange and huge bug. For a workaround I use SetSpriteOrder() instead.
6. g_LoadFont(): font loading from file
If I try to load a font from a file (g_loadfont(AppPath$ + "font.ttf", 18, rgb(255,255,255), NULL)), I always got the following PPL runtime error:
App: test.ppl
File:test.ppl
Proc: WINMAIN
Opcode: G_LOADFONT
Char/Line/Offset: 12, 126, 0x01448910
(WINMAIN)
Access violation at 0x5c656d61
If I try to load the font from by it's name (refering to a system defined font), it will work well.
7. g_showmessage() and g_textout() without font definition
If I use g_showmessage() or g_textout() without exact font definition (ie: g_textout(NULL, "test", DVT_NONE, 1, 40, g_rgb(255, 255, 255))) it will leads to different result in the compiled exe and in the interpreted one. In the interpreted program it will shows the text with a default font, but in the compiled exe nothing appears in the screen.
After my first PPL game development I found that PPL is a really great language/tool for small 2D PPC game development but it's still young and have some limitations.
Also based on my first PPL game development I have two feature requests which could be handy for further development:
Request 1: AddSpriteCollide() / DelSpriteCollide()
AddSpriteCollide(): almost the same as SetSpriteCollide() but with AddSpriteCollide() you can define more than one collision group for a sprite to collide with.
DelSpriteCollide(): removes a collision group from the sprites collision check list
Request 2: CollideAll()
CollideAll() is almost the same as Collide() but it will return all of the colliding sprites, not only the first. (Actually I could write a CollideAll() function myself purly in PPL, using SpritesAt() and some manual low-level SpriteId and collision group checks, but it would be ineffective compared to a native language function.)
Finally here're the screenshots from my game:
../../e107_files/public/1161681906_97_FT0_js_screenshot1.jpg[br]
../../e107_files/public/1161681906_97_FT0_js_screenshot3.jpg[br]
../../e107_files/public/1161681906_97_FT0_js_screenshot4.jpg[br]
../../e107_files/public/1161682065_97_FT0_js_screenshot5.jpg
I'm just finished a small platform game development in PPL (see screenshots) and found a couple of small but annoying bugs in PPL. At the time I started the development, the active PPL version was 1.4 but I tested them under 1.5 as well. After a couple of tests I found workaround for every described problem except for the WM2005 one, but they're still exists and made me some headache.
1. SetSpriteCollideRect() problem #1
When using animated sprites, if I try to set a smaller collide rectangle than the sprite's actual dimensions, PPL will position the collision box badly.
2. SetSpriteCollideRect() problem #2
Let we use a small image which we can replicate horizontally to form a long repeating sprite. In my game this sprite type is the spikes on my platforms: I have a small spike image (10 pixel width) and I replicate it to form a continouos spike line. For the horizontal replication I use SetSpriteTileX(). As far as I know tiled sprites doesn't collides well because they're using the original sprite images dimensions for collide rectange. So I set the SetSpriteCollideRect() as well for this sprites, but when I check collision with Collide(), only the original image rectangle collides, not the given collide rectangle. It seems that the SetSpriteCollideRect() is ineffective in this case.
Another weird thing is if I use Collide() from opposite direction, it gives me different results. I'll explain it by the following example:
// test player
p$ = LoadSprite(AppPath$ + "player.bmp", -1, 1, 0, NULL);
MoveSprite(p$, x$, y$);
SetSpriteId(p$, "player");
SetSpriteCollide(p$, "spike");
// create spike (spike.bmp is 10x10 pixels)
s$ = loadsprite(AppPath$ + "spike.bmp", g_rgb(255, 0, 255), 1, 0, NULL);
MoveSprite(s$, x$, y$);
SetSpriteTileX(s$, 10);
SetSpriteOptions(s$, SO_COLLIDE | SO_CHECKCOLLIDE);
SetSpriteId(s$, "spike");
SetSpriteCollide(s$, "player");
SetSpriteCollideRect(s$, 0, 0, SpriteWidth(s$) * 10, SpriteHeight(s$));
a) Collide(s$, SpriteX(s$), SpriteY(s$), cx$, cy$)
It will detects collision only if player hits the original spike image rectangle (10x10 pixels).
b) Collide(p$, SpriteX(p$), SpriteY(p$), cx$, cy$)
It will detencts collision correctly, using the given collide rectangle.
3. Another collision weirdness
If I set a sprite to SO_FIXED or SO_FIXEDX, the engine calculates no collision with it at all.
4. WM2005 exe warning
If I compile my program to WM2003/WM2005, under my Windows Mobile 5.0 device the exe gives me the following startup warning always: "Runtime Error: This program was built on a different platform, it might not work properly!". Annoying.
5. SO_TOPMOST
When I set SO_TOPMOST to a sprite (actually to my level border), all of my sprites which are ever scrolled out of the screen will be immediately deleted by the engine. Strange and huge bug. For a workaround I use SetSpriteOrder() instead.
6. g_LoadFont(): font loading from file
If I try to load a font from a file (g_loadfont(AppPath$ + "font.ttf", 18, rgb(255,255,255), NULL)), I always got the following PPL runtime error:
App: test.ppl
File:test.ppl
Proc: WINMAIN
Opcode: G_LOADFONT
Char/Line/Offset: 12, 126, 0x01448910
(WINMAIN)
Access violation at 0x5c656d61
If I try to load the font from by it's name (refering to a system defined font), it will work well.
7. g_showmessage() and g_textout() without font definition
If I use g_showmessage() or g_textout() without exact font definition (ie: g_textout(NULL, "test", DVT_NONE, 1, 40, g_rgb(255, 255, 255))) it will leads to different result in the compiled exe and in the interpreted one. In the interpreted program it will shows the text with a default font, but in the compiled exe nothing appears in the screen.
After my first PPL game development I found that PPL is a really great language/tool for small 2D PPC game development but it's still young and have some limitations.
Also based on my first PPL game development I have two feature requests which could be handy for further development:
Request 1: AddSpriteCollide() / DelSpriteCollide()
AddSpriteCollide(): almost the same as SetSpriteCollide() but with AddSpriteCollide() you can define more than one collision group for a sprite to collide with.
DelSpriteCollide(): removes a collision group from the sprites collision check list
Request 2: CollideAll()
CollideAll() is almost the same as Collide() but it will return all of the colliding sprites, not only the first. (Actually I could write a CollideAll() function myself purly in PPL, using SpritesAt() and some manual low-level SpriteId and collision group checks, but it would be ineffective compared to a native language function.)
Finally here're the screenshots from my game:
../../e107_files/public/1161681906_97_FT0_js_screenshot1.jpg[br]
../../e107_files/public/1161681906_97_FT0_js_screenshot3.jpg[br]
../../e107_files/public/1161681906_97_FT0_js_screenshot4.jpg[br]
../../e107_files/public/1161682065_97_FT0_js_screenshot5.jpg