PDA

View Full Version : tbgl spaceFocus example :)



Lionheart008
05-11-2008, 21:44
hi all :)

...may be a beginning of an advanced tbgl example and learning tool (sphere environment mapping!) with view scene filtering and use arrow keys to accelerate cylinder, cube, pyramid objects (push space bar!) and a filtering mode with...'L' and 'F' buttons... thanks to an old nehe lesson...

- I have built two new pictures (from fantastic 'hubble' telescope!) for the tbgl scene, one picture with an effect... fullscreen modus, you can close the window now (X-button) or escape it and much more ;)

- for me a little good start to my upcoming little game to use textures and effects...

- I think it's good to learn step by step and push the knowledge in various examples ;)

- I will make my little first game with my own power :-) and perhaps include some emitter functions too when I have fetched this knowledge ...

best regards, good evening, Lionheart (Frank)

Petr Schreiber
05-11-2008, 22:21
Hi Lionheart,

nice example!
Just one thing, important especially for games - do not forget to scale movement to frame time or frame rate, else it will run at different speed on different PCs / resolutions.


Petr

Lionheart008
06-11-2008, 18:54
dear petr..., hi all...

pardon: little silly question... but important for starting my little game with tbgl entities...

1) - it's necessary for getting a fully scene background for a tbgl entity to texture (mipmap) the background with (with coordinates) an object (quad, rectangle and so on) ??? Is there another way possible?


' Simple texture loading; just name, index and quality
tbgl_LoadTexture "Textures\hubble_v838.bmp" , 1, %TBGL_TEX_MIPMAP
tbgl_LoadTexture "Textures\space_1Environment.bmp" , 2, %TBGL_TEX_MIPMAP

' This enables texture mapping generally
tbgl_UseTexturing %TRUE


- qt: how can I do this stuff with 'entities'? Anybody has an example for me??? would be very nice :D

- simple example 'background-tbgl' I add here as zip file... and the texture as bitmap... :)

hmh, find no way...


- Does this code line exist for fully tbgl background scenes ??? it does function, but other objects disappear... why? :)

2) I have tried this one with another tbgl example...


' -- Load our textures
tbgl_loadtexture app_sourcepath + "hubble_v838.bmp", 1, %TBGL_TEX_MIPMAP
tbgl_loadtexture app_sourcepath + "FlashArt1.bmp", 2, %TBGL_TEX_MIPMAP
tbgl_loadtexture app_sourcepath + "hubble_v838_woelbung.bmp", 3, %TBGL_TEX_MIPMAP
'- tbgl_loadtexture app_sourcepath + "space_1Environment.bmp", 4, %TBGL_TEX_MIPMAP


' -- Cache sphere
tbgl_NewList %lSphere
tbgl_Sphere 1
TBGL_EntitySetPos(%sScene, %eSphere, 0, 0, -20)

tbgl_EndList


this code part fill the whole scene as background (sphere), but no other objects are visible... ???

ciao, Lionheart

Petr Schreiber
06-11-2008, 20:57
Hi Lionheart,

this part of your code:


' -- Cache sphere
tbgl_NewList %lSphere
tbgl_Sphere 1
TBGL_EntitySetPos(%sScene, %eSphere, 0, 0, -20)

tbgl_EndList


... this is something very esoteric. %eSphere and TBGL_Sphere 1 has nothing in common.

But I have solution for your background problem, see attached script :)
How does it work? See in the code, but scheme is here:


Clear Frame
Setup2D mode, disable depth writes
Draw full screen quad

Setup3D mode
Draw scene as usually
Draw Frame


or



Clear Frame
Draw full screen quad

Setup3D mode
Draw scene as usually
Draw Frame


Hope you like it. There are 2 functions at your service, the first system stretches whole bitmap to fit window, the second centers the image and keeps its size.


Petr

ErosOlmi
06-11-2008, 22:42
It seems directly taken from "Event Horizon (http://images.google.it/images?hl=it&q=event%20horizon&um=1&ie=UTF-8&sa=N&tab=wi)" fiction.
:D

Petr Schreiber
06-11-2008, 22:49
Brrr,

