Sign in to follow this  
gamutree

Database engine

Recommended Posts

gamutree    100
Me and my friends are making a Simulation Game based on football.We are not very clear about how should we use Databases with Objects.There are various ORM frameworks but I'm not really comfortable with any of them.What would be the ideal way to store large amount of stats related data Files or Databases....If Databases then can any1 suggest DB engines with python which can be most effective

Share this post


Link to post
Share on other sites
taby    1265
I use MySQL primarily. It works with python. Tutorials for creating and using a SQL database are aplenty. Also, learning about the first three normal forms is imperative.

Share this post


Link to post
Share on other sites
gamutree    100
Today we have found about Zope an object Database.Now I really don't know how effective Zope is in terms of performance but it looks a good option.But the problem is, it's in development stages and right now we can't foresee if it will lead to problems.Has anyone used Zope or know about problems related to it gamedev

Share this post


Link to post
Share on other sites
Kylotan    10013
SQLAlchemy is probably what you need. Pair that with MySQL or PostgreSQL if you need a proper DB and good performance. SQLite will suffice if it's just for a small and simple game that doesn't need to scale.

To tell you more than that would require you to ask a much more specific question.

Share this post


Link to post
Share on other sites
gamutree    100
Yes you are right.The problem is that the whole coding will be OOP.If we use relational DB then I really dunno how effective that method can be.There's a shelve module in python which can be used to do this relational and object interaction....so far I'm still learning it and seeing if I can effectively use queries with multiple parameters complex queries....Since the game is sports based and I have myself never really done files programming, I am more inclined towards having a Database.It's like some team breaks their losing streak after 4-5 games..then such results I easily see how I will implement it using a query...today one of my friends came across Zope an object databases non-relational....this looks good option on paper...but I really have no idea wat hassles it can introduce....another thing is the o/p in Zope is given in format which suits python so processing will be simpler..Yet to try SQLAlchemy

Share this post


Link to post
Share on other sites
Kylotan    10013
Quote:
Original post by gamutree
Yes you are right.The problem is that the whole coding will be OOP.If we use relational DB then I really dunno how effective that method can be.

Not very effective, if you're not careful.

Object-relational impedance mismatch

Quote:
There's a shelve module in python which can be used to do this relational and object interaction...

Shelve is a good module for what it is, but there's absolutely nothing relational about it.

Generally speaking the only real problem with OOP and databases comes in where you try to use inheritance-based polymorphism. Luckily in practice I rarely come across code where I need to persist those different objects to the database. And where I do, it can often be solved by moving to composition instead of inheritance, for example.

Share this post


Link to post
Share on other sites
gamutree    100
@Kylotan

Thanks for your reply and the link. The thing about shelve I meant was that using it I can talk to Database.

I had used NHibernate for a web related project and I found it pretty useful in terms of development.Maybe I was exposed way too early before realizing native SQL powers.One of mates told me about Zope an Object based database and that looks an interesting option.I wonder how so far there's not a dedicatad Database system for games.

Share this post


Link to post
Share on other sites
gamutree    100
@Kylotan

Thanks for your reply and the link. The thing about shelve I meant was that using it I can talk to Database.

I had used NHibernate for a web related project and I found it pretty useful in terms of development.Maybe I was exposed way too early before realizing native SQL powers.One of mates told me about Zope an Object based database and that looks an interesting option.I wonder how so far there's not a dedicatad Database system for games.

Share this post


Link to post
Share on other sites
Kylotan    10013
Games in general don't need their own database system. There's nothing specific to game storage that isn't important for other apps. It's always just a tradeoff between performance and ease of access. SQLite is fine if you just want local storage that needs to be queryable with SQL, and if you need even more speed than that, then you'll probably go with a binary serialised format.

Share this post


Link to post
Share on other sites
speciesUnknown    527
For a lot of standard searching tasks, particularly if you are only searching items by unique identifiers (such as ID's) then you can get pretty far, very quickly, by utilising the standard storage containers that your language provides. This is especially useful if you are able to load all your data into memory. I see that python supports dictionaries - these are ideal for this kind of operation.

This way you can do a variety of things cheaply in memory. The use case you mention, detecting when a team breaks a losing streak after 4-5 games, I would grab all games the team has played and then sort them chronologically (trivial in python). Then I would iterate and find losing streaks. (again trivial).

Given a large dataset which cannot be loaded into memory, this would not be performant, but for datasets which could be loaded completely into memory it would suffice.

Share this post


Link to post
Share on other sites
LorenzoGatti    4450
Standard questions:
- What data are you going to put in the database? How does it change?
- Will you have enough data to worry about performance?
- Why in a database and not just loaded at startup and kept in memory in plain data structures?
- What other applications use the data? For example, level editors or automated tests.
- Considering the functionality of your application, is it better to solve the object-relational mismatch by compromising the objects (possibly advanced SQL, open to different and generic client applications, very simple data structures) or by compromising the relational tables (natural object structures, possibly lower performance, very opaque)?

Regarding Zope, it is a heavyweight and unusually sophisticated web CMS (its objects are meant to be site content). Maybe you mean ZODB? I suggest you outgrow the shelve and pickle modules in the standard library before evaluating this and other possible replacements.

For a RDBMS, I am partial to Oracle; MySQL might be also good in the same category (and of course not ridiculously expensive), but if you don't need a remotely accessed DB server SQLite is easier to use at a modest performance cost.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this