View Full Version : 3D graphics for fun !
Petr Schreiber
13-11-2005, 17:01
Hi,
although 3D module for thinBASIC could be used for more serious problems, it's useful for games too.
In this thread you will meet some thinBASIC games during some time.
I'll start with very simple example - space shoting game.
In this game you have to control small spaceship captured by wormhole.
Your only job is to shoot the dangerous flying boxes to achieve better score.
This game was tested with thinBASIC 1.0.6.4 and with TBGL module version 0.1.5
Enjoy,
Psch
ErosOlmi
13-11-2005, 17:57
:D Thanks Petr what a fantastic learning example.
On my PC it is too fast. I've added a SLEEP 1 just before WEND in main game loop in order to be able to move and fire.
Roberto will like it.
wow
Petr Schreiber
13-11-2005, 19:54
Hi,
I'm happy you like it. It's just the beginning :)
On my PC it is too fast
:shock: you have computer from NASA ? :)
... and I thought I had to optimize the code even more :)
Yes, the not existing "constant speed" setup is my fault.
It's easy to add ( all movements in the scene will be dependent on current framerate ).
I'v updated the sample. If you have time, please let me know if it works.
Thanks,
Petr
ErosOlmi
13-11-2005, 20:01
Yes, it's from NASA ;).
That's the reason why
FrameRate = (1/(ThisTime-LastTime))*1000
"gives division by zero" error
Petr Schreiber
13-11-2005, 20:10
Oh, these NASA computers :)
Silly me :oops:
I was afraid of this issue, the only solution which occurs to me now is:
FrameRate = (1/(ThisTime-LastTime+0.001))*1000
I know it's nasty a bit, but it should work even on NASA boxes :).
Thanks a lot, I'll update the file again,
Petr
ErosOlmi
13-11-2005, 20:52
Working fine, now.
I'm not in front of my NASA pc now.
In current PC (P4 2.8Gh, 1Gb RAM) frame rate is 65.
I will let you know frame rate on NASA one later.
Ciao
Eros
Petr Schreiber
13-11-2005, 21:09
Thanks for info,
I'm getting the 65 - 100 FPS too on my box ?! ( Duron 850MHz, 320 MB RAM, Radeon 9600 @ WinME ). I'v discovered that XP's "eats" some performance in some cases :( - but not in case of your NASA one :D
Thanks,
Petr
ErosOlmi
13-11-2005, 22:24
Well I think the hard work is done by the OpenGl driver and the graphic card.
My NASA box is an AMD Athlon 64Bit 3700+. It very fast. Graphic card is a Radeon x600 pro with 256Mb and here SpaceShooterGame.tBasic runs at a fixed 100Fps .
Good work.
Eros
Petr Schreiber
13-11-2005, 22:47
:shock: Well, that's really NASA configuration !
You're right about the OpenGL driver and graphic card. In the early times of XP's the drivers were bit weak, so that was the XP-performance-eater cause.
Now it seems OK, we'll see what kind of surprises the Windows Vista will bring :)
Thanks,
Petr
RobertoBianchi
14-11-2005, 19:15
Hi Psch,
I'm amazed, great!
It's very exciting build it a bit at time isn't it?
Bye,
Roberto
Petr Schreiber
14-11-2005, 20:37
Thanks Roberto,
Although I'm not sure I fully understood your second sentence ( I'v to learn english more :oops: ), IF it means that it is cool how simple is to make a small game in thinBASIC THEN MsgBox 0, "I agree :)"
Thanks,
Psch