PDA

View Full Version : AstroCrusher - TBGL Action game



Michael Hartlef
14-06-2009, 11:15
Hi folks,

as I promised, here is the source of AstroCrusher. It's a small game that makes a good use of the new sprite commands and the thinGaming online scoring module.

http://i176.photobucket.com/albums/w174/MikeHart66/AstroCrusher_Title.png

If you have any questions or suggestions, then please let us hear them.

EDIT: Please let Astrocrusher read and write the scores to the website, if not you will get an error and can't play the game!

EDIT2 : Attached souce code V1.01 because sound handling changed recently

Michael

Petr Schreiber
14-06-2009, 11:41
This code demonstrates various techniques new in TBGL 0.2.5.

Usage of sprite module
Please note it is doesn't serve just to load and draw sprites. It offers advanced manipulation such as speed/angular velocity/friction, and also generates various events, for collision for example. Mike will tell more, he invested lot of time to this project and TBGL new spriting, and I am very pleased with the results.

Low CPU usage policy :)
That means use of TBGL_BindPeriodicFunction/TBGL_ProcessPeriodicFunction to keep images coming, while staying CPU friendly. CPU usage on single core PC usually does not go over 2%.

Optimized font rendering
Font implementation in older TBGL was working, but had two performance issues:
- it was optimized for 3D matrix, for 2D games you had to switch 3D/2D mode back an forth
- it did lot of queries for each drawing command, determining whether texturing is on or off
- you had to TBGL_ResetMatrix before usage

New implementation allows creating fonts designed specially for 2D or 3D mode, and if you enclose TBGL_PrintBMP commands between TBGL_BeginPrintBMP / TBGL_EndPrintBMP, you will get less state changes during the font rendering, improving performance especially in case of lower end GPUs. TBGL_BeginPrintBMP / TBGL_EndPrintBMP will also reset the transformations for you, so you do not have to TBGL_ResetMatrix manually anymore.


Petr

peter
14-06-2009, 20:53
Hi,

astro crusher has bug !
i get this message:

Errorcode 400
Subscript out of range in array or matrix.
Line number 599

Peter

Michael Hartlef
14-06-2009, 21:12
Nice try. :eusaclap: You will get this error when you don't play with an internet connect enabled as we store the highscore online.
It's not a bug, it's a feature. Why else would it be on the thinGaming website, or?

I'll see if I can change the code so you can play it without highscore storing but for now it is mandatory.

ErosOlmi
14-06-2009, 21:40
I will see if I can add a new function to OnlineScore module to check if connection is active or not so programmer can decide what to do.

Eros

Michael Hartlef
14-06-2009, 21:46
Yes, that would be good. Thanks!

ErosOlmi
15-06-2009, 00:06
Michael,

I've developed the following function in OnlineScores module:

OnlineScores_GetConnectionState

It will return %FALSE if connection is not present.
Otherwise it will return a set of numeric FLAGs in a LONG variable telling how the Internet connection is currently established: lan, modem, proxy, ...

I've updated module and test scripts in SVN server. You can check how to use it.

If ok, it will be present in next thinBasic 1.7.8.0 beta release.

Ciao
Eros

Michael Hartlef
15-06-2009, 06:27
Thanks Eros, I will test it tonight.

kryton9
15-06-2009, 07:19
Great job guys. Another game I love, now I will never get any work done. Looks and plays really nicely, great all around-- from sounds to visuals.

ErosOlmi
15-06-2009, 11:14
Thanks Eros, I will test it tonight.


Michael,

I've updated again OnlineScore SVN server.
I've added one more function that will be useful to get some kind of data after your have checked that Intenet connection is active.
See new function

OnlineScores_GetTestingData(ParamToGet)
where ParamToGet parameter can be one of the following equates (for the moment just one):

%OLS_Test_PublicIP

See examples in SVN server

Ciao
Eros

ErosOlmi
15-06-2009, 11:27
Michael,

Patrice Terrier has asked if it is possible to put in the first post of this thread not only the .tBasic source code but also the full set of media files in order to be able to test the game without the need to download bundled exe from the other post.

I think it is better in order not to create cross downloads dependencies.
It would also be nice to create ZIP files with a single directory in there and put in that directory all the needed files. It is more convenient when unzipping because it will be very easy to just drag/drop a single directory.
So something like:
.ZIP
|---> AstroGame <<--- Add this lever
|---> source code.tbasic
|---> sounds dir
|---> whatever.mp3
|---> textures dir
|---> whatever.bmp
...

Ciao
Eros

Patrice Terrier
15-06-2009, 11:32
I strongly agree with that one :D

By the way this is my first post here...

Michael Hartlef
15-06-2009, 12:12
Hi Patrice,

Welcome here on the board.

I will add the media stuff to it like it was suggested. Maybe tonight or tommorow.

Michael :)

Michael Hartlef
15-06-2009, 12:15
Great job guys. Another game I love, now I will never get any work done. Looks and plays really nicely, great all around-- from sounds to visuals.


Hi Kent,

Thanks for the kind words and i am sorry that it will hold you back from your projects ;)

Michael Hartlef
15-06-2009, 19:24
Michael,

Patrice Terrier has asked if it is possible to put in the first post of this thread not only the .tBasic source code but also the full set of media files in order to be able to test the game without the need to download bundled exe from the other post.

I think it is better in order not to create cross downloads dependencies.
It would also be nice to create ZIP files with a single directory in there and put in that directory all the needed files. It is more convenient when unzipping because it will be very easy to just drag/drop a single directory.
So something like:
.ZIP
|---> AstroGame <<--- Add this lever
|---> source code.tbasic
|---> sounds dir
|---> whatever.mp3
|---> textures dir
|---> whatever.bmp
...

Ciao
Eros





Ok folks,

source with media is now to be found in the first post. :)

Michael Hartlef
03-02-2010, 08:07
I attached a modified source code, as the sound handling in TBass changed recently.

kryton9
04-02-2010, 02:42
Thanks Mike.

What is this for in the code?
$GAMEGUID = "{00000000-0000-0000-0000-000000000000}"

Michael Hartlef
04-02-2010, 07:49
Hi Kent,

it is mandatory for the usage of the TOnline_Scores module. Every game on the thingaming website needs a unique GUID to be identified there. The entry you see in the source code is for Test purposes. When you want to store your game there, contact Eros, he will create a GUID for you.

Ciao
Michael

kryton9
05-02-2010, 06:53
Oh I see. I need to find how to make it easier if I am to get further. I don't last too long in the game at the difficulty it is at right now.
I also recommend others to run it at fullscreen. I had to change 2 lines to run at fullscreen in the source.

It might be good idea to put games out so they run in fullscreen mode, gaming in a window is no fun :)

Michael Hartlef
05-02-2010, 08:06
It might be good idea to put games out so they run in fullscreen mode, gaming in a window is no fun :)


Why is that?

kryton9
06-02-2010, 00:58
Personally I think fullscreen game play is a totally different feel and experience. You are able to immerse yourself into the game world.