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.

Dark GDK / Here is DarkLights for DarkGDK, compiled and ready (with source code).

Author
Message
The Tall Man
11
Years of Service
User Offline
Joined: 16th Nov 2013
Location: Earth
Posted: 11th Oct 2018 11:19 Edited at: 12th Oct 2018 02:58
Brief Update (v1.1):
I discovered that I had accidentally left a #pragma to link in LightMapper.lib in the file I created LightMapper.h. It was left in there from before I created the DarkGDK wrapper. So I've updated the download with this change.
---End of Update

Hey all,

Since the open-source for DarkLights (and more) is available here: https://github.com/TheGameCreators/Dark-Basic-Pro, I've compiled the libraries for DarkGDK. A few minor modifications to the source code were necessary for it to compile and run, but I was careful to not break compatibility with DarkBasic Pro. I documented the changes I made in the file changes.txt and in the source code. I also created a command wrapper for DarkGDK, so the commands begin with dbLM rather than just LM (a few commands were a bit awkward to call directly due to the .dll export requirements). Also there were a couple naming conflicts with Sparky's Collision, so I renamed those structures to remove the conflicts.

I've included the source code along with compiled Release and Debug libraries, as well as the include file to use. I tested it with the official 2010 release of DarkGDK and it works. Just copy the include file into the DarkGDK include directory and include it in your program - and copy the library files (LightMapper.lib) into your release and debug library directories. So you needn't bother with the source code if you just want to add it to your DarkGDK. Btw, I used Visual Studio 2008 - which is a newer version than the project files in the repository.

I also wrote a little test/demo program using DarkLights which I included in this .zip. While I was at it, I put some elementary collision, standard movement controls (mouse/keyboard), standard Earth-gravity, and jumping.

Some notes:
1. The DarkLights Debug library runs WAY SLOWER than the its Release library. So you may want to link and use the Release version, unless you're actively examining the source code.

2. There is a bug. After the light maps are generated, all the objects are turned pure white. This bug showed up when I ran this source code in the 2010 official release of DarkGDK, my own customized version of the open-source of DarkGDK, as well as in the recently free last release DarkBasic Pro when I compiled DarkLights for that. A work-around I found is that even though all the objects appear pure white after the lightmaps are created, you can still save the lightmapped objects and then load them later, and the loaded ones will display just fine. I built this feature in to the little demo I wrote - you can switch modes with a simple config option near the top of main.cpp (I have a Run-Config options section).

3. I included some Sparky's code in the demo, but there's an option at the top to disable Sparky's compilation. So you can use it with or without Sparky's.

4. I had attempted earlier to add all the objects to a static "Universe" for saving as a single "Universe.dbo", using my own version of the DarkGDK open-source. Although those commands were never documented at all for DarkGDK, they were well documented for DarkBasicPro, which is now free. But that feature was so buggy, it was unusable (some objects would appear, others would be invisible and they couldn't be coaxed otherwise). One nice thing about saving the individual objects is that you don't lose access to each one for interactions.
5. I have not attempted to call most of the DarkLights functions yet, so it's not been fully tested. Some of the linker errors didn't show up until certain commands were called (I fixed those that I saw).

Maybe someone here, if inclined, will work on the source code to fix that white-objects bug. The code looks pretty simple, and I did notice (only from a brief glance though) that there is apparently a new function call for every point checked with the light-casting. In my experience with intensive programming, that is a HUGE slower-downer of program execution. So eliminating that will probably increase performance considerably. So there's probably lots of room for performance-leaps for anyone who wishes to work on it, and as I said the code looks pretty simple and straight-forward.

But it general, it works! And the lighting is beautiful!
-Patrick
Judging what we see is the greatest blinder and self-limiter in the universe.

What we perceive is never reality. It is only a story we tell ourselves based on our current perspective, which has far more to do with our beliefs about ourselves than with anything else.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-18 19:23:02
Your offset time is: 2024-11-18 19:23:02