XNA Creators Club Online
Page 1 of 1 (18 items)
Sort Posts: Previous Next

Using Databases with XNA, 3ds max

Last post 11/21/2008 12:45 AM by Kentu. 17 replies.
  • 11/12/2008 9:52 AM

    Using Databases with XNA, 3ds max

    hi guys

    Has anyone used a database with their game. i want to make a football game and have all the players with attributes and teams with all their info stored in a database to be randomly accessed and manipulated by the game.
    does anyone have any tutorials on this.

    Also please note im new to XNA and c# im not bad with VB.Net and i have seen alot of simlarity in the code.

    I got my hands on a copy of 3ds Max the other day i havent had a long play on it yet but i watched a few tutorials on Youtube and looked so easy i thought i could have a chance of learning it.

    i think ill get a player running first on screen then work from there, adding more animations and then work on AI lol. i believe i can do this, I believe i will finish this game and im a very thorough person and will make it as good as i can with no short cuts.

    I need some good tutorials on the whole subject. ie. Books, Dvds, internet pages. if you could help me out it would be much appreciated thanks.
  • 11/12/2008 11:07 AM In reply to

    Re: Using Databases with XNA, 3ds max

    it's a good question. i think you can safely assume you won't be able to use sql server or even access mdbs with vba. i think (and this is my own assumption) that you would need to look at a flat-file-based database library, one that uses XML or text files to serialize data. in fact, you are probably better off using XML since you can then use XPath perhaps to do your querying.
  • 11/12/2008 12:27 PM In reply to

    Re: Using Databases with XNA, 3ds max

    Unless the amount of data used is big and requires complex queries, I would recommend XML for your case.
    You can even build a small, simple relational database system with it using XPATH to query it. This should fully suffice simple applications.

    If it needs to be more complex (which I would not assume from what you said), you could use SQLServer Compact edition. That way, you wouldn't need SQL Server Runtime to be installed on the game clients.

    -Daniel
  • 11/12/2008 12:40 PM In reply to

    Re: Using Databases with XNA, 3ds max

    You don't need a database for a football game. Simple file(s) (XML recommended) would do.
    Jim Perry - Microsoft XNA MVP
    If people spent a minute searching the forums and reading the FAQs before posting I'd be out of a job.
      Got some XNA Game Studio/XNA Framework development info to share with the community? Put it on the XNA Wiki.
        Please mark posts as Answers or Good Feedback when appropriate.
  • 11/12/2008 12:48 PM In reply to

    Re: Using Databases with XNA, 3ds max

    If it needs to be more complex (which I would not assume from what you said), you could use SQLServer Compact edition. That way, you wouldn't need SQL Server Runtime to be installed on the game clients.


    Assuming he doesn't intend on running on a 360.

    Dan Melchione | If you ship a good game there will be cake!
  • 11/12/2008 12:53 PM In reply to

    Re: Using Databases with XNA, 3ds max

    Godling72:
    Assuming he doesn't intend on running on a 360


    Oh of course...that's true...didn't even think of that! :)

    So under all circumstances, XML recommended! The best way would probably be to load the file into memory and keep it there during the whole runtime and either query it in-memory using XPath. For a football game this approach would work just fine!

    -Daniel
  • 11/13/2008 3:12 AM In reply to

    Re: Using Databases with XNA, 3ds max

    what i have is 16 teams, around 700 players, 70 staff etc.   also each year their will be 70 new random made up players that will get added to the database but at the same time some will disapear through retirement.

    i havent decided wheether it will be user playable or just management style game

    i wasnt going to have gameplay at all just text on the screen to tell the player what is happening.

    so to make the game play work and give every player on the field a chance to be an individual with their on stats ie. kicking 90 out 100, tackling 65 etc

    also the tactics menu the player chooses to play will have a big influence on the game, ie attacking, playing on, hard tackling.  ill probabley use sliders in the option menu to adjust the gameplay to where i believe is good enough and realistic. Like Nba 2k has.

    At the moment ive been making my human model in 3ds max.  its coming along all right still getting used to how to use it but is a very nice app.

    i want to make a stadium as well with different stands as you progress in the game with your club and get more money you can expand the stadium I.E USM 98/99, that was a great game i guess im trying to modernise it.

    i have heaps of time on my hand to make this game a reality and its not just the fun of making it and playing it its also making it for all the fans all their that will also enjoy the game.

    i have no expereince with XNA i have little to nopne with c#

    i do understand and have written a few apps in VB6 and vb.net

    i wouldnt mind making a tutorial as i go with this game. get a section on this forum for my game and how it progressing so other can also try and make their own games that may be simlar.

    im really just stuck on this database issue and dont know how to get arround it..

    im making this game for windows but if when im finished it is able to be played on xbox id let it loose on that 2.

    so please any info you have would be great, if you know any sites that has great info please point me their ill read and read till my eyes go blind. i really want to smash this game.

    thanks for all the quick replys aswell thank you.
  • 11/13/2008 5:10 AM In reply to

    Re: Using Databases with XNA, 3ds max

    To me, it still looks feasible with XML. Sure, it seems you have quite a bit of data and statistics you want to save/load.....but that should be no problem for XML. The key is, to structure the XML properly to reflect the most common queries you're doing.

    You could probably also split up the XML into multiple files if there's data that doesn't need to be combined in one single query (like staff or retired players for example?).

    I would build a wrapping class around the whole XML code....some sort of abstaction layer that will let you treat the XML files as a database alowing you the usual operations like Queries/Lookups, Inserts, updates, deletes etc.
    Also make sure the underlying XML is saved back to a file once in a while to avoid losing data. In order to avoid inconsistent data you might also have to implement some type of transactions, so the database system is able to recognize atomic operations and doesn't save right inbetween two dependant insert/update statements, putting your XML file into an inconsistent state (in case the game crashes afterwards)......but that is a rather advanced topic if you haven't done much with databases yet. I suguest you start with the simple things and add functionality as you go along.

    -Daniel
  • 11/13/2008 12:36 PM In reply to

    Re: Using Databases with XNA, 3ds max

    Thanks Daniel for all that,

    i was down at the local bookstore, actually its not to bad has a starbucks in it lol. anyways i picked up 2 books i only had 100 bucks on me.

    1. begin 3d game programing - by tom miller ---- its not to bad had a bit of a flick through it. it covers c# and 3ds max 2008 pretty well with the .net framework.

    2. microsoft xna unleashed, Sams ---- i thought it was awesome down at the bookstore got back and gave it a read for 2 hours and put some sticky notes on pages that were usefull. anyways i got on the cpu and started playing around with the book in hand and the source code is all wrong. seems like its written for a different version of XNA. sh!t. is it true that previous versions of XNA dont work with this current version 3.0? i got no luck. do you reckon i could take the book back? 60 bucks ouch


    back to the  game im starting to loose sleep over this game now. i had previously planned to make this game on vb6 but i wanted it to be a bit better and nicer looking and looked around at other IDEs. then i decided id do it on vb.net 2008 and ive spent since then 2 months drawing and writting pages and pages about this game and how it was going to work. Then i found old XNA 3.0 with c# wow wee, i watched a few clips on youtube and was hooked it made it look so professional and asthetically pleasing on the eye.
    so now i got to work this database thing out.
    xml? hmm

    what programs is their for it? what do you recomend?

    do you recon i should do my game in 2d or 3d. is 3d that hard? ive been messing around with 3ds max and ive made human through the help of youtube tutorials. and soon ill animate it. all that doesnt seem to hard. is it basically just load the .fbx files etc and plot the co ordinates through Ai?

    basically is it only harder because you have to make the 3d models?

    any thanks daniel with the help, ill check xml out on google and see what i find.

  • 11/13/2008 1:47 PM In reply to

    Re: Using Databases with XNA, 3ds max

    If you just need a simple table, a CSV file is very useful (a bit old school).

    < removed review solicitation >
    Released Games: The Review Channel , Beat IT! Christmas Edition, Beat IT!,
  • 11/17/2008 7:57 PM In reply to

    Re: Using Databases with XNA, 3ds max

    Chrismc27,

    Sorry you had trouble with the source code for the book. Microsoft XNA Unleashed was written for XNA Game Studio 1.0 Refresh (April 2007). However, all the 1.0 books have 2.0 code. (Some may have updated to 3.0?)

    2.0 code for my book can be found at http://xnaessentials.com/ and click the downloads link. There are instructions on the best way to use the updated code on the site along with the code and assets on the CD.

    Currently, there are no plans to update the code to the 3.0, but I will be releasing a new 3.0 book by mid December (target date).  The new book covers everything the existing one does along with Zune game development and multiplayer games as well as strategies for selling your games on Xbox LIVE.

    To get the code to work with 3.0 you need to do the following:
    1. Copy chapter code to HDD
    2. Unzip chapter code from website over top of existing files.
    3. Open up solution files and let XNA Game Studio do the conversion to 3.0.

    You should be good to go. The text in the chapters are still valid for the most part. For example, render targets have changed, but concept is still the same although a few sentences about them are now incorrect.

    If you have any book specific questions, please ask them on the Amazon forums for the book.



    Hope this information helps.  

    Chad


    Chad Carter
    Microsoft XNA Game Studio 3.0 Unleashed - Book contains information on 2D, 3D, HLSL, Content Pipeline, XACT, Particle Systems, AI, Physics, Game States, Performance, Zune and 4 full games (2 of which are multiplayer)!

    Twitter

    XNA Essentials
  • 11/18/2008 1:16 AM In reply to

    Re: Using Databases with XNA, 3ds max

    With XNA 3.0, you get Linq (even in the Compact CLR AFAICT). You can use Linq to query XML documents similar to how you would query a database. That might be just the ticket for a game rich on game data (RPG, football, etc).

    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 11/18/2008 2:51 AM In reply to

    Re: Using Databases with XNA, 3ds max

    jwatte:
    With XNA 3.0, you get Linq (even in the Compact CLR AFAICT). You can use Linq to query XML documents similar to how you would query a database. That might be just the ticket for a game rich on game data (RPG, football, etc).

    It sounds to me that Linq would be perfect for what Chrismc27 wants. Because from what I can tell what he seems to be after is the ability to query the data, not a database's performance advantages (not that linq is slow by any means). Even so, you'd never, ever have performance issues with ~1000 data entries (players), etc.

    If you are new to games and XNA, then 2D will be a *lot* easier.

    Xen: Graphics API for XNA
    www.codeplex.com/xen
  • 11/18/2008 3:46 AM In reply to

    Re: Using Databases with XNA, 3ds max

    Not to sound all concided but it was easier for me to learn 3d game programming then 2d. Anyways if you really want to use a database that bad, I assume C# has built in OBDC etc that can access a database. C# is actualy the easiest language I've touched to access databases. Only thing is I'm not sure on how XNA/OBDC etc work on xbox. I would look into what the xna framework or .net compact has on xbox and go from there.  Sorry I also skipped a few replies, dunno if someone else mentioned this.
  • 11/18/2008 4:22 AM In reply to

    Re: Using Databases with XNA, 3ds max

    I assume C# has built in OBDC etc that can access a database.

    If you don't know what you're talking about, then don't talk. There is no ODBC for XNA on the Xbox or Zune. On Windows, there is ODBC as part of the .NET framework, which you can link to if you want to only target Windows. However, for game-time database needs, ODBC is not the right fit. Can you imagine: "This game requires the Access Compact Runtime installer. Do you want to install it now?" -- I'd hit Cancel so fast it wasn't even funny!

    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 11/20/2008 5:06 AM In reply to

    Re: Using Databases with XNA, 3ds max

    WOW, how about if your gona talk all hostile don't talk at all? No need to be rude. A simple explination would have sufficed.
  • 11/20/2008 5:28 AM In reply to

    Re: Using Databases with XNA, 3ds max

    LoL! How about, if you can't be bothered reading the previous replies, then why be bothered to post at all?   :D

    Seriously though, I haven't really used LINQ yet, but I look forward to as it looks really promising. With standard SQL, it was easy to write parametrised queries as stored procedures and store them in the DB. Then when the user needed an update, you could just redeploy the stored procecure. Is there any equivalent of this when using LINQ? It seems the your queries will be tied up in your assemblies... I suppose you could use a plugin architecture and allow custom assemblies, but that surely won't work on the XBox.
  • 11/21/2008 12:45 AM In reply to

    Re: Using Databases with XNA, 3ds max

    How about I did read them? just skipped like one or two. Not a big deal.
Page 1 of 1 (18 items) Previous Next