that was quite disgusting movie, but I liked it somehow ;D

ErosOlmi
06-11-2008, 22:51
Lionheart,

thanks for taking advance of new UI callback functionalities.
TBGL + UI callbacks seems doing together a very nice job.

Ciao
Eros

Lionheart008
06-11-2008, 23:56
hi petr, hi eros, all :)

@eros: very interesting site ;) but I like and love the Hubble telescope... I don't know the movie, sorry ;)

- I have managed it with the background !!! Here is just a first preview of my "Save-our-cites" game... vol 0.001a

- I use new UI and TBGL features so I can... ;)

- hmh... not so good: I have got a strange string of pearls including my orion nebula background ... I check it tomorrow ...

here a little preview as a picture...

- therefore I can see what tbgl is good for: create simple or advanced game that makes fun and it's an amazing work, have many ideas for new features or effects.. I will make some experience with it, I am sure...

- strange behaviour: I cannot bundle my script example with models and texture... with thinair... don't know why, I try it tomorrow again...

good evening...

lionheart cruising around space and looking for more evil enemies ;D

ps: "UI" feature question... How can I fetch (get) the properties of objects?
Only by "listview" ??? I would like to make an info button about the scene with all objects...

ErosOlmi
07-11-2008, 00:14
ps: "UI" feature question... How can I fetch (get) the properties of objects?
Only by "listview" ??? I would like to make an info button about the scene with all objects...

For the moment I think you have to work with ListView but I think I will be able to give something more in few weeks on this side but better not to talk about it now ;)

Lionheart008
07-11-2008, 00:29
hi, it's very ok... :) I can wait and I am very curious to see that feature ;)

- my thinair problem: after creating a bundle of my scene thinair say good bye to me...

- after restart and load a scene I cannot run the script... and have got this error message:

=> two pictures of error message of 'thinair module' I add here...

the other picture of event horizon... :) I like these two actors very much and I will rent it from my video base to see the film ;D

- I will run the setup of thinair a second time to see what happens...

good night all :), lionheart

Lionheart008
07-11-2008, 01:40
hi all:)

perhaps the 'bundle' does run, I don't know, because my thinair module has caused some trouble for me last minutes... I hope it works well :)

I have created a first preview of my little 'save our cities' game... (DEMO), it's just simple taken, no effects, no game levels, nothing (must laugh) spectacular but with some new feature (tbgl background), some new features (UI and TBGL) will come with 'open new window', button "info" works, but start game button is still quite a really dummy ;)

I will create a new thread for the game, all work in progress... I have a lot of new ideas and perhaps I can use it with the new power of thinbasic 1.7.0.0 ;D

The Storyplot will come at a later moment ;)
here only a short cut:


- I would like to make a little game with two space ships (good and evil one) landing on a green-blue

planet (with atmosphere, energy shield) like earth with some big cities... and some robot missiles are

coming out of the big hangar of the evil space ship (landing near a big rocky mountain with a sea around)

and starts to destroy the city...

- the other space ship (little and good one) have powerful green and blue laser weapons (healing energy)

and destroy the energy shield of the big space ship and all the damned missiles ;) and save the big

cities to the formerly status quo...

- when the energy shield of the cities and the evil space ship is on (yellow, white one, not fully

transparent) the big space ship cannot landing on the blue planet, but it's a time question when attack

the big cities with the missiles...

- so the little space ship must help...

my last 'minefield' example with your mainly code (yes!) is perhaps a good entity basis... for the "Save

our cities" game. I have done last evening an example with an old nehe lesson to make new texture

exercises what is perhaps good for the game... and when I have more knowledge I would like to build in

emitter functions...

more will come, I have just this little idea, but would very like to build it..

good night, good morning, Frank


- thanks a lot to petr for the new tbgl background code ... :D never seen it before...
- please take attention to the attachment, I don't know if it's work ???

ciao und servus, Lionheart (Frank)
ps: don't forget it's just the very beginning of the little space game ! ;)

ErosOlmi
07-11-2008, 02:31
Frank,

can you please restart your PC, remove all recent 1.7.0.0 preview installations and delete all thinBasic files from thinBasic installation directory (except your own files).
Than install again latest 1.7.0.0 preview?

