Vanolith is a full game engine I am working on. 100% of Vanolith is written in DarkBASIC Professional. I am doing this project instead of my DBP .Net DLL's because more people will be able to use Vanolith and will be even more useful in your program's/game's development.
As of right now I am just finishing up on the core aspect of the engine, no graphics programming has been done yet. The core covers everything from file manipulation, settings, display, GUI (using BlueGUI), command line parsing, exception handling, console window (BlueGUI window that stays on top), and the scripting system.
File manipulation, display settings, saving and loading, and other core DBP features are things I wont go into detail about since most people should already understand the point and functionality of such functions.
The scripting system is a fully featured scripting system written completely in DBP. It is module based, so adding new commands or other functionality is as simple as writing a case statement, adding a sub and linking to it, or writing a function and calling it it. Scripts are not read as text, but as my own custom byte code which is formed from a compiled script. Scripts are written and compiled inside the script editor (written in DBP and BlueGUI and called from the command line). Compilation is very fast, I did 2000 lines in 87 seconds on a 1.8p4. Scripts can also be written in notepad or another editor. You can just open up the script file in the Vanolith script editor then compile it. Scripts can have any file extension but all compiled scripts must have the same extension (extension is a constant in the engine, so this is easily changed).
Scripts can be in both C++ .Net style syntax or DBP with a bit of .Net style syntax. Each version of a script can be compiled with the same compiler just as fast. There will be an option on the compile window where you choose C++ or BASIC. BASIC will not compile under the C++ option, as C++ will not compile under BASIC. However, scripts compiled under either will turn out to be the same exact compiled script. Neither syntax will run faster than the other after it is compiled. Also, you cannot mix/combine the syntax's together in the same script file.
Here is an example script:
C++ Style Syntax Option
//TestScript.vss
/*
Vanolith scripting is case sensitive. All function names and variable
declarations/usage are effected by this. Core.print will not work, just
as var1 is not the same as Var1. Whitespace is ignored. Scripts use
C++ .Net style syntax and structure.
*/
Using Vanolith.STD //Standard NameSpace
Using Vanolith.Graphics //Graphics NameSpace
Using Vanolith.WindowsForms //Windows Forms NameSpace
/*
Scriting allows you to store variables. Integers, Boolean, Float,
and String variables are all allowed to be defined. You may define
up to 100 of each variable per script. All variables are auto
global. If 2 definitions of variables have the same name and both set
an initial value then the 2nd definition overwrites the first unless
strict compile is on, which throws an error and aborts the compile.
*/
Integer varInt1 = 10
Integer varInt2 = 5
Integer varInt3 = 6
Boolean Allow1stIf = True
Boolean Allow2ndIf = True
Boolean Allow3rdIf = True
Boolean AllowFor = False
Float varFloat1# = 1.1
Float varFloat2# = 2.7
Float Pie# = 3.14
String MyString$ = "Hello World"
If (varInt1 > varInt2) And (Allow1stIf == True)
{
Core.Print(MyString$);
Core.Print("My name is Ethan, but I am known as EsteemDE");
Core.Print("");
Core.Print("This is my first full test of the scripting system.");
IF (Allow2ndIf == True)
{
Core.Print(Core.Convert.ToString(varInt3));
}
ElseIf (Allow3rdIf == True)
{
Core.Print("Pie = " + Core.Convert.ToString(Pie#));
Core.Print("");
Core.Print("");
Core.Print("I will now print some floats.");
Core.Print(Core.Convert.ToString(varFloat1#));
Core.Print(Core.Convert.ToString(varFloat2#));
}
Else
{
If (AllowFor == True)
{
For (i = 1 to 5)
{
Core.Print("Line " + Core.Convert.ToString(i));
}
}
}
}
Display.Buffer.Clear();
Loop
{
Core.Text(5, 5, "ScreenFPS: " + Core.Convert.ToString(Display.Program.ScreenFPS());
Core.Text(5, 20, "Monitor Width: " + Core.Convert.ToString(Display.Screen.Width());
Core.Text(5, 35, "Monitor Height: " + Core.Convert.ToString(Display.Screen.Height());
Core.Text(5, 50, "Monitor Depth: " + Core.Convert.ToString(Display.Screen.BitDepth());
Core.Text(5, 65, "Program Width: " + Core.Convert.ToString(Display.Program.Width());
Core.Text(5, 80, "Program Height: " + Core.Convert.ToString(Display.Program.Height());
Core.Text(5, 95, "Program Depth: " + Core.Convert.ToString(Display.Program.BitDepth());
If (Core.Input.Key.Escape == True) Or (Core.Input.Key.F1 == True) Or (Core.Input.Key.Q == True)
{
If (Dialogs.QuestionMessage("Exit?","Exit the program?") == 1)
{
Dialogs.MessageBox("Program Exit","The program will now exit.");
Core.Program.Terminate();
}
}
}
BASIC Style Syntax Option. I did not test compile this so there may be errors. I did this translation very quickly so... yeah.
`TestScript.vss
REM
Vanolith scripting is case sensitive. All function names and variable
declarations/usage are effected by this. Core.print will not work, just
as var1 is not the same as Var1. Whitespace is ignored. Scripts use
C++ .Net style syntax and structure.
ENDREM
Using Vanolith.STD `Standard NameSpace
Using Vanolith.Graphics `Graphics NameSpace
Using Vanolith.WindowsForms `Windows Forms NameSpace
REM
Scriting allows you to store variables. Integers, Boolean, Float,
and String variables are all allowed to be defined. You may define
up to 100 of each variable per script. All variables are auto
global. If 2 definitions of variables have the same name and both set
an initial value then the 2nd definition overwrites the first unless
strict compile is on, which throws an error and aborts the compile.
ENDREM
Integer varInt1 = 10
Integer varInt2 = 5
Integer varInt3 = 6
Boolean Allow1stIf = True
Boolean Allow2ndIf = True
Boolean Allow3rdIf = True
Boolean AllowFor = False
Float varFloat1 = 1.1
Float varFloat2 = 2.7
Float Pie = 3.14
String MyString = "Hello World"
If varInt1 > varInt2 And Allow1stIf = True
Core.Print MyString
Core.Print "My name is Ethan, but I am known as EsteemDE"
Core.Print ""
Core.Print "This is my first full test of the scripting system."
IF Allow2ndIf = True
Core.Print Core.Convert.ToString(varInt3)
ElseIf Allow3rdIf = True
Core.Print "Pie = " + Core.Convert.ToString(Pie)
Core.Print ""
Core.Print ""
Core.Print "I will now print some floats."
Core.Print Core.Convert.ToString(varFloat1)
Core.Print Core.Convert.ToString(varFloat2)
Else
If AllowFor = True
For i = 1 to 5
Core.Print "Line " + Core.Convert.ToString(i)
Next i
EndIf
EndIf
EndIf
Display.Buffer.Clear()
Do
Core.Text 5, 5, "ScreenFPS: " + Core.Convert.ToString(Display.Program.ScreenFPS())
Core.Text 5, 20, "Monitor Width: " + Core.Convert.ToString(Display.Screen.Width())
Core.Text 5, 35, "Monitor Height: " + Core.Convert.ToString(Display.Screen.Height())
Core.Text 5, 50, "Monitor Depth: " + Core.Convert.ToString(Display.Screen.BitDepth())
Core.Text 5, 65, "Program Width: " + Core.Convert.ToString(Display.Program.Width())
Core.Text 5, 80, "Program Height: " + Core.Convert.ToString(Display.Program.Height())
Core.Text 5, 95, "Program Depth: " + Core.Convert.ToString(Display.Program.BitDepth())
If Core.Input.Key.Escape = True Or Core.Input.Key.F1 = True Or Core.Input.Key.Q = True
If Dialogs.QuestionMessage("Exit?", "Exit the program?") = 1
Dialogs.MessageBox "Program Exit", "The program will now exit."
Core.Program.Terminate()
EndIf
EndIf
Loop
Update 1 - I just finished up writing the script editor program. That includes both the look and functionality of it. I will be putting up a fully functional demo soon that shows off everything I have done so far, but DBP source will not be included with it.
Included in this post is an image of the script editor itself. The window cannot be resized and is sized for a 1024x768 or larger screen.