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.

DLL Talk / Would people be interested in a Leadwerks DLL?

Author
Message
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 14th Nov 2010 13:10 Edited at: 14th Nov 2010 13:11
I created a proof of concept DLL wrapper for Leadwerks Engine for use with DarkBasic Pro. It is far from a useable state right now, as i have ran into a couple problems but nothing that I can't get around. If there is an interest in this, I may very well continue on and turn this into a proper TPC DLL.

A few things to address:

Yes, DarkBasic is a DirectX app, and yes, Leadwerks is OpenGL-- but thats ok, because you can have the empty DirectX app hidden from project settings in your IDE. This still allows the OpenGL window to be created, and updated through DarkBasic.

And heres a screenie of the concept demo which basically encapsulates different stages of the standard Leadwerks projectwizard generated app and recreates it using (simple)DarkBasic Pro code:



Well, lemme know what you think or if you want more info on this project. I warn you however, while I have programmed a bit in C, I am new to creating DLLs... as a matter of fact, this was my first one, lol. I'm not to sure how many more DBP/Leadwerks 2.4 users there are around, but if anyone wants to give a hand, lemme know. This would unfortunately require a license to LE 2.3 or higher. Thanks for your time.

Randy.

Attachments

Login to view attachments
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 14th Nov 2010 19:40
It's certainly an interesting thought, but how is it for performance?

Would the same code be any faster with this versus plain DBPro?

I do like the idea of having the choice between DirectX and OpenGL.

Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 14th Nov 2010 20:16 Edited at: 14th Nov 2010 23:52
Well, in my experience, I've noticed most of the slowdown in dbp comes from the renderer. Using this, you wouldn't mess around with the DBP window at all, and most of the non graphical functions are plenty fast enough. I've been already working on this as more than a proof of concept now and have commands to start LE, create LE meshes and materials as well as comands to manipulate them. I have also wrapped the entire input library which is needed because since the directx window is out of focus, it wont except keyboard/mouse input.

With this being said, a complete recreation of the leadwerks project wizard app runs at around 300 fps for me. The same example in C++ using the standard LE library gives me only a few more fps. Its almost completely unphased!

Aside from this, lua support is already active since it is done object level in the engine. This means when I wrap the LoadScene function up, you'll be able to load a Leadwerks Editor sbx file, and it will automatically load the media as well as scripts and just work--And this is only after about 30 or so hours work, lol.

Heres a cleaned up version of the LE Project Wizard's template written in DBP:



Edit1: and btw, in case you haven't thought of it yet, this pretty much proves you could also write a wrapper for DX10

Edit2: Here is a screenshot of DBP running my plugin. It a Leadwerks sandbox level that was loaded with a wrapper command. The heat haze, physics, normal mapping and lighting, were all loaded automatically with one command. In this example I am able to control the Leadwerks camera with custom commands in DBP using the arrowkeys.

Attachments

Login to view attachments
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 15th Nov 2010 20:44 Edited at: 15th Nov 2010 20:46
Pretty sweet.

I say go for it. I've been looking at the Leadwerks engine for a while, and this would eliminate at least one of the reasons I wasn't considering it.

Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 16th Nov 2010 01:00 Edited at: 16th Nov 2010 01:04
Unfortunately Leadwerks does require a pretty beasty computer and graphics card, but I've been a fan. I've began rewriting from scratch in order to make the commands more Dark Basic friendly as well. Instead of formatting the commands in the fashion Leadwerks uses such as "Graphics 800, 600, 32", I've decided to format them the same as the commands they will replace such as "le set display mode 800, 600, 32." I think this will be a better solution then having to know the actual inner workings of the Leadwerks Engine. You can use commands you are already familiar with, only prefixed with 'le'. Thanks for your interest in the project. Hopefully in a week or so, I'll move this to an actual WIP.

