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.

Work in Progress / OpenDarkBASIC

Author
Message
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 7th Jun 2024 09:30 Edited at: 10th Jun 2024 07:53
Note to mods: If this is on the wrong board, feel free to move it.



OpenDarkBASIC is a re-implementation of the DBPro compiler built on top of LLVM. The initial goal of this project is to be a drop-in replacement for DBPCompiler.exe with full support for the existing DBPro SDK and language. If we do our jobs, you should not notice any difference!

@dga has laid all of the ground work for interfacing with the original DBPro DLLs. As of this writing, OpenDarkBASIC is able to produce executables that use the existing DBPro engine. We aim to be backwards compatible with all existing DBPro projects.

It is a cross compiler, meaning, it it is possible to run the compiler on either Windows/Mac/Linux, and compile executables for Windows/Mac/Linux/Web (in theory). Because the DBPro DLLs only work on Windows, it'll be necessary, as a secondary goal, to add a new cross-platform SDK to support a modern graphics API so you can write games for all operating systems. Work on this has not yet been started, aside from some very primitive plugins for printing hello world.

Features
Cross Platform support
Compatible with the original DBPro language
Helpful error and warning messages
Optimizing compiler
Plugin framework for extending the language with new commands
Comes with an editor

In particular, I want to highlight the two main selling points of this project: Error messages and optimizations. A ton of work is being put into generating useful error messages. Example:


DBPro will happily compile this code and print 8. As most hopefully know, 5+3.5 is NOT 8.

OpenDarkBASIC will also compile this and print 8, but it will output some warning messages:



As you can see, it's warning you that the result of pos#+var1 is being converted into an integer. You can expect this kind of quality for all types of warnings and errors.

Optimizations: If you were to look at the disassembly of that code produced by the DBPro compiler, it would be longer than the height of your screen. The DBPro compiler may produce machine code but it does a terrible job at it.

OpenDarkBASIC is very different in this regard. Because we are using LLVM, we have access to the last 40 years of compiler optimization research. Here is the compiled code of OpenDarkBASIC, with and without optimizations:



As you can see, it's managed to delete all variables and call print directly with the value of "8".

What this means is: If you have written algorithms in in DBP such as pathfinding, collision code, or physics, chances are OpenDarkBASIC will be able to optimize them as efficiently as it would C or C++ code.

Progress

It's still in pre-alpha stage at this point and there is a lot to do. The good news is, it is clear how to do it. Here is an overview of the progress:

DBPro Language Support
- Command calls and plugin support
- #constant statements
- Variables
- Assignments
- Binary and Unary Operators
- - Arithmetic operators (+-*/^ mod)
- - Bitwise operators (<< >> || && ~~ ..)
- - Logical operators (< <= > >= <> or and xor not)
- - Increment/Decrement
- Scope specifiers (Global/Local)
- Functions
- Subroutines
- Arrays
- User-Defined Types (UDTs)
- For-Loops, While-Loops, Repeat-Loops, Infinite-Loops
- If-Then statements
- Goto
- Select/Case statements
Extended Language Support
- Matrix types and operators
- Vector types and operators
- Quaternion types and operators
- Imaginary number types and operators
Compiler internals
- Plugin loader
- - DBPro core command support
- - DBPro licensed plugin support
- - Command cache
- Code generation
- - Start and stop DBPro engine
- - Call DBPro commands
ODB SDK
Editor
DBPCompiler.exe wrapper

Downloads


Coming soon!
The past is history. The future is a mystery! But today is a gift. That is why it is called "present" -- 3D Turtle
https://forum.thegamecreators.com/thread/229638 -- Modern compiler for DBPro!

Attachments

Login to view attachments
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 7th Jun 2024 09:42 Edited at: 7th Jun 2024 09:43
Curtesy of @dga: This is from his game Star Scape, compiled using OpenDarkBASIC:

Primary target of mod abuse since 2007!
xanfax
2
Years of Service
User Offline
Joined: 22nd Apr 2022
Location:
Posted: 10th Jun 2024 15:53
Very much looking forward to this. DBP in all it's forms just broke on fresh installs of W10. DBP apps using 3D fail to launch due to some weird incompat between the ancient compiler/editor and the latest W10 updates.
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 17th Jun 2024 20:51 Edited at: 17th Jun 2024 20:51
Quote: "Very much looking forward to this. DBP in all it's forms just broke on fresh installs of W10. DBP apps using 3D fail to launch due to some weird incompat between the ancient compiler/editor and the latest W10 updates."

I've also been having issues. I guess DX 9.0 is just too old.

Update: I was annoyed at how slow loading commands takes, so I implemented a command cache feature to fix this. Left is without the cache, right is with the cache. It's really not a fair fight



Commands are loaded by parsing the DLL files, and on my installation there are 91 plugins total. Due to how the DBPro language was designed, it's actually impossible to parse the syntax without knowing all of the commands ahead of time. That's why it's necessary to do this.
The past is history. The future is a mystery! But today is a gift. That is why it is called "present" -- 3D Turtle
https://forum.thegamecreators.com/thread/229638 -- Modern compiler for DBPro!

Attachments

Login to view attachments
Kuper
16
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 19th Jun 2024 00:00 Edited at: 19th Jun 2024 00:05
Interesting!
After DBProEx there were no attempts to update DBPro (compile speed, stability)
I also remember that Bored of the Rings tried to finish a multi-threaded version of the compiler, but it was never released.
So it is wonderfull that DBPro wil get improvement.
If you want Mac/Linux compatibility, you will need to switch from DirectX to OpenGL (like in AppGameKit), so all shaders will have to be rewritten.
And what about .dds textures? Will they still work with OpenGL?

Login to post a reply

Server time is: 2024-06-21 21:39:00
Your offset time is: 2024-06-21 21:39:00