PDA

View Full Version : TBGL+3d-Engine



ReneMiner
19-02-2013, 21:15
I was browsing for some good and easy to use 3d-Engine to combine with TBGL since the most of them don't have built-in Basic-language.

I found some list at http://devmaster.net/devdb/engines which gives good overview and where is actually some sorting function to specify which features, OS and stuff the engine should meet that will spit out eventaully some engines then. But I don't know what to look for (except stable/active, windows & openGl) and how to get it running in TB later on...

It's like I want to use the vacuum cleaner but seems I don't find the right model and I'm to stupid to plug it in, not even to talk about turning it on...

So maybe one of you has some suggestion?

EDIT:

Petr and I chatted about TES-CS and I just give some overview here:

A combination of this >>>link to large picture of it (http://almanach.scharesoft.de/images/6/6c/TES3_CS.jpg) and thinBasic would be somehow the stuff of the Developing-Environment of my dreams.

The Object-Window there holds basically a list of 3d objects (entity-templates, meshes), classified into stuff like Statics, Activators (which can be statics too but they can have a script and can be activated in game somehow), Bodyparts, Weapons etc.
Armor, Clothing and NPCs get combined by Bodyparts there - onto some raw bone-animations... but that's already too much detail for now...

The Window captioned "Gnisis -10, 11" shows currently an exterior-scene from above in 3d

(there are two kinds of scenes: Exteriors in Game get combined of the current scene plus the 8 "surrounding" scenes to the actual scene.
(scenes are called "Cell" there) and the "Exteriors" make basically an infinite world map (in the current worldspace) on a grid build around Cell 0,0 of that worldspace, so thats why it has -10,11 here, Gnisis is the name of a city in the game. So the window shows Cell "Gnisis" -10,11, - this is the older version there it does not have more than one worldspace
Interior-Cells were used for Dungeons, in-House-Scenes, Caves, in ships, even large cities divided by walls,...all what you can think of...

Into this 3d-Window the user can drag an object-ID from object-window-list into the scene (then can double-click the displayed model and define this references position, rotation etc)
In the Cell-View-window below you have a list of scenes on the left and a list of objects-references ("Entities") which are inside the current displayed scene.

On the top of the Main-Window itself you see a button-bar, as there were Load, Save, Editor-Properties, Undo, Redo, Snap to Grid, Snap to Angle, switch to terrain-edit, edit pathgrids, turn on/off lights and fog, edit NPC/Creatures dialogs and Journals, and very important: the yellow pen: Edit Scripts, click there will open some texteditor with an included pre-compiler for those scripts, plus the speaker to edit sound-resources (name them, set filename etc.)

So almost anything (but Bodyparts, levelled stuff and statics) can get attached a script that fires in-game every frame if a reference of an object which wears the script is inside the current scene. So if i write in the script attached to some object

Move X, unitsPerSecond

this statement affects the object-reference in the current scene which wears the script. So this script is usable for similar items like rotating gears, lifts or whatever.
if i would write

ObjectID.Move X, 20

I would move the one unique Object wearing "ObjectID" as an identifier.
That means it has to be a global reference (here "Persistent" - that's why you can read Persi... somewhere in object window)
Scriptcode is almost Basic-like but has just:
begin "scriptname"
if(test)
elseif(test)
else
endif
while(test)
wend
return (=breaks script execution for this frame)
set var to (value)
end "scriptname"
startscript "scriptnameX"

if (scriptRunning "scriptnameX")
stopscript "scriptnameX"
endif

defining of local floats, longs, shorts (no strings) is possible, they are static to the reference but accessable "from outside" on persistent references like
"set myObject.Var to 123", the older syntax for the same would be "set myObject->var to 123"
there are methods for 3d-movement and positioning, to play sounds and a few more, of course a lot of the game-specific stuff like "HasItemEquipped" and "GetJournalIndex"
There are also global scripts possible which can get started from the global running main-script or from a global object reference.
Can even start an additional script from a non-persistent reference but it will stop if the scene changes. While-Wend loops don't work in pure global running scripts.

If you read the tabs on the object window you saw the objects-types already, mostly it's game-specific here,
Leveled-Items or Leveled-Creatures are lists consisting of other objects (to spawn enemies at player-level and so he doesn't find the best sword in the beginning, random enemy-equipment, random leveled loot etc.)

Doors are special connections between scenes and have some additional pointer (doormarker) to a position inside any scene: If the player passes the door he gets positioned at the doormarker of that certain door. You see a few of them in the scene, the pinkish arrows (they're invisible in game)
So one has to create always two doors and position 2 doormarkers to get the connection working...

Books are items where player can read - so GUI changes in-game and displays text, but books have a world-model + inventory image too. Lights are objects that can have a model or not and all that get's just dragged and dropped into the current scene to edit. Spellmaking is some in-game magic-effects that you can combine to "Spells" which can be castet by creatures, npcs and activators (also from doors, containers and lights which are just special kind of activators), Enchantments are spells that can be applied to weapons, clothing, armor, books...

If you would right-click on some listed object an object-class-specific dialog would open where you can set properties to all objects of that kind, attach a script or you can choose to create a new object, make a copie of the current etc.

It lacks of supplying a simple Mesh-Editor (I wrote my own one though in those days) and you can't alter the terrain-mesh nor textures in a scene while the game runs.
I always had fun using this - in the meantime 12 year-old-thing and always thought that Basic would evolute this object-oriented 3d-way and I was very disapointed that for example microsoft went the visual-.net-way instead of going for the visual 3d-way and I thought purebasic, which I bought in some store in 2005 would work this way but it did not- images on the package did show some running example-program but not the IDE so I felt ripped off. I felt even more ripped of when they refused me to update to the new version since the package promises life-long-right for updates...
So the kind of Visual-fullyOO-3d-Basic I dream of doesn't exist yet, although thinBasic + TBGL-Scene & Entity-System might be a good point to start from.

Petr Schreiber
19-02-2013, 23:34
Hi Rene,

I am not sure how it is always possible to intermix 2 engines together, but here is general advice on how to make "some" technology work in ThinBASIC:

download the library in DLL form

the DLL should be 32bit, built for Windows x86
the DLL should not be DLL with C++ classes, it should contain procedural interface only

on the website your linked, the search criteria is made like "C/C++" -> but C and C++ are two soooo different beasts!


*in theory it could be COM DLL, but the work with COM is not so comfortable in ThinBASIC


make sure to download some kind of header file as well, with definitions of the functions hidden in the DLL

translate these header files to DECLARE syntax suitable for ThinBASIC
store the translation of header in form of tBasicI file, which can you include later with any script




So far, I applied this approach to cutting edge technologies such as OpenGL, OpenCL or ODE, and it worked for me. General rule - if it runs from C, it will run from ThinBASIC too.


Petr

ReneMiner
20-02-2013, 00:07
problem is: I have no idea about c,c++ nor c# and what the differences are. I know just there's "if, void, int" and a lot of curly braces and semicolons.

While you answered I was editing my last post - used up some time - you posted before I was done editing, so that's the main reason why I post this reply.
It's about TES-CS, some mechanics and a picture of it.

Edit:
Looked around this morning a bit ... still no decision made...continue search, best I've found are currently G3D (http://g3d.sourceforge.net/) and PixelLight (http://pixellight.sourceforge.net/website/) - still alive and not outdated -, but I fear both (as most of them) have those evil classes

Irrlicht (http://irrlicht.sourceforge.net/) seems to provide the headers (even offers language-bindings to basic which would not be that complicated to fit thinBasic!)

-downloaded package and found the .dll-file in some subfolder already

but I didn't find out if it has classes yet! And I got nothing but a hex-editor to open this .h(eader?)-files :(
and just found out where to get the IDE (http://www.ambiera.com/irredit) -not exactly what I dreamt of... :lol:
"Irre" is kind'a crazy in german and "Licht" is light so Irrlicht means 'crazy as speed of light' - now you know what IrrEdit means too.

-damned- there are classes...

back to TBGL then: I fear the return values of functions as for eample


TBGL_EntityGetPos( SceneID, EntityID, X, Y, Z )


is just single-float-preciceness in X,Y and Z then?

Petr Schreiber
20-02-2013, 21:40
Hi Rene,

if you like Irrlicht, you can find some wrappers here:
http://www.thinbasic.com/community/forumdisplay.php?290-Irrlicht

I don't like this engine personaly, I am afraid the only game engine worth of study as of today is the Unity. It has ... all.

Regarding your worries - don't worry, be happy, because TBGL uses DOUBLEs.


Petr