Edit: Also, I should add that I had memory leak issues with wrapper for the previous screenshots... I now run the wrapper at around 100-200fps on a 3800+ with 3g DDR2 and GeForce 9800GT 512DDR3.
coldfire
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 16th Nov 2010 22:42
Almost ready for a WIP... I'm over halfway converting commands now and wanted to share the commands I do have finished already. Unfortunately it will take longer to document then to program, but I have followed the DBP commands fairly closely. Some commands will obviously not have LE counterparts but I've been covering them the best I can. This list is just of the exported names, so what appears now as "le_SetDisplayMode" will later become "le set display mode."

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 17th Nov 2010 18:23
Nice.

Neco
16
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 19th Nov 2010 18:46
The Wilderbeast
19
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 19th Nov 2010 19:05
I'm very surprised that this hasn't picked up more views really. If you moved this to WIP I imagine you'd get a lot more feedback as it is, in a word, awesome xD

Like KISTech, I'd been considering it, but couldn't be arsed to go learning C++.

Good luck

Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 22nd Nov 2010 13:33
Thanks for the support guys. I had originally planned on releasing a alpha of my wrapper at the end of this past weekend, however, I am conflicted. I've rewrote this several times now emphasizing mainly two styles. The first style was to mimic the LE API almost exactly. This would allow users to use the Leadwerks wiki as a reference and almost remove the need for wrapper documentation. The second style was designed to mimic DBP style functions. This way you are working with familiar commands. I find each way fairly easy to use and am having troubles deciding which style to stick with. So, I would like to get your opinions on the matter. Right now, I'm thinking of reverting back to using the LE API style. It seems as though it would give more control and having documentation already is also a big plus.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 23rd Nov 2010 00:13
Probably stick with the LE commands, since that's what is in the library anyway. That way you wont have to make something up for instances where one has a command that the other doesn't.

The Wilderbeast
19
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 23rd Nov 2010 08:21
Plus it makes the job of porting code / examples a lot easier preventing you from having to rewrite it. Although a cool inclusion would be something to convert the LE syntax for use in DBPro - but IMO unnecessary if you kept their syntax styling.

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 23rd Nov 2010 18:57
The only issue I see with this so far, is the DBPro graphics related commands and the LE graphics commands aren't going to work together. (ie, can't use DBPro move and rotate commands to manipulate an object created with LE commands.)

Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 23rd Nov 2010 22:31
Thats correct. Instead of using 'position object', you will have to use PositionEntity instead. The functionality would be the same for the most part. I am interfacing not only the graphics, but also sound, input and everything else in Leadwerks. A good rule to keep in mind is any DBP command dealing with graphics, sound or input, should be replaced with the proper LE commands instead. As long as you follow that rule, everything should be fine. I'm sure if I really wanted to, I could have LE render to a custom buffer and write a system to translate that into a bitmap that could be displayed inside the DBP window, but that would be incredibly slow and imo, overkill. Gonna be busy with the holidays over the next couple days, but I will be ready to post a WIP by the end of the weekend. Thanks again for the support!
snike Venom
19
Years of Service
User Offline
Joined: 23rd Apr 2005
Location:
Posted: 19th Feb 2011 08:16
I am very intrested to see how this is going. i hope you have not given up. as this would be the best combo if it all worked.

Venom
Omen
18
Years of Service
User Offline
Joined: 7th Nov 2006
Location: Maple Grove, MN US
Posted: 24th Feb 2011 03:58
Very interesting Coldfire - I'll be watching this thread with interest, let us know when the WIP thread is up

Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 25th Feb 2011 23:49
Actually the WIP has been up for a while. I probably should have linked to it here. http://forum.thegamecreators.com/?m=forum_view&t=178396&b=8

I have rewritten it several time as I've learned to do better things in C++. I have also been grappling with hardware issues lately which has slowed its progress. That problem in question would be a burnt out video card. I have replaced it and plan on continuing this project in the next couple days.

I also plan on making a LE3 wrapper, but LE3 is a ways off anyways. The first few writes of my current wrapper went fast mostly due to slow work, but I can't say the same anymore as work has been picking up and I'm left with less free time. I will admit though, I am humbled by the interest, and that makes me want to get back to development even sooner. Rest assured, this project is far from dead... It has just been going through evolutionary steps which I am sure will pay off at the time of release.

Login to post a reply

Server time is: 2024-11-21 15:19:38
Your offset time is: 2024-11-21 15:19:38