Concept: Simulating OOP in DBP

Ever since having a play around with Object Orientated programming I thought it a shame that DBP couldn’t do it, because it’s pretty handy for creating applications. I find the approach to be quite well structured and a lot easier to keep stuff organised. However, DBP lacks classes and all that malarky and the closest we’ve got to emulating something like this is with the use of user defined types, essentially you’ll have to make the types emulate the features of an object, but to do that you have to have a function to update all that data. This could build to something bigger, I might even be tempted to add things like collision systems, bitmap fonts, customised lists, menus and other commands to make things easier and more manageable in DBP.

But this is how it looks from just a bit of experimentation. You’ll notice there’s a line saying: ‘cam.lookat = true’, I figured I could code in different camera types, playing with XNA I noticed one type is to have ‘LookAt’, but I might add in slightly more complicated choices like ‘cameraFollow’.

I’m only going to build this to the functionality I wish to use it and build on top of it. If I got something decent rolling I could probably build an engine from it. This experimentation could probably go hand in hand with my work on the Ronin engine. As I’m using Indigo as my IDE for DBP, I even get a tool similar to intellisense, I can just start typing out my UDT and as soon as I hit ‘.’ I can cycle through my types.

To a normal DBP, having those 3 functions may look a little weird, but it’s a little more in line with how class systems work and I think it looks like a decent structure to work with. Initialize is where I’ll stick all of my variables, LoadMethod will be used for loading content and ‘UpdateMethod’ for the main loop. I’ll see how this progresses.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s