View Full Version : hello
lydia_sp
27-07-2009, 15:04
hello, dear thinbasic people! I am new here. Want to learn a new basic language. Heard and see a lot of thinbasic, powerbasic and game development with basic. Perhaps I am here at the right place. I am interested in open gl graphics, little animation and colored icons for clicking for more menu features, you will say pop up windows. I have finished my school. Now I am learning a basic language. I am 19 years old, come from spain, father is a german guy !
I will do my best here to give more vital power and humour to the forum. I love dancing, singing and programming (learned at school java). I hope you are friendly people here so I will stay here. Now I have to read and try a lot of example to build my first code construct. Some day I will study game development. I need an easy to understand coding language to learn, so I have found thinbasic and see it's full of features and examples. I am glad to see such a lot of nice guys here, they are very engaged. I like that. hasta la vida, lydia
welcome, Lydia_sp here.
hello my young friend, yes, that the best place here to learn.
which kind of software would you like write ?
games or tools ?
i think that OpenGl is a good choice for you.
OpenGl is independent and flexible, makes much fun.
i do hope that i can see a result soon.
sincerely:
peter
Michael Hartlef
27-07-2009, 15:57
Hi Lydia and welome to the forum :)
You gave a really nice description of yourself and what you want to do. I like that. As you will see, we welcome everyone here with open arms. Right now it is a typical summer phase here, very quite and mellow. But so far thinBasic is a VERY active language.
We have users who create games with thinBasic and also people who work on applications. I'm more into game development to and try to help actively to push thinBasic's game development features. :)
Take your time to study the samples and the content of the forum. Feel free to ask any question. We are here to help you so don't be afraid.
Might i ask you where you heard about thinBasic?
Anyway, have a nice stay
Michael :)
Michael Hartlef
27-07-2009, 17:29
Ok, I'm back from work now and have a real desktop now infront of me :) Writing on my Google G1 isn't that comfortable when you want to write a lot.
As you might have noticed, thinBasic uses modules, to extend it's feature set. For developing games you should have a look at these modules:
TBGL - OpenGL based graphics module for 3D and 2D graphics. It features 3d models and sprites and is quite powerful
TBass - A sound module which interfaces the well known BASS library
TBDI - A directInput module to interface game controllers, wheels and joysticks. Force feedback support is included
There are a lot more modules you can use while developing a game, but these are the basic ones that should give you a good start. Of course you can directly code with OpenGL commands too, just need to include the opengl header files. In the TBGL sample folder of your thinBasic installation there are samples about that too. Also download the TBGL bonus packs which you can find in the TBGL section of this forum. There you can also find a BLENDER plugin that will let you export a model in TBGL's M15 model format.
And last but not least, visit Petr Schreiber's TBGL website (http://psch.thinbasic.com) for more info.
Ahh, before I forget, to use the new sprite commands of TBGL you need to use the latest beta version of thinBasic. you can get it here. (http://community.thinbasic.com/index.php?topic=2588.0)
Take care
Michael
lydia_sp
27-07-2009, 20:41
hi charming boys. I am at my best girlfriend. thank you for fast reply and info. :) would like to ask why thinbasic was created by so different modules? I see more than four, five, six modules. I am confused. Oxygen, tbgl, tbdi, console and lion? ff. I know applications with all specific features one-in-all. sorry about my english, it`s hard to write what I`d like to say. I will look at tbgl first, for me the best choice for entry. I am giggling to be around with so many guys. send you more as possible. thanks. lydia.
Michael Hartlef
27-07-2009, 21:00
Well, the reason why Eros Olmi created thinBasic the way it is, i don't know. I'm sure once he finds time he will explain it. Right now he is busy as hell with real life problems.
This module approach has the very big advantage that you don't need to distribute one big runtime with your script, only the modules that you are using.
Plus 3rd party developers like me can develop our own modules with PowerBasic, C++, FreeBasic, IBasic Pro, etc. to add more power to thinBasic.
And don't worry about your english. I can read it and am sure that others can read it too. This community is pretty multi national. Americans, italians, germans, english, czesh, etc etc. And spanish now ;)
Petr Schreiber
28-07-2009, 14:17
Welcome lydia_sp!,
thanks for your very nice introduction!
I think guys explained all the important questions already, so I will add just the following:
You can learn TBGL from the sources mentioned ( do not forget to use F1 on TBGL commands in ThinAIR to get context sensitive help ).
Another option which can be considered is trying TBGL Bonus Packs (http://www.thinbasic.com/index.php?option=com_jdownloads&Itemid=95&task=viewcategory&catid=5). They cover various topics - particles, physics, effects...
Next chance to learn ThinBASIC and TBGL is from ThinBASIC Journal (http://community.thinbasic.com/index.php?board=160.0) - it is downloadable PDF magazine covering the latest features of ThinBASIC, issue #3 is in the works.
And then of course you might simply try to start with simple games and ask for help here on the forum.
In TBGL, I can recommend starting with Scene-Entity system (intuitive handling of 3D primitives, cameras and lighting) or if you are more into 2D, then new, fresh Sprite system is very good choice too.
Which kind of games would you like to create?
Petr
lydia_sp
30-07-2009, 16:20
hi petr, thank you so much for help and infos.
here my first script with questions and I need help. Want to have two hunters.
and I cannot start your model viewer script for developer.
I like tbgl and I see all the great examples. I need one year to proof it :)
best regards, lydia
Petr Schreiber
30-07-2009, 17:18
Hi Lydia,
I am happy you started with TBGL, I hope you will like it!
In your script you created 3 boxes:
- one static %eBox
- one moving %eBox2
- one moving %eTarget2
The "problem" is that you calculate the Target2 movement in a way it is inside the sphere, so never visible.
Have a look at these two lines:
TBGL_EntitySetpos(%sScene, %eTarget, sin(GetTickCount/1000)*5, cos(GetTickCount/2000)*5,0)
...
TBGL_EntitySetpos(%sScene, %eTarget2, sin(GetTickCount/1000)*5, cos(GetTickCount/2000)*5, 0)
So if you want to see dos cazadores attacando dos objetos, simply make the Target2 box move different path, like:
TBGL_EntitySetpos(%sScene, %eTarget, sin(GetTickCount/1000)*5, cos(GetTickCount/2000)*5,0)
...
TBGL_EntitySetpos(%sScene, %eTarget2, sin(-GetTickCount/1000+5)*5, cos(-GetTickCount/2000)*5, 0)
Then there is one, just little problem, where Arrow2 was not targetting Target2, but simply Target.
You almost had it right, by calculating custom angle for it, but then you used the old angle.
I reorganized the main loop to separate targets and hunters from each others to look like:
' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
' Move targets
' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
' Target #1
TBGL_EntitySetColor(%sScene, %eTarget1, 128+sin(GetTickCount/1000)*127,128+sin(GetTickCount/1000+1)*127,128+sin(GetTickCount/1000+2)*127)
TBGL_EntitySetpos(%sScene, %eTarget1, sin(GetTickCount/1000)*5, cos(GetTickCount/2000)*5,0)
' Target #2
TBGL_EntitySetColor(%sScene, %eTarget2, 128+sin(GetTickCount/1000)*127,128+sin(GetTickCount/1000+1)*127,128+sin(GetTickCount/1000+1)*127)
TBGL_EntitySetpos(%sScene, %eTarget2, sin(-GetTickCount/1000+5)*5, cos(-GetTickCount/2000+2)*5, 0)
' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
' Hunters
' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
' Hunter #1 (%eArrow1)
' Get angle hunter-target
angle1 = TBGL_EntityGetAngleXY(%sScene, %eArrow1, %eTarget1, %TBGL_X)
' Slowly turn towards target
TBGL_EntityTurn(%sScene, %eArrow1, 0, 0, 10*angle1/FrameRate )
' Move towards the target, with speed proportional to the distance
TBGL_EntityPush(%sScene, %eArrow1, TBGL_EntityGetDistance(%sScene, %eArrow1, %eTarget1)/FrameRate, 0, 0 )
''---------------- lydia part :) //
' Hunter #2 (%eArrow2)
' Get angle hunter-target
angle2 = TBGL_EntityGetAngleXY(%sScene, %eArrow2, %eTarget2, %TBGL_X)
' Slowly turn towards target
TBGL_EntityTurn(%sScene, %eArrow2, 0, 0, 10*angle2/FrameRate )
' Move towards the target, with speed proportional to the distance
TBGL_EntityPush(%sScene, %eArrow2, TBGL_EntityGetDistance(%sScene, %eArrow2, %eTarget2)/FrameRate, 0, 0 )
' Hunter #3 (%eBox2)
' -- Get angle hunter-target
angle3 = TBGL_EntityGetAngleXY(%sScene, %eBox2, %eTarget2, %TBGL_X)
'' wrong si, si... but why? triangle must follow the box !!
TBGL_EntityTurn(%sScene, %eBox2, 0, 0, 12*angle3/FrameRate )
TBGL_EntityPush(%sScene, %eBox2, (TBGL_EntityGetDistance(%sScene, %eBox2, %eTarget2)/5)/FrameRate, 0, 0 )
''--------------------- fin lydia //
I attach complete code for you.
Model viewer :oops: - you are right, there was a problem (I forgot to prefix callback function with CALLBACK), I corrected it and you can download it from here (http://community.thinbasic.com/index.php?topic=2150.msg16123#msg16123). Thanks for reporting it!
Petr
lydia_sp
31-07-2009, 21:07
^^ you are a dear, petr. I never thought to get an answer with this kind of help. It`s great here ! and I love all the example thinbasic has delivered after installation. Don`t know if other basic languages can support their users with so many example for learning and studying. I am new here and its like you are dropping into cold water and see one million fishes swimming around you, one fish or shark is more interesting than the other.
petr. how can I build my framerate to show it in my scene ? what you can recommend for collision or saying the box collide with my triangle. this is my idea for progress. do you have one link or example for study?
have had a really nice day at the beach. now I have to learn more. I like this board. thank you guys. its a pleasure to get such help and infos. thank to all.
lydia
Petr Schreiber
01-08-2009, 10:50
Hi Lydia,
I am happy it worked! I also recognize somebody can be confused by the amount of sample code, available on multiple places. The direction for future will be to have everything on one place, carefully labeled and divided to various interest areas (something like Bonus Pack sections of different areas).
Displaying frame rate is simple, you have multiple options:
1) As your example is rendered in dialog, you could simply print the info to some of the controls or dialog title
2) Use TT font rendered inside TBGL window
3) Use bitmap font rendered inside TBGL window ( hint -> you can create bitmap fonts easily using TBGL Font Creator (http://community.thinbasic.com/index.php?topic=1024.msg6811#msg6811) )
Ad 1)
To set frameRate to control, you can do it like:
control set text hDlg, %control, format$(frameRate, "#.00") ' -- 2 decimals
To set frameRate to dialog, you can do similar:
dialog set text hDlg, format$(frameRate, "#.00") ' -- 2 decimals
Ad 2)
To use TT fonts inside TBGL, you do the following:
- build the font ( that means, create set of OpenGL compatible character primitives )
TBGL_BuildFont TBGL_FontHandle("Arial", 9)
- print it at any 3D location
TBGL_PrintFont format$(frameRate, "#.00"), 0, 0, 0
- you could also print it in "2D mode", but you have to set such a mode first using TBGL_RenderMatrix2D
Ad 3)
- you create the BMP file using mentioned font tool
- you load it
TBGL_LoadBmpFont "myFont.bmp"
- you can print it on the screen later like:
TBGL_BeginPrintBMP
TBGL_PrintBMP "Information on frame rate:", 1, 1 ' -- Column = 1, Row = 1
TBGL_PrintBMP format$(frameRate, "#.00"), 1, 2 ' -- Column = 1, Row = 2
TBGL_EndPrintBMP
So you can see the options are multiple each having its advantages. The control/dialog way is simple, but not very stylish and also little slower, TT font provides best quality and you can use it for both 2D and 3D positioned printing and latest BMP font allows you to position text like in console applications - using column/row.
To see example of #2 and #3, please have a look at:
SampleScripts/TBGL/TBGL_0220_Samples/4n4Fonts/TBGL022_MultipleFonts.tbasic.
It shows that you can use 4 TTF and 4 BMP different fonts at the same time ( dangerous mix :) ).
Regarding collision - TBGL provides some basic functions to be used for collision, but I am currently working on more comfortable system, providing bounding boxes and bouding spheres attachable to entities directly.
Still, if you need at least approximate collision now, you can try few interesting approaches:
- measure distance of 2 entities, and if it is too small consider it "collision"
- track "points of interest" on the entities using TBGL_EntityTrackPos and do the similar distance based test
I attach for you modified code showing how to print in 3D and how to do very elemental collision check.
If you are not in hurry, please wait for a while before I develop more advanced collision functions, it is already work in progress and it should save you some time coding.
Petr
P.S. Side note on frame rate. In your example, it won't be very high, because the display is pumped using timer.
This is approach I recommend - you let the PC breathe a bit. Of course, you can code tight loops in ThinBASIC to get maxximum out of the GPU and CPU performance too, when you need it.
Michael Hartlef
01-08-2009, 11:46
Petr,
is this the current version of the FontTool? I think on SVn you have a more advanced version. Or am I wrong?
Michael.
Petr Schreiber
01-08-2009, 11:55
Yes,
you are right, I just updated the post with last version of the tool :shock:
lydia_sp
01-08-2009, 13:36
hi petr and mike, thank you for help and infos again !
my pc makes some trouble at the moment, dont know why. I will test script example this day again.
@mike: do you have any example for sprite and collision ? sounds interesting for me. sorry, but I have still problems to orientate here at the board like a unknown djungle :? good idea, petr to collect everything at one place. a place for beginners and their needs and faq`s would be also nice.
saludos, lydia
Michael Hartlef
01-08-2009, 16:22
hi petr and mike, thank you for help and infos again !
my pc makes some trouble at the moment, dont know why. I will test script example this day again.
@mike: do you have any example for sprite and collision ? sounds interesting for me. sorry, but I have still problems to orientate here at the board like a unknown djungle :? good idea, petr to collect everything at one place. a place for beginners and their needs and faq`s would be also nice.
saludos, lydia
Sure, i am out now in cologne but when i am back tonight, i will write something about it.
Michael Hartlef
01-08-2009, 22:35
Hi,
Here is a link to sample scripts:
http://community.thinbasic.com/index.php?topic=2728.0
There you find a few ones that use the collision too.
And here is a sample game that I made to show off the new sprite commands:
http://community.thinbasic.com/index.php?topic=2737.0
The download link there contains the bundled game. You can find the source here:
http://community.thinbasic.com/index.php?topic=2738.0
Cu
Michael
lydia_sp
06-08-2009, 13:24
hi michael, thanks for the links. I am for some days in cologne, holidays. I will explore sprite examples at week-end. at the moment I prefer sun bathing. then I will make a feedback if I understand all the sprite tbgl features. thank you, lydia