man i am really luvin working in Blitz3D now since i got this OO engine up and running... once the basic underpinnings of the engine were coded in place, 'classes could be created and objects instantiated from those classes...
it's amazing to see the results of implementing a new 'class' and adding an instance of that class into the game... just yesterday i was fitting out one of the submarine 'classes' i created... adding the diveplanes, rudders, the periscopes, and the propellors... and it was really facinating to see these things appear on each of the subs (there were two sitting around on top of the ocean) as i ran the test app...
and since the basic functionality of the submarine has already been implemented and tested, it only took a line or two of code to tie that functionality in to the new parts (rudder rotates in the right direction, dive planes tilt and rise)...
i don't see any way i could've gotten this far in the time i did without resorting to this object oriented style of coding... so far, everything is hanging in there, and the engine seems to be able to handle everything i throw at it...
actually, it's Blitz3D that seems to be handling everything in stride... the OO Engine itself is a series of loops that should, by all rights, have killed Blitz a long time ago :)
but i'm getting a lil bit ahead of myself... first a lil about this marvelous creation :)
OOBlitz3D is a source code engine that provides a means of creating objects from classes, by using Blitz TYPEs to create a defacto object oriented coding environment... all the developer has to do to create a minimal 3d game is...
1- add a global declaration for a .tGame object (yes, even the game itself is an object) like this...
Global theGame.tGame=createGame(1024,768,32,WINDOWED_ALWAYS)
2- add an include statement for engine.bb
Include "../samples/OBGameEngine.bb"
3- and code an empty function called theGame, like so...
Function theGame(this.tObject)
End Function
End
... and that's all there is to it.
a 3D window will open with a default tPLAYER instantiated, looking thru the default tVIEW object, at the default tSKY object...
now to dispell a common misconception most people make right off the bat... the player is not the lil guy you see running around in the game, the PLAYER is the person outside the game who is actually playing it... the default PLAYER object has a tVIEW object attached to itself, so it can see into the 3D world it is in, and a generic movearound functionality (arrow keys) in order to look around the new 3D world...
in order for a character to appear you'd have to do a few things...
1- create an tActor class, or a tFPSChar class (call it anything)...
2- 'register' the new class with the engine...
3- instatiate the new whatever you called it, with CreateObject()...
4- call the engine's ATTACHPLAYER TO OBJECT() method...
now, the PLAYER will move in the whatever way the object it's attached to has been coded to move... and since the VIEW is attached to the PLAYER by default, it will follow the PLAYER around... this object an be anything... a person, a car, a plane... whatever...
cool eh... but hey, not everything in a game using the OO Engine has to be an object... some entities can exist on their own, especially if they don't do anything... or they may merely be properties of a class... in which they are controlled by the objects instantiated by that class...
properties... yeah, that was a kicker in the beginning... but, i got it worked out... say suppose i had a tCar class, and i wanted to have every car object of that class to have headlights... in the class definition i would DIM carHeadlight(maxCars), and reference it in code as carHeadLight(this\objID)... so now if i was in the second of 5 cars, i could turn the headlights for that car only, on or off...
everything is done like this... and it is all in the class implementation... this way, i could give the car class code to someone, and they could instantly add a car to their game by including the file, and doing what was outlined above... the only thing they would need to was what exposed properties did what... headlights on/off, brake pressed, accelerator pressed, etc... ideally, you would design your class so that manipulating these properties would be straightforward and lend themselves to keyboard, mouseclick, or joystick, depending on what it did... and your models associated with the property would give visual feedback to the player...
planning... as mentioned before, that is a biggeee in OO development...
ok... that's enough harrassment for now... when i get time i'll whip up a few docs and post up the code for anyone who is interested... it's really kinda cool once you start working with it... if i do say so myself :)
--Mike
it's amazing to see the results of implementing a new 'class' and adding an instance of that class into the game... just yesterday i was fitting out one of the submarine 'classes' i created... adding the diveplanes, rudders, the periscopes, and the propellors... and it was really facinating to see these things appear on each of the subs (there were two sitting around on top of the ocean) as i ran the test app...
and since the basic functionality of the submarine has already been implemented and tested, it only took a line or two of code to tie that functionality in to the new parts (rudder rotates in the right direction, dive planes tilt and rise)...
i don't see any way i could've gotten this far in the time i did without resorting to this object oriented style of coding... so far, everything is hanging in there, and the engine seems to be able to handle everything i throw at it...
actually, it's Blitz3D that seems to be handling everything in stride... the OO Engine itself is a series of loops that should, by all rights, have killed Blitz a long time ago :)
but i'm getting a lil bit ahead of myself... first a lil about this marvelous creation :)
OOBlitz3D is a source code engine that provides a means of creating objects from classes, by using Blitz TYPEs to create a defacto object oriented coding environment... all the developer has to do to create a minimal 3d game is...
1- add a global declaration for a .tGame object (yes, even the game itself is an object) like this...
Global theGame.tGame=createGame(1024,768,32,WINDOWED_ALWAYS)
2- add an include statement for engine.bb
Include "../samples/OBGameEngine.bb"
3- and code an empty function called theGame, like so...
Function theGame(this.tObject)
End Function
End
... and that's all there is to it.
a 3D window will open with a default tPLAYER instantiated, looking thru the default tVIEW object, at the default tSKY object...
now to dispell a common misconception most people make right off the bat... the player is not the lil guy you see running around in the game, the PLAYER is the person outside the game who is actually playing it... the default PLAYER object has a tVIEW object attached to itself, so it can see into the 3D world it is in, and a generic movearound functionality (arrow keys) in order to look around the new 3D world...
in order for a character to appear you'd have to do a few things...
1- create an tActor class, or a tFPSChar class (call it anything)...
2- 'register' the new class with the engine...
3- instatiate the new whatever you called it, with CreateObject()...
4- call the engine's ATTACHPLAYER TO OBJECT() method...
now, the PLAYER will move in the whatever way the object it's attached to has been coded to move... and since the VIEW is attached to the PLAYER by default, it will follow the PLAYER around... this object an be anything... a person, a car, a plane... whatever...
cool eh... but hey, not everything in a game using the OO Engine has to be an object... some entities can exist on their own, especially if they don't do anything... or they may merely be properties of a class... in which they are controlled by the objects instantiated by that class...
properties... yeah, that was a kicker in the beginning... but, i got it worked out... say suppose i had a tCar class, and i wanted to have every car object of that class to have headlights... in the class definition i would DIM carHeadlight(maxCars), and reference it in code as carHeadLight(this\objID)... so now if i was in the second of 5 cars, i could turn the headlights for that car only, on or off...
everything is done like this... and it is all in the class implementation... this way, i could give the car class code to someone, and they could instantly add a car to their game by including the file, and doing what was outlined above... the only thing they would need to was what exposed properties did what... headlights on/off, brake pressed, accelerator pressed, etc... ideally, you would design your class so that manipulating these properties would be straightforward and lend themselves to keyboard, mouseclick, or joystick, depending on what it did... and your models associated with the property would give visual feedback to the player...
planning... as mentioned before, that is a biggeee in OO development...
ok... that's enough harrassment for now... when i get time i'll whip up a few docs and post up the code for anyone who is interested... it's really kinda cool once you start working with it... if i do say so myself :)
--Mike