PDA

View Full Version : TBGL possible project ?



ErosOlmi
01-05-2008, 15:46
I found the attached project made with PureBasic and a Irrlicht engine wrapper.
It seems very doable also in TBGL. What do your think?

Eros

holomind
01-05-2008, 16:30
Hi, why do it in TBGL, you only need to add the dll-call wrapper functions "define... alias..." then you can use the exact same irrlicht calls. .no need to reinvent it in TBGL (which itself is only a wrapper to real gl-functions and therefore quite similar to irrlicht in terms of architecture).

Thanks for the example, i visited the irrlicht website some days ago and didnt understand how to use their language-wrappers. but as this comes with a dll+wrapperfunctions its as easy as using gdi.dll or opengl.dll.

Petr Schreiber
01-05-2008, 18:49
Hi Eros,

nice game, I like especially the "aaargh" sound :D

The visual style and controls are very nice, I think definitely doable in TBGL ( or as Holomind likes, the Roberto Irrlich wrapper could serve too ).



no need to reinvent it in TBGL (which itself is only a wrapper to real gl-functions and therefore quite similar to irrlicht in terms of architecture)


When I read this I had tears in my eyes ;D
TBGL is not just wrapper... and in fact it goes more low level than Irrlicht.
I am sorry you feel that way, but I understand you, as you joined forum in time in which I am not in best coding shape to spark out the best of TBGL :) Reinventing wheels is sometimes good for learning.

Irrlicht makes lot of things easier, but for such a simple project as arkanoid is, I think TBGL would be perfectly enough ( entity/normal system could be used ).
Give me few days :)


Petr

Michael Hartlef
01-05-2008, 20:12
Petr, keep up the spirit. You are doing an awesome job on TBGL and for me it is the number one choice for thinBasic.
I also prefer to have the creator of an engine working with the same language I use.

Holomind, are you sure that it just needs some defined dll functions to use Irrlicht, or is there more involved to it?
My guess is that you have to fight with C++ to use the Irrlicht classes and then create a wrapper DLL just like Robeto did.

Petr Schreiber
01-05-2008, 20:38
Petr, keep up the spirit. You are doing an awesome job on TBGL and for me it is the number one choice for thinBasic.


Thanks for the nice words Mike :)


Petr

holomind
01-05-2008, 21:26
When I read this I had tears in my eyes ;D
TBGL is not just wrapper... and in fact it goes more low level than Irrlicht.
i didnt mean to offend you, but for me they seem to be similar architectures/techniqes. Also i need to understand what the benefit of using TBGL instead of pure opengl/wgl/glu/glut etc. calls is.
Helper-functions to make programing easier and more highlevel is not bad.

One very important Point of TBGL is, that it was the first "language" for me to get some Opengl examples running in an easy way, also the syntax of thinbasic is better readable than c++.

Functions like TBGL_LoadTexture() makes it much easier for a Opengl-Beginner. But sometimes i am confused as some functions in TBGL really seem to only reflect the original opengl or glu/glut function but uses a different name.

For example "TBGL_BeginPoly" equals "gl_begin()". But i guess the Sligty modification of Functionnames makes more sense (as this is used to draw polygons) maybe the tbgl-function-names are more descriptive. (it could be helpful to write in the documentation if this equals some pure opengl or glu/glut call. ) because there are more opengl-tutorials than TBGL-Tutorials. which means the gl_* function-names are more common to somebody learning "real" opengl. But without looking under the hood of the gl_engine. using TBGL is more easy to do gl-programming.

holomind
01-05-2008, 21:36
Holomind, are you sure that it just needs some defined dll functions to use Irrlicht, or is there more involved to it?
My guess is that you have to fight with C++ to use the Irrlicht classes and then create a wrapper DLL just like Robeto did.


But the irrlicht.dll is already in the sample project that eros posted, a dll is "generic" and can be used from within each languages that supports dll-calls. (i even can use this dll within AHK). the only work to do is to write the Wrapper-Definitions inside thinbasic. The only obstacles could be that you get wrong datatypes back from the dllcalls or you need to pass parameters as structs/complex values instead of integer or strings.

you only need to add the declare function to your thinbasic script and then can use this functions directly. (thats the way it would work in AHK, and i guess the same for thinbasic , or also VBasic which uses a similar syntax) you also need to define some contstants which are Irrlicht specific.



DECLARE FUNCTION IrrlichtFunction1 LIB "Irrlicht.DLL" ALIAS "IrrlichtFunction1" (BYVAL hWnd AS DWORD, lpRect AS RECT) AS LONG




No C++ Programming involved at all. (Correct me if i am wrong, but thats the way i use GDI and opengl in AHK).

like here: http://community.thinbasic.com/index.php?topic=1690.msg12337#msg12337

P.S. it seams it is not so easy because there are hundreds of functions inside irrlicht.dll and you need to find the functionnames to use them with "Declare Function". (irrlicht.h : instead of defining the main irrlicht functions directly its only a file which includes lots of other functions. )
http://irrlicht.sourceforge.net/docu/irrlicht_8h-source.html

ErosOlmi
01-05-2008, 23:29
TBGL is the choice for thinBasic. Irrlicht is good but it is not thinBasic module, we do not have the sources, we cannot implement. TBGL is here with us ;)
Just for the record Irrlicht is implemented in pure C++ so no way to use other than creating a C or C++ wrapper that exports functions. Making a personalized wrapper is possible, there is alraady a FreeBasic version that can be quite easily portable to thinBasic. But this is not what I want.

