I am focusing on a Dirt (Multi User Dungeon) in Python and am at the moment making your way around to the stage where I have to then add rooms, opponents, products, etc. I possibly could hardcode all of this in, however it appears such as this is much more of the project for a database.
However, I have never really done any use databases before so I'm wondering for those who have any advice regarding how to set this up?
- What format must i keep data in?
- I believed of storing a Dictionary object within the database for every entity. In htis way, I possibly could then simply just add new characteristics towards the database quickly without changing the posts from the database. Does that seem reasonable?
Must I store all the details within the same database however in different tables or different organizations (opponents and rooms) in various databases.
I understand this is a can of earthworms, but what exactly are a few recommendations for any good database? Is MySQL the ideal choice?
1) There's rarely any reason to possess data for the similar application in various databases. Not unless of course you are a Fortune500 size company (OK, i am exaggregating).
2) Keep info in various tables.
T2: Room common qualities (aplicable to each room), having a row per *room
T3: Room unique qualities (relevant to minority of rooms, having a row per property per room - thos causes it to be simple to add custom qualities without adding new posts
T4: Room-Room connections
Getting T2 AND T3 is essential because it enables you to definitely mix efficiency and speed of row-per-room idea where it's relevant with versatility/maintanability/space-saving of attribute-per-entity-per-row (or Object/attribute/value as IIRC it's contacted fancy terms) schema
3) Implementation smart, attempt to write something re-functional, e.g. have generic "Get_room" techniques, which underneath access the DB -= ideally via transact SQL or ANSI SQL so that you can survive altering of DB back-finish fairly easily.
For initial work, you should use SQLite. Cheap, simple and easy , SQL compatible (the very best property of). Install is virtually nothing, DB management can be achieved by free software tools as well as Opera wordpress plugin IIRC (all Opera 3 data stores - history, bookmarks, places, etc... - are SQLite databases).
For later, either MySQL or Postgres (I do not do each one appropriately so can't recommend one). IIRC sooner or later Sybase had free personal db server too, but no clue if that is still the situation.
- This method is known as entity-attribute-value model. It's normally preferred to possess DB schema that reflects the dwelling from the objects, increase the schema whenever your object structure changes. Such strict schema is simpler to question and it is simpler to make certain the information is correct around the database level.
- One database with multiple tables is the best way to do.
- If you prefer a database server, I have recommend PostgreSQL. MySQL has some advantages, like easy replication, but PostgreSQL is usually better to utilize. If you would like something more compact that actually works directly using the application, SQLite is a great embedded database.
Storing a whole object (serialized/encoded) like a value within the database isn't good for querying - I am certain that some queries inside your dirt does not need to know 100% of characteristics, or may retrieve a listing of object with a worth of characteristics.