![]() |
Form Database System
4 Attachment(s)
This is a system I created for Val Dev to be the skeleton for the Mud and various other systems, its directly based upon the database system used in Morrowind and Oblivion. I discontinued it because I don't know how Graal would handle the system if it got to 30,000+ forms like I would expect in the future. Its not something that would work too well on a large scale if its interpreted like Graal Script is, I believe.
I would love to have my system integrated into Graal if Stefan ever finds time <3, I believe it would be useful to many as a database designed to work with the Mud. There are some things I planned to do but haven't since I discontinued it: 1. Cache variable indexes 2. Remove dependency on the allforms array, since I think Graal would kill itself with a 20,000 member array. 3. Update the function scheduling so the operation is done on timed intervals rather than a time after the last operation. 4. I forget the rest. Attached to the post is the system itself, the default definitions I had, and two of its dependencies. Anyhow, now for the explanation of it. In this system, a Form is simply an array with its first variable being the type, allowing the system to identify the rest of the data in the array, all forms have an ID and can be referenced with a special string: "#f1002" which would mean a form with the ID 1002. Those special strings are made to be like pointers in C++, you need them to access the database by function at all times. There are two overall types of Forms, Default and Cloned. Default forms can be defined by any means the user wishes and they are not saved to file so they must be actively defined somewhere (I use a database NPC). The only way to create new forms is to clone them using the CloneForm() function, this takes a form reference (i.e: "#f1034") as a parameter and returns a reference of a duplicate form. Blank forms are generated automatically for each type and their reference defined in a variable in the system (i.e.: "playerdata = cloneForm(Forms.newplyr);"). Cloned forms are saved to file on change and creation, and are loaded from file when the server starts. Cloning forms is how you would add new data for new players and new items created. For clientside stuff, Forms are sent to client when needed. All forms sent to client are parsed for form references that exist in them, these form references are gathered in a list and if those forms exist but are not yet loaded on the clientside they're requested from the server and the process starts over again. For how the Mud Items related to the database, there is a single form type for an item instance, and multiple types for their bases. Item bases are how the stacks are organized. For example, you would have a form of type 'weap' which contains base information for a Sword, including its name, icon, damage, scripts, weight, value, etc. From this base the Mud creates new forms of type 'item' which are instances of an item. The 'item' form contains information such as quantity, and the condition of the item and its owner or other things unique to that item, also the most important variable is the base, each item instance has a variable for the base form that its representing so the inventory and such knows where to load name and image data from. And also Mud related, is what happens when a new player logs in. Three new forms are created of type 'plyr', 'char', and 'cont'. The 'plyr' type is meaning player, it contains information specific to actual accounts on the server and not game characters. The 'char' type is meaning character, it has information related to game-characters such as their health, class, stats, etc. Both Players and NPCs would have an instance of this. Also contained in every character form is a reference to its container form, type 'cont'. Container forms store an array of form references to the items that are contained within it, and are used for both characters and objects in the world such as barrels or crates or even dead baddies. Heres an example of the forms a player would receive on login and how they're connected to eachother: PHP Code:
... Wow, thats alot of typing :D |
Amazing Inver, just amazing!
Very nice :p! |
| All times are GMT +2. The time now is 09:30 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.