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! / which has faster sprites? DBP or PlayBasic?

Author
Message
ShadowCentaur 2
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Free Country USA
Posted: 4th Jul 2007 04:14
I've made a 2d ascii based shooter in DBC but due to the slow sprite commands my framerate is frustratingly slow. Which is better in terms of 2D commands and speed, Dark Basic Proffessional or Play Basic?

If you ever need me, click your heels together three times and press Ctrl + Alt + Del.
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 4th Jul 2007 04:32
Play Basic, by a long long way.

Not to mention it also has pixel perfect sprite collision (which DBP does not). If you want to create a pure 2D game, it's a very nice language indeed.

It's not perfect mind you - there are issues with the editor, obtusity of some functions, the help files and some of the sample code, but nothing you can't overcome (and nothing that can't be equally levied at most other game dev languages).

I'm particularly looking forward to the forthcoming particles system. They're making great inroads into 3D too, but (imho only of course) this is of no interest to me, and I'd rather see the effort expended in making the 2D side of game creation even easier (because I've given-up hoping any other language ever will).

Cheers,

Rich

Never trust a computer you can't throw out of a window
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 4th Jul 2007 12:48
Yeah the considerations that Kevin is putting into PB make it a more powerful 2D game language, things that do nothing but save us time and effort. It kinda reminds me of the old school Basic's on the 16-bits, you'd often get add on's that provide things like tileable maps and hardware sprites and stuff that you'd usually have to code in assembly. Playbasic has that feel to it, like it's been made by someone who's had to deal with this stuff a lot - so we end up with built in features that are only available in DBPro through plugins.


Good guy, Good guy, Wan...
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 4th Jul 2007 18:04
Have been playing with PlayBasic for a few days now and am really liking its raw horse power. I have not touched upon the majority of it, but there are certainly some areas that made me go 'wtf?', so don't expect a flawless ride with it - but do expect to be able to create blazingly fast 2D games.

Never trust a computer you can't throw out of a window
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 5th Jul 2007 05:01 Edited at: 25th Mar 2011 07:08
ShadowCentaur 2,

Quote: " I've made a 2d ascii based shooter in DBC but due to the slow sprite commands my framerate is frustratingly slow. Which is better in terms of 2D commands and speed, Dark Basic Proffessional or PlayBasic? "


Depends upon what you want to do with it. If the application is working how you want currently just slowly, and therefore you want to drag and drop it say, then both require some work on your part. It's difficult to say how much, having never seen the app/code in question.

In terms of raw 2D image blit speed PlayBasic is leap years ahead of DB classic.

It's a different story if want loads of rotation. While the sprite rotation engine in PlayBasic is fairly fast considering (it's DX3), it's not the quickest thing on the planet though. So when comparing to current release editions of PB (V1.63 and bellow) to DBpro atm, it's a bit of lottery as to what's faster. While DBpro should be faster always (DX9), with a little clever design you can certainly keep up..

Too often people assume that render speed is be and end all, It's nice, I'm not disputing that.. But to be quite frank DBpro does not offer a complete 2D solution, it gives you parts then expects you to fill the gaps. One well documented gap is the lack of any native pixel perfect collision solution. While this can be overcome with user software methods or recent plug in additions. They're not only rather expensive, they aren't very quick. So the extra rendering performance is soon lost in collision detection.

PlayBasic by designed tries to keep a proportional balance between the two, so we have fairly fast rendering and equally fast collision solutions built in. Ranging from vector to pixel perfect. Including mixed modes (vector to pixel perfect and vice versa).


In terms of number crunching (Code execution) PlayBasic (1.62 / 1.63) performance sits in-between the DB and DBpro. V1.63 can actually match and even beat Dbpro performance in certain circumstances. It often comes down to how well you utilize the embedded commands/features of the language. The more you embrace them, the more efficient (faster) your programs will become.

One distinction has to be made though. PlayBasic V1.62 (current demo) uses the original runtime engine, creatively referred to as VM1. PlayBasicV1.63 (current retail edition) uses some elements from VM2. Which this is obviously our second generation runtime environment. VM2 includes a lot of low level speed ups/design changes. Therefore 1.63 can be significantly faster than V1.62. In Particular with memory/array & string operations. Which are are virtually unavoidable when programming.