I've double checked again in different computers and all seems fine.
Maybe all recent refresh of preview version have left something not in health condition.

Let me know.
Eros

Petr Schreiber
07-11-2008, 08:53
Hi Frank,

it seems the attachement does not contain any textures or models, just EXE which feels lonely without this resources.


Petr

Lionheart008
07-11-2008, 19:12
Hi all, dear eros, petr:)

seem to be that my pc has its own head with thinair/thinbasic and so I have started to bundle my "save our cities" script and have got some very strange messages, but the bundle works, don't know why I have this error messages while bundling my script...

please do me a favour: test the demo example (SaveOcities5c.exe), if it does function on other machines, say it to me, would be very nice... so I can forthcoming with the little game project... :D

best regards, Lionheart (Frank) good evening... more will come...

Michael Hartlef
08-11-2008, 14:36
No. It doesn't run correctly on a Windows Vista machine. After your introduction via that dialog it reports


Error code 500
Module specific error. see aditional info
Line number 120
Linde code

Token found: End of line
Additional info: Can't locate model file <a very long file path, to long to write down here>

I guess it can't locate your model file. Then it opens an empty screen. Close button doesn't work.
Only pressing the X is closing the window.

Lionheart008
10-11-2008, 23:52
dear michael, petr, eros, hi all :)

- this new 'tbgl/ui' demo-version of 'save our cities' (SOC) includes the exe and all models... I have done a little mistake and forgotten to include all models and textures with the file, sorry... but it was the first try of creating such a complex folder...

- show you the first 'save our city' preview with the exe file including the zip folder...

- hope you can see, what direction I would like to go... there are still missing some objects and planets and zooming inputs, but it will come, I am sure :D I am on the right way... thanks for feedback and help until today ;)

new input for tbgl/UI :

- mouse xyz-coordinate system function (move mouse over scene) included ! :)
- open newG button (push this button), it opens a new "x-men" dummy window you can close, but it was a good exercise to build it ;)

more functions and scene input will come as soon as I am fit again, all work in progress :)

best regards, Lionheart (Frank)

:) wish you all a nice evening... a new thread will follow...

Lionheart008
11-11-2008, 19:40
:) hi all...

how can I build in a correctly way a 'zoom function' into entity scene???

I have tried this one... (still without success)...

dim Zoom as single = 2.5

1)

' -- Create camera to look from 5, 5, 5 to 0, 0, 0
TBGL_EntityCreateCamera(%sScene, %eCamera)
TBGL_EntitySetPos(%sScene, %eCamera, 5, 5, zoom) ' -5
TBGL_EntitySetTargetPos(%sScene, %eCamera, 0, 0, 0.1) ' -0

and then...

2)

If TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE) Then Exit While
If TBGL_GetWindowKeyState( hWnd, %VK_LEFT) Then yRot += 60/FrameRate
If TBGL_GetWindowKeyState( hWnd, %VK_right) Then yRot -= 60/FrameRate
If TBGL_GetWindowKeyState( hWnd, %VK_Up) Then xRot += 60/FrameRate
If TBGL_GetWindowKeyState( hWnd, %VK_Down) Then xRot -= 60/FrameRate

if tbgl_GetwindowKeyState(hWnd, %vk_pgup) then Zoom -= 0.2 ' Zoom Out
if tbgl_GetwindowKeyState(hWnd, %vk_pgdn) then Zoom += 0.2 ' Zoom In

don't know if I am right, but the my little exercise scene doesn't run as well as I wish...

the problem may be with the entity camera... or I need other things... perhaps somebody has done just such an example with "zoom" functions... need help ;)

bye, Lionheart, no more freezing :)

Petr Schreiber
11-11-2008, 19:54
Hi Frank,

implementing zoom as shifting camera forward has one disadvantage - it does not prevent passing throught objects for example.

More suitable for this job is manipulation of field-of-view. This functionality is 99% developed, lying on the HDD of PC which I have currently in service ( already! I hope I will get it back soon ).

If it is acceptable for you, better to wait for simple TBGL_EntitySetFOV than struggle with it more.


Petr