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 / Code compatibility question

Author
Message
Os_unPWN
10
Years of Service
User Offline
Joined: 11th May 2014
Location:
Posted: 12th May 2014 16:51
I am new to dark basic and not sure if this is possible, my brother has coded a physics engine in c++ and I have created the basis for a 3d game...I was wondering if the engine can be integrated into dark basic somehow without recoding the engine from c++ to dark basic code
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 13th May 2014 17:14 Edited at: 13th May 2014 17:27
Edit: I see you said "physics engine". Updated my answer to reflect that and about your game...

Depends how the engine was written.
DBP cannot link object code so static objects are out. You can make calls to dlls, however this is limited and you'll see why in a moment. The following limits exist within DBP as apposed to C-alike languages:

DBP cannot pass any struct/array nor can it pass variables by ref.
DBP structs cannot contain arrays.
DBP has no pointer-to-functions, meaning no classes.
DBP's dynamic memory allocation is very limited.
DBP cannot use the address-of operator.
...many others...

Short answer: Yes, but not without headache. Basically, you can only use your brother's engine if it can be compiled into a dll with functions requiring only basic data-types passed to / returned from them (there are hacks using raw memory but it is not relevant here unless you want that info).
FTR: There are physics add-ons for DBP.

Your game would have to be rewritten though, as BASIC and C are worlds apart, as are most of their derivs.

"Oh nonZero, let me tell you, I love you." -- Dark Java Dude 64, Vice-Kapitan of nASA(nonZero's Awesomeness-Spreading Association)
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 13th May 2014 17:28 Edited at: 13th May 2014 17:29
Excuse all the edits above, I'm having one of those days.

"Oh nonZero, let me tell you, I love you." -- Dark Java Dude 64, Vice-Kapitan of nASA(nonZero's Awesomeness-Spreading Association)

Login to post a reply

Server time is: 2024-11-21 11:46:27
Your offset time is: 2024-11-21 11:46:27