(About INTEGER for skill xp →Concerns) |
(→Concerns: integer ranges) |
||
Line 68: | Line 68: | ||
* I'm not sure, if an INTEGER does the job for column exp? --[[User:Exceptionfault|Exceptionfault]] 14:40, 19 September 2008 (CEST) | * I'm not sure, if an INTEGER does the job for column exp? --[[User:Exceptionfault|Exceptionfault]] 14:40, 19 September 2008 (CEST) | ||
** What is the range? I would expect it to be enough. --[[User:Bjørn|Bjørn]] 15:56, 22 September 2008 (CEST) | ** What is the range? I would expect it to be enough. --[[User:Bjørn|Bjørn]] 15:56, 22 September 2008 (CEST) | ||
*** Here’s some basic info: | |||
***: '''MySQL:''' INTEGER (INT) may be signed or unsigned and is 4 bytes large, MySQL also have 1, 2, 3 and 8 byte integer variants (TINYINT, SMALLINT, MEDIUMINT and BIGINT) [http://dev.mysql.com/doc/refman/6.0/en/numeric-types.html] | |||
***: '''PostgreSQL:''' INTEGER (INT, INT4) is signed and 4 bytes large, PostgreSQL also have 2 and 8 byte integer variants (SMALLINT and BIGINT) [http://www.postgresql.org/docs/8.3/interactive/datatype-numeric.html] | |||
***: '''SQLite:''' INTEGER is signed and size is either 1, 2, 3, 4, 6 or 8 bytes depending on the size of the value [http://sqlite.org/datatype3.html] | |||
***: So, the largest integer type supported should be of 8 byte size (signed): from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807, while the “standard†(of the SQL variants above) signed 4 byte integer ranges from -2,147,483,648 to +2,147,483,647. --[[User:Kess|kess]] 21:18, 22 September 2008 (CEST) | |||
=== Character Inventory === | === Character Inventory === |
Revision as of 19:18, 22 September 2008
This article contains information for Programmers working or interested in working for The Mana World
SQL table specifications
User accounts
|
Details
- email
- The email is stored as a one-way sha256 hash value. This ensures, that the email address a user enters cannot be used to send spam mails. It is only used to validate the mailaddress during password recovery procedure.
- level
- describes the user rights in the game (10 = normal user, 50 = gm, 99 = administrator)
Characters
|
Concerns
- The way experience is part of this table really won't scale and isn't flexible in any way. It's currently already way too many variables in one table row, and these are just the weapon skills. So I think we should really have a separate table for storing skill levels similar to the character inventory table below. So something that has { character_id, skill_id, experience }. The
skill_id
should point to askills.xml
file which describes (and categorizes) each skill. In that way we'll be able to easily change the set of skills and their names later. --Bjørn 18:09, 12 September 2008 (CEST)- I think the same should be done with the attributes (str .. will). In theory almost every attribute in this table could be handled that way, it might look like a mess, but would be really friendly in customizing the gameplay elements. --kess 19:54, 12 September 2008 (CEST)
- I agree with that completely as this will give us more flexibility and a much more relational database design. I've extended the "DAL improvements" task in mantis: #424 --Exceptionfault 15:50, 14 September 2008 (CEST)
- Thanks for taking out the skills from this table. However, I disagree about generalizing stuff on the level of attributes, unless there would be any plan of putting infrastructure in place to make this possible. For now we can't even finish a server for The Mana World within years, so please don't try to build a server that supports any online RPG just yet. I only suggested we take out the skills because it would be completely unmanageable as part of this table, but the list of attribute is not expected to change for now. --Bjørn 15:55, 22 September 2008 (CEST)
Character attributes
This table is intended to store skills and experiences of each character.
|
Concerns
- I'm not sure, if an INTEGER does the job for column exp? --Exceptionfault 14:40, 19 September 2008 (CEST)
- What is the range? I would expect it to be enough. --Bjørn 15:56, 22 September 2008 (CEST)
- Here’s some basic info:
- MySQL: INTEGER (INT) may be signed or unsigned and is 4 bytes large, MySQL also have 1, 2, 3 and 8 byte integer variants (TINYINT, SMALLINT, MEDIUMINT and BIGINT) [1]
- PostgreSQL: INTEGER (INT, INT4) is signed and 4 bytes large, PostgreSQL also have 2 and 8 byte integer variants (SMALLINT and BIGINT) [2]
- SQLite: INTEGER is signed and size is either 1, 2, 3, 4, 6 or 8 bytes depending on the size of the value [3]
- So, the largest integer type supported should be of 8 byte size (signed): from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807, while the “standard†(of the SQL variants above) signed 4 byte integer ranges from -2,147,483,648 to +2,147,483,647. --kess 21:18, 22 September 2008 (CEST)
- Here’s some basic info:
- What is the range? I would expect it to be enough. --Bjørn 15:56, 22 September 2008 (CEST)
Character Inventory
|
Comments
- While I haven’t looked how this table is used (my C++ knowledge is rather basic) it seems quite rigid and unflexible (as Bjørn noted above for the tmw_characters table). I think it would be nicer to have something like {owner_id FK, slot, item_id FK, amount, PK owner_id + slot}, where class_id shouldn’t directly be needed in this table. --kess 19:49, 12 September 2008 (CEST)
- Concerning new features like houses, bank accounts, chests or similar, i think the design of this table needs some more roundtrips. You will need a column which indicates if the item is carried by the character or stored in a chest or in a house; as it makes no sense to have a table for every possible storage type or location. Another point is, that items should be more individualizable (is this a real word? :)). Think about custom colored shirts. So we will need at least one additional table to store individual attributes of items. --Exceptionfault 16:02, 14 September 2008 (CEST)
- We want all equipment to be completely individual with completely unique stats. --Crush2 16:13, 14 September 2008 (CEST)
- Good to know, so I will extend the DAL improvement task in mantis. --Exceptionfault 16:20, 14 September 2008 (CEST)
- We want all equipment to be completely individual with completely unique stats. --Crush2 16:13, 14 September 2008 (CEST)
Guilds
|
Guild memberships
The table tmw_guild_members stores informations which character is member in which guild and which rights does he has.
|
World state
The table tmw_world_state is used to store persistent informations about the world or individual maps.
|
Details
- The column state_name forms the primary key of the table. If map_id is null, the variable is used globally in the world, otherwise the variable is specific for a map.
- moddate is for informational use only as it contains the unixtimestamp of the last modification.
Comments
- It seems that SQLite doesn't support composite primary keys (span PK over multiple columns). Therefore it is not possible to allow multiple state_names with different map_ids. So we set a state_name to unique and use map_id as notifier if this variable is globally used or just locally for a specific map. --Exceptionfault 11:05, 15 September 2008 (CEST)
- This table is ready for usage, commited as rev. 4629 --Exceptionfault 13:51, 15 September 2008 (CEST)
Quest states
This table is used to store states of quests per character, e.g. if a character has just finished a quest or is currently at the second part of the long journey...
|
Comments
- Unless this table is adapted so that it stores the state of a particular quest, this one should have a name which makes it move obvious that it's storing custom values for characters. I consider that different from quests variables, which I would expect to be scoped to a certain quest (global quest variables) or quest instance (local quest variables). --Bjørn 18:16, 12 September 2008 (CEST)
- We might want to have a similar table to this to store custom values for item instances, and also one for custom world-state variables. --Bjørn 18:16, 12 September 2008 (CEST)
- I always wondered why Silene used the terminology "Quest" for what is basically a system to store/querry persistent character-bound integer variables which can be used for countless purposes, not just quests. I think we should rename this whole system to "character variable" in the database, server source and script bindings. --Crush2 23:28, 12 September 2008 (CEST)
- I agree with Bjørn concerning the additional tables for custom item values and custom world-state values. Although the name "tmw_quests" is a little bit confusing and should be renamed, I suggest keeping a table as such to store only quest states of characters and not to mix up with other persistent states. Instead we should provide a much cleaner documentation about the available quests and their persistent states that are possible. I envision something like a questbook in game, where each player can have a look at his finished quests and currently open quests, maybe with hints on the minimap, a todo list .... Besides that, we should be aware of dividing quests into "per-character", "per-party" or global world quests. --Exceptionfault 16:20, 14 September 2008 (CEST)
Reference
Since the database is changing relatively often while we're still developing 0.1.0 and nobody likes to keep this page up to date, here is the link to the source code that specifies creation of the database tables. The source code is always right!