PlayBasic also ships with two editions of the runtime environment. Those being Release and Debug. The Debug edition is the basically the same runtime you use when testing your programs from the IDE. So it includes nanny code to try and stop you from doing bad things.. .. The release edition has all safe code removed. This gives a hirer yield to the raw calculation performance. How much so is Dependent upon how much raw calculations your program do. But, 10%->20% isn't uncommon.



Porting Code

Initially new users could be forgiven for assuming that PlayBasic syntax is much like DB / DBpro. While there are obvious similarities, but once you get past those you'll discover that PlayBasic is a far more structured and strict then either DarkBASIC, Dark Basic Pro (DBPRO) combined. Interestingly this is commonly seen as bug by migrating DarkBASIC users trying to quickly dump their old DB code in PB.

One particular example commonly occurs with Accessing array elements. While you can get away with lots of potential 'illegal memory accesses' in DB/Dbpro. PB isn't that forgiving. If you write outside the bounds, it'll force a runtime exception.

Another thing you'll not doubt discover when moving DB/DBpro code to PB, is that PB doesn't have Bitmaps. Why ? as in PB you can render to/copy from any image, making the need for the bitmap style solution totally redundant. However when porting DB game, you'll probably end up simulating them.

The other main difference (that comes to mind) is the packed word command names and naming convention that PlayBASIC uses. While DB/Dbpro use a broken word command names (ie Sprite X(SpriteIndex) ) PB uses a Packed format with strict naming convention. (No spaces) So it becomes (GetSpriteX(SpriteIndex)) .

Command names in PlayBasic are also reversible. For example, if you set a sprites draw mode property (ie SpriteDrawMode SpriteIndex,Mode) you'd query this property using the equivalent GET statement. Ie (Mode=GetSpriteDrawMode(SpriteIndex). So if you know how to set something in PB, you instantly know how to retrieve it.

Other conventions that come to mind are CREATE, NEW, DRAW. Effectively you can Mix the prefix with the media type and you get a valid command name. CreateSprite, CreateImage, NewSprite(), NewImage(), DrawSprite, DrawImage etc etc.. This means the command names indeed can be longer than the DB counterparts, but once you come to terms of the naming convention you can easily guess command names, even if you've never used the command set before.

Anyway, if you'd like me to port you've game for you as an experiment, just send it over and i'll give it a quick seeing too.

ShadowCentaur 2
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Free Country USA
Posted: 5th Jul 2007 05:30
wow! thanks a lot guys. it seems like playbasic will probobly serve my needs better. Here is the code for my ASCII shooter, if you want to try and port it. it's almost all checking for collision stuff. (the levels are separate from the main program, a couple are attatched here: http://forum.thegamecreators.com/?m=forum_view&t=98321&b=10 )

If you ever need me, click your heels together three times and press Ctrl + Alt + Del.

Attachments

Login to view attachments
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 5th Jul 2007 08:49 Edited at: 25th Mar 2011 07:09
ShadowCentaur,

I've ported the game source (from the thread you linked!, not the attached version, sorry didn't notice it) just to give you can idea. I haven't really re-written anything, just cut and posted and renamed the appropriate parts. The Sprite system in DB and PB work very differently, as such, rather than rewrite the spritecode, i've made some functions in PB that simulate DB sprite commands. While they work, i wouldn't recommend using that approach in a real PB project, but ya get that. Anyway, it works (as far as i know ) and should give you some general idea how PlayBasic works compared to DarkBasic.

Get the FREE PlayBasic V1.64 learning Edition

Download
PlayBasic Port

Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 5th Jul 2007 08:55 Edited at: 25th Mar 2011 07:09
Rich,

Quote: "
I have not touched upon the majority of it, but there are certainly some areas that made me go 'wtf?'
"


Which are ?

ShadowCentaur 2
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Free Country USA
Posted: 6th Jul 2007 04:25
thanks. you ported an older version(i've acually added 2-player since then) but it doesn't matter. i'm probobly going to buy playbasic and actually rewrite it in that language. space shooters tend to lock up when there's a bajillion objects on screen so i'm gonna go for the fast sprites and collision. thanks for the help!

If you ever need me, click your heels together three times and press Ctrl + Alt + Del.

Login to post a reply

Server time is: 2025-05-17 04:02:07
Your offset time is: 2025-05-17 04:02:07