I posted this example because I feel that this game can be a good example for a new common project developed together in forum like what happened for TopDow. We now have entities in TBGL and also other moduels (TBEM module for example) that can be usefull. I see the possibility to develop a general game engine able to load some data files containing game levels developed as data info. Just ideas just in case there is some spare time available. Sounds, big nice graphics, candies can be a secondary. Importand is to have an arena and the main functionalities as general as possible and able to load game levels from external files that must be easy to be created.

Just sparse ideas.

Ciao
Eros

kryton9
02-05-2008, 02:25
I am always confused about wrappers and what can and can't be done.
For instance, how come we can write something as Holomind wrote to use Windows functions in dll's, but for other dll's a module has to be written?
I don't understand what makes the difference?


Irrlicht is very nice. I am learning c++ and irrlicht and think it is a very nice combo and a good reason to learn c++.

TBGL can do so much. I just wrote earlier to Petr that I found some more projects of his I never saw in the bonus pack.
He as a guru and mastermind of tbgl can do so much, it boggles the mind as many of those examples show.

About taking time to develop a game right now... I guess we sort of decided to give Petr time to finish school and then to add more to tbgl over the summer.
Once he has all he has planned finished, something like this should be very easy to do. Probably could be done even now. But better for Petr
to spend time adding features I think.

We still have topdown to finish in the future, so many games will spawn once we get that going I would think :)

Michael Hartlef
02-05-2008, 10:47
No C++ Programming involved at all. (Correct me if i am wrong, but thats the way i use GDI and opengl in AHK).



As long as you don't need to interface functions inside a CLASS definition, then you can do that. Can you post a link to this wrapper file for freebasic? The zip file of the game Eros posted doesn't inlcude it.

RobertoBianchi
02-05-2008, 13:00
Hi,

I made a just sketched C wrapper for C++ Irrlicht classes but as usual the development was stopped because it seemed not interesting to anyone of ThinBASIC community.
Michael, I agree 100% with you, problems begin if the game needs to interface functions inside a CLASS definition otherwise is quite simple to develop it with a wrapper.
Just one example of a big problem is handle the special input (from keyboard for example) because some Irrlicht classes are working with callbacks and obviously this is quite complex to do with an interpreted language (although in the meantime the module Asmosphere Assembler was added to the ThinBASIC arsenal and it can really be a great help).

Roberto

Petr Schreiber
02-05-2008, 14:13
i didnt mean to offend you, but for me they seem to be similar architectures/techniqes


I am not offended, just sad/amused the concept of TBGL = just OpenGL wrapper is frequent misconception. I hope with more samples and articles this will be clarified.
You are right some commands are 1:1 wrappers ( especially the first introduced years ago ), but they are not the "base" of TBGL.

Regarding CLASSes, is there any standard in their memory representations, as is with UDTs ( which match structs from C nicely ). Or each OOP language implements it in own way?

The idea of arkanoid... I think it would be great if it could use TBGL+TBEM+TBDI+TBASS. TBEM has so much power which has not been fully revealed yet...


Petr

sandyrepope
02-05-2008, 15:31
I'm unable to get arkanoid.zip to download completely. Where did you find this file?

Thanks
Sandy

matthew
02-05-2008, 15:55
I believe you can get it here (http://www.purebasic.fr/english/viewtopic.php?t=28803&sid=2bcd433b85c14a2871a624f7c1fa96df) Sandy.

sandyrepope
02-05-2008, 22:35
Thank you! I got it.

Sandy

Petr Schreiber
06-05-2008, 19:28
Hi,

here is very early version, just bat and the ball.
Ball AI is calculated in function launched by TBEM module.


Petr

ErosOlmi
06-05-2008, 20:11
And it seems a perfect start :-*

ErosOlmi
06-05-2008, 21:50
Petr,

just few ideas better to talk from the beginning (not a must of course):

consider an easy way to build levels in order to be easy for others to participate to the project. More or less something similar to the text files you created for Labyrinth project. It was very clever. Also every bricks should have its own peculiarities like number of hits for destroy, fixed or not, surprise brick, way of destroy of bricks, ...
consider the possibility of bonus so more than one ball at the same time can be a possible bonus. Like Robot Duel bonus.
consider the possibility to have different shapes for racket (sorry do not know how to call player)
consider the possibility to have different arenas shapes, backgrounds, music


Ciao
Eros

kryton9
06-05-2008, 22:25
Hi,

here is very early version, just bat and the ball.
Ball AI is calculated in function launched by TBEM module.


Petr


Here I thought I was good... I was hitting the ball with the bat for a couple of minutes and then realized the ball automatically bounced :)

Petr Schreiber
06-05-2008, 23:07
Thanks for the ideas,

all very nice and realisable, I think.
Kent, if you hit the ball with the racket/bat ( what is the proper nameee :D ), ball changes color, else not.
So you can check your reflexes even now :)


Petr

kryton9
07-05-2008, 03:21
Petr, those terms all could be used, but since breakout came out when there were atari controllers, those controllers had paddles.

So usually in this type of game the bar is called a paddle, also think of ping pong table game or even arcade game, paddles are/were used.