Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Platformer Revisted [PlayBasic]

Author
Message
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 18th Feb 2009 15:08 Edited at: 11th Aug 2010 23:47
Platformer Revisited

The 2D platform game demo that comes with PlayBasic V1.63, dates back probably 3 or 4 years ago, maybe more. It's one of those demo's that I'd love to really vamp up, given infinite time and media.. but..

Anyway, while working on the camera routines for PLayBasic V1.64I, I needed something to test the camera functionality so choose to set up a batch rectangle operation,using the camera for the clipping and rendering. What i wanted to do was add 'something' behind the backdrop layers of the old game, just to pretty the scene up a bit. Hence, so I just slapped a some picture and some clouds in the backdrop.

Rather than just use the blit everything approach, the code scans the foreground map layers for 'transparent' runs of tiles. In other words we only bother drawing backdrop stuff, when it's potentially visible. When a run of transparent tiles are discovered, we draw this portion of the screen using the camera (the backdrop pictures are pre-captured to the scene). While this makes the drawing the scene a multi pass affair, we end up giving the the demo somewhere between a 15->25fps boost. Which of course means we can drop more effects in for free.

So since i'm using PlayBasic V1.64 (since it;s the current version of PlayBasic), I threw in Tinted Anti aliased sprites, and some gouraud quads with blending in backdrop, then slapped an alpha shaped in the foreground. The savings in the backdrop mean the extras are pretty much free.

This is really important when we have games where we move through scrolling land scapes. In particular when the foreground(s) have sections, are fully or partially covering the backdrop. Anyway the moral of the story is design !, you know how you're game works, your graphics engine doesn't. .

Here's the viewport creation code.



Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 18th Feb 2009 15:09 Edited at: 26th Mar 2011 21:39
Screen Shot (View port render)



Attachments

Login to view attachments
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 18th Feb 2009 15:10 Edited at: 26th Mar 2011 21:41
Screen Shot (Combined foreground and background)




Attachments

Login to view attachments
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 24th Feb 2009 20:08 Edited at: 26th Mar 2011 21:43
PlayBasic V1.64I beta 14 - AFX Maps.

Older versions of the PlayBasic map library, only support two types of Map gfx. Video & FX. However, what I've always wanted to do is add AFX support also. However, this wasn't practical due to block drawing routines only supporting drawing to surfaces with the same pixel format. However, as you should know, that since 1.64h this limitation is now a thing of the past, and the gfx engine can now convert between formats on the fly. Often, with a very minimal impact. Sometimes, it can even be quicker.

AFX formatting in PlayBasic, is effectively a 32bit surface with Alpha channel, pixel format ARGB. These surfaces are 32bit regardless of the display surface format. So this means that in order to import AFX graphics into a map, we have ot load an Image specifically as AFX format. Once loaded we import into the map using the MakeMapGFX function. For the time being at least. What this does is dects the image format you're importing and automatically builts an AFX version of the block buffer. Once imported, it's business as usual.

One thing that isn't working at the moment is the Solid block detection in the map currently can't understand AFX surface and thinks everything is transparent. In the case the platformer test, we end up with rendering more stuff that is really needed, so the rate drops. While this is to be expected, as the cost of the rendering pixels with Alpha channel is higher, than opaque pixels.

Anyway, I've attached a work in progress picture showing both map layers being tinted and using variable alpha levels per pixel, a rotating backdrop which alpha over the shadebox, with the Tinted AA sprites.. While complete overkill, it's certainly possible.

Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 24th Feb 2009 20:09 Edited at: 26th Mar 2011 21:43

Attachments

Login to view attachments
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 24th Feb 2009 20:09 Edited at: 26th Mar 2011 21:44

Attachments

Login to view attachments
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 25th Feb 2009 17:06 Edited at: 26th Mar 2011 21:45
2D Platformer Revisited - Parallax Version

This is a revision of the original Platform game example that has shipped with PlayBasic V1.63 (and for years before too). Sadly that version is so old it doesn't really represent what PlayBasic V1.63 can do, let alone the V1.64 edition.

So the aim of this update was simply to test some new functionality that can be found PlayBasic V1.64, such as AFX maps, Tinted Alpha sprites, Alpha Bitmaps Fonts and various other tidbits. Game play wise, it's the same game


Download

www.PlayBasic.com

Requires PlayBasic V1.64I

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-03-28 20:53:45
Your offset time is: 2024-03-28 20:53:45