Want to make a game?
After a lot of work on the Open Source MMORPG Project, we realized that there was a clear need for utilities and libraries that could handle a lot of the initial set up for a game code. Rewriting all the code from scratch each time we started over was daunting. So, we slowed down on the RPG game and focused on these utilities. Here are the utilities we currently use:
Utilities:
Criterion Coding System (CCS)
Terrain Viewer (upgraded to Terrain Creator)
Model Viewer
AI Editor (may experience significant change)
Libraries:
Dynamic Function Engine (DFE)
Buttons (2D Buttons, or Sprite Buttons)
3D Buttons (Object Buttons)
Infinite State Engine (Infinite State AI Functions)
Generic Functions
Parser Functions
Key Functions
Statics
Utilities
===============================
The Criterion Coding System copies many of the core files needed to write a new game. This makes a lot of the initial work a breeze. The CCS also provides a scripting utility for the Dynamic Function Engine (instead of writing all that code yourself). The CCS also includes an Image Encoding utility that can hide code, keywords, or "watermarks" within images.
===============================
The Terrain Viewer is a little more than just a terrain viewer. It is a fairly useful terrain utility in its own right. The height-maps, terrain-maps, and detail-maps, all still need to be created with an external program (usually some sort of paint program). The terrain viewer can create the terrain. It can also be used to place objects, and then create a script file to record where all the objects are to be placed. In this respect, the Terrain Viewer is nearly a full editor.
===============================
The Model Viewer is a very simple utility. Its most useful function is to ensure that a model can be loaded by DarkBasic. With all the different modeling software out there, this was critical and saved us a lot of time trying to figure out why the program crashed, then which model couldn't be loaded. It also can tell roughloy how many milliseconds the object will use up when on the screen. While this is only an estimate, it is useful to help ensure a model doesn't come along and take 999 milliseconds to render. The model viewer can also rotate the model as well as run through all the animations.
===============================
The AI Editor is still a work-in-progress. The primary use is to script stats for each AI in the game, which will determine the behavior and abilities of each AI. In addition, we hope to add in function-scripting, which will allow Agents (our term for AI entities) to access various functions; such as skills.
Libraries
===============================
The Dynamic Function Engine is a library of functions (included source code) that allows DarkBasic to access functions dynamically. That is, functions can be added to (and removed from) a stack of functions. The stack of functions is executed in order each time the _Execute_Function() function is called. Functions can also be grouped, which allows for advanced timer-based function calling techniques. The techniques can help distribute resources over several frames instead of using the resources every single frame. For large games, this can easily result in improved frame-rate performance.
===============================
Buttons, or 2D Buttons are sprites that the player can interact with. On the basic level, this library can return a given integer value assigned to a button. A more advanced feature allows functions to be attached to the button for mouse "hover over", left-click, and right-click. The Buttons library makes menus and HUDs a snap.
===============================
3D Buttons or Object Buttons. The same concept as for 2D Buttons, but 3D Buttons are applied to objects. Besides being able to return values and call functions when clicked, 3D Buttons can also be set to a given distance from the camera, allowing the library functions to ignore objects that are too distant to bother with checking. This helps optimize performance.
3D Buttons are useful for creating quest-givers, or movable objects, like doors. Simply code the function and attach it to a 3D Button.
===============================
The Infinite State Engine was originally designed to handle Aggro for AI entities in the game, so you can bet that it still can handle that easily. The functionality has been expanded to be more generic. Basically, the Infinite State Engine does for variables what the Dynamic Function Engine does for functions. Variables can be created in game and dynamically. This is particularly useful for scripting AI.
Started your AI with Strength, Dexterity, and Stamina, and now you want to add Intelligence and Willpower? Easily done with the ISE. No need to go through and recode the entire game. Just add two new "States" to the ISE - one for Intelligence, and one for Willpower. The ISE will handle creating the variables and making them globally available.
===============================
Generic Functions are a melting pot of generically useful functions that are stand-alone, or too small for their own source file library. The best way to describe everything in the generic functions source file library is to say, "just read the source file for yourself." So, "just read the source file for yourself."
===============================
Parser Functions manage strings, allowing strings to be broken down in a wide variety of ways. The most useful functionality in the Parser Functions is the ability to load in a script file and save the results in a 2 dimensional array; by line and by "word." A "word" is a set of text between two separator characters (commonly the semicolon [;]). So a parser "word" can actually contain many words with spaces and other punctuation between. Each line is a group of "words" between [return] characters.
Parser functions are also useful for creating text boxes and spam boxes that use word-wrapping.
===============================
Key Functions are the final user interface. Key Functions provide a wide variety of key management functions, such as single key (non-repeating) and repeating key input. When used with the DFE, functions can be attached right to the key, so pressing a key will call function. This is great for dynamic key assignments (if you want your players to be able swap key assignments). It also minimizes the amount of code you need to keep track of. Create a function, assign it to a key, and forget it.
===============================
Statics make a wonderful addition to any terrain. They are a bit more work, but well worth the effort. Primarily used for grass, Statics are low-polygon objects that cover the terrain close to the camera, providing amazing detail. While the primary use was intended for grass, statics work just as well as dirt, rocks, sand, or any terrain. Statics use a statics map, which is painted using colors that each static is assigned to in a script file. So, everywhere there is the color RGB(0,255,0) (pure green), there can be placed grass, assuming the script file has grass assigned to RGB(0,255,0).
Want to make a game?
===============================
Using these utilities and libraries, making a game is a snap (well, compared to all the coding you would have to do without these). These libraries were designed to work in "Pure" DBPro; that is, no plug-ins or DLL's. The utilities, however, do use Goga's Free DBP Plugin Version: 2.0C. Thanks Goga!
You will notice that there is one key ingredient missing; collision. While we do have a collision engine for our RPG project, it is "Pure" DBPro and therefore a bit slow. You might want to use a 3rd-party collision plugin or dll.
The rest of any game can built on the above listed utilities and the libraries. This thread is intended to uncover more utilities, libraries, or modifications to the existing resources. So please use these and provide feedback so changes and updates can be made.
Attached are 3 of the utilities (excluding the CCS, which is not open source). I will post the libraries over the next few days. The CCS is currently in beta testing. If you are interested in making a game using the CCS, please contact me and I will provide you a copy of the CCS.
I would like to give thanks and credit to all the folks that have contributed over the years, either directly or indirectly. Some folks of notable mention are, Kenjar, Tinkergirl, Nevereverend, and Slayer. There are many more to list; so to those not listed here, your contributions are very much appreciated and it has truly been a community effort! You will be listed on the final game credits.
Open MMORPG: It's your game!