A few quick questions from a newbie!
-
- User
- Posts: 26
- Joined: Mon Feb 18, 2013 10:33 am
A few quick questions from a newbie!
Hey,
I'm a new user to PureBASIC, I'm an experienced BASIC user having used QBASIC, VisualBASIC and VB.NET but I am new to games development. I just started using PureBASIC and I have a few quick questions on a hobbyist game I am making. The game is a 2d platform jumping game.
1) When I have a lot of sprites on the screen the framerate goes down significantly, is the an efficient way to batch sprites?
2) Files. How is simple sequential file handling done in PureBASIC? I would like to create level files.
3) Are all commands 100% cross platform compatible? Will my application work the same on all operating systems?
4) I have scrolling platforms in my game that, what kind of other elements could I add to make it unique?
5) I am nearing the maximum limit of 800 lines for the demo, it's come up fast. I am working on a small non-commercial game project, is it worth purchasing the full version for my project? If I do will it be valid for all future updates and operating systems?
6) Are there any tips and tricks for working in PureBASIC?
Thanks for your help!
I'm a new user to PureBASIC, I'm an experienced BASIC user having used QBASIC, VisualBASIC and VB.NET but I am new to games development. I just started using PureBASIC and I have a few quick questions on a hobbyist game I am making. The game is a 2d platform jumping game.
1) When I have a lot of sprites on the screen the framerate goes down significantly, is the an efficient way to batch sprites?
2) Files. How is simple sequential file handling done in PureBASIC? I would like to create level files.
3) Are all commands 100% cross platform compatible? Will my application work the same on all operating systems?
4) I have scrolling platforms in my game that, what kind of other elements could I add to make it unique?
5) I am nearing the maximum limit of 800 lines for the demo, it's come up fast. I am working on a small non-commercial game project, is it worth purchasing the full version for my project? If I do will it be valid for all future updates and operating systems?
6) Are there any tips and tricks for working in PureBASIC?
Thanks for your help!
Re: A few quick questions from a newbie!
1. Can't help with graphics.
2. When files are opened, you may either assign a constant to the file number (i.e. the file identifier), or you may call it with #pb_any and use the return value as the file number--this allows you to track which file you are accessing. As for file names, they are strings, so you can manually add a level number to the file name.
i.e. Filename$ = "BasherGameLevel" + str(currentlevel) +".lvl"
3. No. Look at the bottom line of each command, and they list the Supported OS information. There is a chart hidden in the Help file--look at the very last link on the Reverence Manual main page, labeled "Platform-dependant Functions". Very few commands do not work across all os's--there are about 50 items in the exception chart. Given we have over 1,000 commands, that's about 95% cross-compatible. Not bad, considering most of the exceptions are irrelevant in the "unimplemented" os's.
4...
5. I believe PB is a great value, and speeds up development of "simple" tasks. You are likely to be happy with it as a basic user. Keep in mind that PB has a very small ecosystem compared to VB or any of the curly-brace languages. (i.e. this forum, plus a small handful of blogs & library sites.) Even so, when I was searching for a new language, my two big requirements were "compiled code" and cross-platform. Of those available, I compared how active the forums were, and was satisfied that I'd get the help I needed with PB. I have not been disappointed in that regard.
6. Have fun, and visit the forum often--there are some pretty experienced guys here who are quick to help.
[edited #5.]
2. When files are opened, you may either assign a constant to the file number (i.e. the file identifier), or you may call it with #pb_any and use the return value as the file number--this allows you to track which file you are accessing. As for file names, they are strings, so you can manually add a level number to the file name.
i.e. Filename$ = "BasherGameLevel" + str(currentlevel) +".lvl"
3. No. Look at the bottom line of each command, and they list the Supported OS information. There is a chart hidden in the Help file--look at the very last link on the Reverence Manual main page, labeled "Platform-dependant Functions". Very few commands do not work across all os's--there are about 50 items in the exception chart. Given we have over 1,000 commands, that's about 95% cross-compatible. Not bad, considering most of the exceptions are irrelevant in the "unimplemented" os's.
4...
5. I believe PB is a great value, and speeds up development of "simple" tasks. You are likely to be happy with it as a basic user. Keep in mind that PB has a very small ecosystem compared to VB or any of the curly-brace languages. (i.e. this forum, plus a small handful of blogs & library sites.) Even so, when I was searching for a new language, my two big requirements were "compiled code" and cross-platform. Of those available, I compared how active the forums were, and was satisfied that I'd get the help I needed with PB. I have not been disappointed in that regard.
6. Have fun, and visit the forum often--there are some pretty experienced guys here who are quick to help.
[edited #5.]
Re: A few quick questions from a newbie!
Yes, proper sprite development can significantly reduce resources and run at proper speed.
First off, I always stick with "power of 2" sprites. If you have a large sprite, such as a castle, break it down into pieces by power of 2. A sprite that is 1000x700 is padded by the graphics processor to 1024x1024. Therefor larger memory consumption then you might have expected. GPU's use to only handle power of 2 sprites but what I call a "hack" disabled that but a newbie who doesn't understand game graphics will suffer in their development. I personally believe gpu developers such as Nvidia and ATI should have never allowed odd graphic sizes. Anyway, google "power of 2" and check out http://www.mapeditor.org and you'll see how graphics should be designed. Also and example... http://www.purebasic.fr/english/viewtop ... 16&t=51017
Next, sprite sheets are very nice. You can combine multiple sprite in a sheet and reduce your executable size. Check out ClipSprite() in the PureBasic manual. Also, check out this for animated sprites... http://www.purebasic.fr/english/viewtop ... matesprite+
And last, your coding technique has a lot to do with how well your sprites run. Just try to keep your code as optimized as possible. Search the forum for info or just ask. There's nothing like creating game and having it crash or run slow.
First off, I always stick with "power of 2" sprites. If you have a large sprite, such as a castle, break it down into pieces by power of 2. A sprite that is 1000x700 is padded by the graphics processor to 1024x1024. Therefor larger memory consumption then you might have expected. GPU's use to only handle power of 2 sprites but what I call a "hack" disabled that but a newbie who doesn't understand game graphics will suffer in their development. I personally believe gpu developers such as Nvidia and ATI should have never allowed odd graphic sizes. Anyway, google "power of 2" and check out http://www.mapeditor.org and you'll see how graphics should be designed. Also and example... http://www.purebasic.fr/english/viewtop ... 16&t=51017
Next, sprite sheets are very nice. You can combine multiple sprite in a sheet and reduce your executable size. Check out ClipSprite() in the PureBasic manual. Also, check out this for animated sprites... http://www.purebasic.fr/english/viewtop ... matesprite+
And last, your coding technique has a lot to do with how well your sprites run. Just try to keep your code as optimized as possible. Search the forum for info or just ask. There's nothing like creating game and having it crash or run slow.
www.posemotion.com
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
Re: A few quick questions from a newbie!
When you buy PB, you get all future releases for free. It's a bargain.
The team are constantly making it better too, and yes, if you use native PB commands your code will work on any supported system (you have to compile it for that system though). Where a feature or command is windows only, etc, it will say so in the documentation.
The team are constantly making it better too, and yes, if you use native PB commands your code will work on any supported system (you have to compile it for that system though). Where a feature or command is windows only, etc, it will say so in the documentation.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
-
- User
- Posts: 26
- Joined: Mon Feb 18, 2013 10:33 am
Re: A few quick questions from a newbie!
Thanks again for your help guys.
@Tenaja: Excellent, one of my requirements was also good cross platform support.
@J. Baker: That's interesting. I have a lot of long thin platforms for my game, perhaps that is dragging down my framerate, could they be optimized?
@Tenaja: Excellent, one of my requirements was also good cross platform support.
@J. Baker: That's interesting. I have a lot of long thin platforms for my game, perhaps that is dragging down my framerate, could they be optimized?
Re: A few quick questions from a newbie!
Yes, a lot of odd size sprites can add up. What is your memory use for your game when running?BASICBasher wrote:Thanks again for your help guys.
@Tenaja: Excellent, one of my requirements was also good cross platform support.
@J. Baker: That's interesting. I have a lot of long thin platforms for my game, perhaps that is dragging down my framerate, could they be optimized?
www.posemotion.com
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
Re: A few quick questions from a newbie!
I just want to attack the Sprite lib and say it sucks that you can't draw a sprite on another sprite 

-
- User
- Posts: 26
- Joined: Mon Feb 18, 2013 10:33 am
Re: A few quick questions from a newbie!
11 MB according to task manager. The platform size goes from 50x5 to 200x10.Yes, a lot of odd size sprites can add up. What is your memory use for your game when running?
I discovered that downsizing my object arrays created a good improvement in framerates. This array records information about the type/size/position/etc. of objects that is passed to the rendering routines. I downsize the size from 1000 to 100. I suspect searching through this array to find objects that match certain conditions is taking a significant amount of time. Is there a quick way to search arrays? I currently do this with FOR/NEXT loops.
Re: A few quick questions from a newbie!
Arrays are very fast. Depends on your methods and what is in the array? Need code to see what to speed up 

The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: A few quick questions from a newbie!
Hmm, 11MB isn't bad. Might be a coding issue. You may have to post some code.
www.posemotion.com
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
-
- User
- Posts: 26
- Joined: Mon Feb 18, 2013 10:33 am
Re: A few quick questions from a newbie!
Hmm... I'm not sure which part to show you, would you like an archive of all my files?
There are a lot of areas that access the object array with: "For Counter = 1 To NumberOfObjects"
Could I do ForEach? If so, would that be quicker?
There are a lot of areas that access the object array with: "For Counter = 1 To NumberOfObjects"
Could I do ForEach? If so, would that be quicker?
Re: A few quick questions from a newbie!
The For To should be fine. Here's quick write up for what I do for games...BASICBasher wrote:Hmm... I'm not sure which part to show you, would you like an archive of all my files?
There are a lot of areas that access the object array with: "For Counter = 1 To NumberOfObjects"
Could I do ForEach? If so, would that be quicker?
Code: Select all
If Level = 1
If LoadLevelOneImages = 1
...code... ;Using For To, I LoadImages() or CatchImages()
LoadLevelOneImages = 0
EndIf
PlayLevelOne = 1
EndIf
If PlayLevelOne = 1
...code... ;DisplaySprite() and so forth
If LevelOneOver = 1
Level = 0 ;Menu or Level = 2 or whatever you wish
;Using For To, I FreeSprite() from level 1
EndIf
EndIf

www.posemotion.com
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
-
- User
- Posts: 26
- Joined: Mon Feb 18, 2013 10:33 am
Re: A few quick questions from a newbie!
I think the code is okay, I've smoothed it out a bit, probably just the crappy hardware I'm testing it on. Thanks for your help guys!
Re: A few quick questions from a newbie!
Hi, Your question if it is worth it to purchase Purebasic....
I can tell you for sure... worth every penny. I am a newbie and have gotten lots and lots of help here.
The assistance you get from this forum is well worth much more than a few dollars you try to save using other free software.
Dont hesitate , purchase immediately... if you do find Pure Basic is up to your requirements.
Alan
I can tell you for sure... worth every penny. I am a newbie and have gotten lots and lots of help here.
The assistance you get from this forum is well worth much more than a few dollars you try to save using other free software.
Dont hesitate , purchase immediately... if you do find Pure Basic is up to your requirements.
Alan
Re: A few quick questions from a newbie!
+1AlanFoo wrote:worth every penny.
Greetings ... Kiffi
Hygge