Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Object Oriented Programming in DarkBasic

Author
Message
mike roesoft
19
Years of Service
User Offline
Joined: 14th Dec 2004
Location: London, England, UK
Posted: 10th Sep 2006 23:34
Hi all

Simple question - Is it possible to write Object Oriented programs in DarkBasic? If so, I'd appreciate any pointers to tutorials, books or any other resource. Many thanks.

Theo

Summer is the season of life
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 11th Sep 2006 07:45
No. DarkBasic lacks almost everything an object-oriented program requires. Use DarkSDK and C++.

By way of explanation, there is no class creation capability, or ability to pass parameters by reference, this operator, etc. These are some of the foundations of object-oriented programming.

You can go a long way in that direction, but...my opinion is no.
EddieY
18
Years of Service
User Offline
Joined: 6th Sep 2006
Location: Waltham, MA, USA
Posted: 12th Sep 2006 06:55
Hi Mike,

You could roughly simultate OOP using Dark Basic, but it would be very rough. (You could use include files and user-defined types, but it would be up to you do be disciplined and consistent, and it definitely would not be as easy as using an language designed for it.)

Another option is to get the Unity add-on which allows you to use Lua scripting in your DarkBasic projects. Lua is a very capable language...check out the Wikipedia article on it. From what I've read you can much more successfully use an OOP-approach with Lua. You can't put everything in Lua scripts, but you could put alot of your game logic there and take advantage of the more robust language features it has.

As jinzai mentioned, the Dark Game SDK will allow you to fully dive into OOP and use Visual Studio .net and have access to all the DarkBasic libraries. It's definitely a complete oop environment.

From what I've read on the forums, the next version of the DSGSDK will support the free express edition of Visual Studio .net, so you may want to wait for that if you go this route. It's also up in the air if and how add-ons like Dark Physics or Dark AI will or will not be supported for the SDK.

Whatever you decide, good luck!

-Eddie

-------------------------------
Regard all phenomena as dreams.
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 12th Sep 2006 12:04
There is no real object oriented programming. However, you can create entity classes of your own using User Defined Types. For example, I don't use object numbes, I use UDT references to arrays.

For example...

Quote: "char(1).object
char(1).health
char(1).animFPS"


char(1).object could be a reference to object 1000. I can have however many elements of the array "char" that I want, and I can iterate through them whenever I want. It's a wonderful way of managing game resources.


Come see the WIP!

Login to post a reply

Server time is: 2024-11-26 12:36:51
Your offset time is: 2024-11-26 12:36:51