On The OOP SoapBox Again...

Miscellaneous Forums/General Discussion/On The OOP SoapBox Again...

... yup, here i go again... but first lemme say how impresed i am with Blitz3D...

i've got some code that has to get the parent of a parent, after checking to make sure that the parent exists, and the parent's parent exists... and all inside the game loop (one of many)... and Blitz doesn't seem to have slowed down a bit (it probably has, but it's not apparent :) to me)... impressive i say...

now for the OOP part... i've got a VIEW subclass, that is always the child of something (the camera which is the entity that represents the View is the child)... most of the time it's the Player... but it could be anything...

also, Player is usually a child of some other class as well (it's hEntity is its Entity that represents it in the game)... so the View usually winds up attached to a Player, that is attached to something else... most likely an Actor subclass hEntity...

now the amazing and revealing aspect of this (drum roll please) is how by approaching this as an OO task, with everything in its own lil encapsulated world, doing it's own lil object oriented thing... i'm at the point now where i don't even have to think about all the underpinnings anymore... just concentrate on getting my sub and the crew to function... everything really magically just works...

i just came off a coding session where i wanted to implement a gimbal lock on the pitch axis for the existing View subclass... i needed this so that whatever a View might be attached to, or whatever it was attached to was attached to, no matter how it turned, rotated, rolled or pitched... the view would turn and roll with it... but the pitch remained level (so the crewmen on the sub could sense the down angles and such, but still rotate with the sub as it turned)...

i can't imagine doing this at all without relying on this lil object oriented setup i've pretty much finished... even saying it gets me tongue tied, let alone the abstractions and levels of logic involved... i'd be talking to myself by now if i did this the ole speggetti coded procedural way...

..i just wanted to share this lil bit with you... this has been a good day... but i aint through yet... just takin a short break for a smoke and a pre dinner drink...

as soon as i get time, i'm gonna try and put this up in the archives for anyone who really wants to do some real development :)

my situation has changed a bit... my ole lady has abandoned me, and i really gotta get this game done to make some money to survive... (after 32 years of marriage, i'm on my own again, and i'm in a race now to finish this, or i'll dissapear from the cyberwaves for lack of funds)... so it's gonna take me a while before i can put it up... and, although it's sone to the point where it can be used to code complete apps with, it is still undergoing lil changes here and there as i use it for developing the game with...

... but as soon as i can, i'll get it up... BMax3D will be a while coming, and i think some will find this usefull... or i should say i'll try to.

--Mike

sniff

sorry to hear about your marriage but now you have no excuse but to finish a game!

Can't believe you are still banging on about Blitz3D being good for OO when it plainly isn't an OO language :-/ But I guess it IS 3D.

thx GA... yeah, this thing actually works :)

the only thing that i really had to wrap my head around was addressing objects as myObject(this\objID)... and addressing their properties as objectProperty(this\objID)... aside from that, it's a lot easier than i thought it would be when i first started it...

doing it this way, most of the coding of the game involves writing the class... and that's just a single function... i just dim the properties, code the functionality, then drop a new object type into the game engine (add the include, 'register' the class, and a few createObject() calls, and it works...

think about it for a sec... a game is nothing more than a few objects doing what they do, with the Player (who is also represented as an object), controlling any one of em...

the main game code is just initializing the engine and instantiating a few objects, and then letting it loose...

it's magic!!! :)

--Mike

Ouch ... 32 years of marriage :(

Congrats on the OOP though.

Yeah, that's more than tough, but trust me on this one - it may take more than a little while, but eventually you'll think "Hey, now I can...." (and not just programming, and not just other women).
It's a new life.

more than tough is right... i'm devastated... not sure if i'm gonna make it through this one...

ahhhhh, we'll see... tommorrow has already happened... i'm just running to catch up with it...

understanding objects has always been easier...

that was a joke... laugh... :)

--Mike

No more nagging, all that free time, hang in there. Got mates you can have some beers with and play a little poker?

@Red Oktober,

sorry to hear about your marriage :-/
I hope you'll get right on the path soon.

On a completely different topic, here there's a link to a really interesting 'Entyty property box' that could be used like an Hashtable. I think it could be very handy for you:
http://www.blitzbasic.com/codearcs/codearcs.php?code=820

I wish you all the best.

Sergio.

thx samar, GA, and all...

@ semar...
i'll take a look at the code... i hope it's simple :)
next to OOP, KISS is my motto...

--Mike