Introducing the Criterion Coding System and the Dynamic Function Engine.
The Dynamic Function Engine is a powerful function management engine that allows coders to restructure functions during code execution. This has two primary benefits; the first adds a whole new level of flexibility to programming. Code can now restructure itself while running - imagine what you can do with that! The second benefit is to reduce resource usage (resulting in higher FPS) for larger programs. Functions can be added or removed as needed, which could limit the functions being executed only to those that are required at any given moment.
The Criterion Coding System is a utility that sets up the necessary Dark Basic Pro source-code structure for the DFE to work. In addition, we have included modified versions of a few extra Open Source tools developed for the Open MMORPG Project. These tools include 2D Button Functions, Object Button Functions, Infinite State Engine, Keyboard Functions, and an improved Text Parser. These included files all work with the Dynamic Function Engine, making many coding tasks significantly easier. For example; Functions can now be assigned directly to 2D Buttons, Object Buttons, States, and Keys, which makes programming these features easy and flexible.
The attached demo program was created using the Criterion Coding System. Below is all the code I added - nothing more.
Sync On: Sync Rate 0:Autocam Off
_Add_Function(0,_Get_FID("Initialize_Button"),"")
_Add_Function(0,_Get_FID("Initialize_Object"),"")
_Add_Function(0,_Get_FID("Initialize_Keys"),"")
_Add_Function(0,_Get_FID("Start_Game"),"")
Do
_Execute_Functions(0)
Loop
End
Function Initialize_Button()
Initialize_Buttons()
bid=Make_Button("fullscreen.png",20,Screen Height()-100,1,1)
Assign_Button_Functions(bid,"Maximize_Screen","","Restore_Screen","","Button_Info","1;L-Click=Maximize, R-Click=Restore")
_Remove_Me()
Endfunction
Function Initialize_Object()
Initialize_Object_Buttons()
Load Object "dwarf1.x",1
Position Object 1,0,0,20
Make_Object_Button(1,1,0,"Dwarf", "Turn_Object","1;1", "Turn_Object", "1;-1")
_Remove_Me()
Endfunction
Function Initialize_Keys()
Initialize_DFE_Keys()
Assign_Key_Function( sca ,"Animate_Object","1")
Assign_Key_Function( scs ,"Freeze_Object","1")
_Remove_Me()
Endfunction
Function Start_Game()
_Add_Function(0,_Get_FID("Get_Button"),"")
_Add_Function(0,_Get_FID("Active_Object_Button"),"")
_Add_Function(0,_Get_FID("Single_Key"),Str$( sca ))
_Add_Function(0,_Get_FID("Single_Key"),Str$( scs ))
_Add_Function(0,_Get_FID("Update_Screen"),"")
_Remove_Me()
Endfunction
Function Update_Screen()
Set Cursor 0,0
Print "FPS=";Screen FPS()
Print "Active Dynamic Functions=";Array Count(FunctionList())
Print
Print "Press [a] to animate."
Print "Press [s] to stop animation."
Print "Left/Right Click the Dwarf."
Print "Left/Right Click the Button."
Sync
Endfunction
Function Maximize_Screen()
Maximize Window
_Remove_Me()
Endfunction
Function Restore_Screen()
Restore Window
_Remove_Me()
Endfunction
Function Button_Info(btn as Integer,txt as string)
Text MouseX(),MouseY()-12,txt
b=Get_Button()
if b<>btn then _Remove_Me()
Endfunction
Function Turn_Object(Obj as DWord,Lft as Float)
Turn Object Left Obj,Lft
_Remove_Me()
Endfunction
Function Animate_Object(Obj)
Loop Object Obj,15,25
_Remove_Me()
EndFunction
Function Freeze_Object(Obj)
Stop Object Obj
_Remove_Me()
Endfunction
To create this demo, only a few simple generic functions were written. The rest of the code was created by the CCS Project Set-up utility. You can also see that there is only one single command needed in the main loop; _Execute_Functions(0). During the first run, the initialize functions all execute, which sets up the demo. These are all then removed and replaced by the active functions.
You may also notice that at any given time, there are about 4 functions that are active (upper left corner of the demo). If you click on the dwarf, you will see that number jump up to 7. That is because more functions are required to turn the dwarf. When you are no longer clicking on the dwarf, the number of active functions drops back down to 4 since the other 3 are no longer needed. This demonstrates how the DFE helps save on resources. Think about it multiplied by a hundred dwarfs. Instead of 300+ functions all running all the time, only 4 to 7 functions are needed at any given time. This more than compensates for the background functions that make up the DFE.
The DFE's flexibility will also support advanced AI concepts, such as learning and adaptation. You will notice that functions are assigned using string values. This means that the function calls are no longer hard coded, but can be changed by manipulating the string values.
The DFE also supports scripting functions, so functions can be called directly from a text file. So, if you can write a function, it can now be scripted for unlimited scripting capability.
Included in the Criterion Coding System:
Project Set Up: Creates a project file, and all source files needed to start a DFE project.
DFE Scripting: Creates a unique source code file that works with your project to complete the DFE Functionality.
-->Also creates a keyword file that turns all your project's function names into keywords and includes useful information about the functions.
Support Files: Open various help files, demos, and tutorials (not included with beta-test versions as these files are being developed during beta-testing).
Image-Text Encryption: Useful for "watermarking" bmp images to identify them as yours, or to hide useful information within bmp images.
-->Text is stored in the image with no visible change to the image.
-->Can store entire books in large images.
Additional features may be added on later.
If you are seriously interested in beta-testing the Criterion Coding System and Dynamic Function Engine, please email me at:
riidii*@*ommorpg*.*vectramedia*.*net (remove the *'s).
The Dynamic Function Engine includes advanced coding concepts, so beta testers should be proficient coders.
Open MMORPG: It's your game!