Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Database for a fighting game  (Read 1068 times)

weediz

  • Escaped Lunatic
    • View Profile
Database for a fighting game
« on: August 14, 2011, 03:56:54 am »

I'm looking to develop a sort of text based fighting game, but in order to do this I need a database of moves. Does anyone know of a good way to store a list of 100+ moves along with information about how much damage it does, when it can be used and so on?

My initial thought was just a big ol' text file which the game goes through and parses whenever it's run, but I was wondering if there were any other viable options out there.
Logged

Kay12

  • Bay Watcher
  • Fighting for Elite Liberal values since 2009!
    • View Profile
Re: Database for a fighting game
« Reply #1 on: August 14, 2011, 05:28:17 am »

I'd suggest XML, which is parsed to in-game objects.
Logged
Try Liberal Crime Squad, an excellent Liberal Crime adventure game by Toady One and the open source community!
LCS in SourceForge - LCS Wiki - Forum thread for 4.04

Chris_24

  • Bay Watcher
    • View Profile
Re: Database for a fighting game
« Reply #2 on: August 14, 2011, 07:09:39 am »

I haven't actually used XML before, but it sounds like a good choice. I'd split the moves into seperate files, as well, though. Not just one long one.
Logged

weediz

  • Escaped Lunatic
    • View Profile
Re: Database for a fighting game
« Reply #3 on: August 14, 2011, 07:47:35 am »

As in have a separate file for certain types of move? That seems sensible enough. I should probably have mentioned this before but I'll be using either C++ or VB depending on how I want the game to look.

Thanks for the advice so far.
Logged

Chris_24

  • Bay Watcher
    • View Profile
Re: Database for a fighting game
« Reply #4 on: August 14, 2011, 08:46:43 am »

Yeah, that's what I meant :)
Logged

Kay12

  • Bay Watcher
  • Fighting for Elite Liberal values since 2009!
    • View Profile
Re: Database for a fighting game
« Reply #5 on: August 14, 2011, 09:01:07 am »

Yeah, a single file for several moves is the smart way to do it, I suppose. Here's an example you might find relevant, ripped from Liberal Crime Squad's XML files...

Code: [Select]
<weapontype idname="WEAPON_SEMIPISTOL_45">
        <name>.45 Semiauto</name>
        <name_future>.45 Laser Pistol</name_future>
        <shortname>.45 Semi.</shortname>
        <shortname_future>.45 Las.</shortname_future>
        <can_take_hostages>true</can_take_hostages>
        <threatening>true</threatening>
        <legality>0</legality>
        <fencevalue>100</fencevalue>
        <size>5</size>
        <attack>
            <priority>1</priority>
            <ranged>true</ranged>
            <attack_description>shoots at</attack_description>
            <skill>PISTOL</skill>
            <ammotype>CLIP_45</ammotype>
            <random_damage>181</random_damage>
            <fixed_damage>10</fixed_damage>
            <shoots>true</shoots>
            <bleeding>true</bleeding>
            <damages_armor>true</damages_armor>
            <armorpiercing>4</armorpiercing>
        </attack>
        <attack>
            <priority>2</priority>
            <attack_description>swings at</attack_description>
            <skill>CLUB</skill>
            <strength_min>2</strength_min>
            <strength_max>6</strength_max>
            <random_damage>6</random_damage>
            <fixed_damage>5</fixed_damage>
            <bruises>true</bruises>
        </attack>
    </weapontype>

That's probably quite close to what you want - as you may have figured, the XML above describes a weapon in great detail, including the bits that are probably relevant to your game's attacks as well. Feel free to ask any questions - I'm not an expert on XML parsing but I'll try my best to help.
Logged
Try Liberal Crime Squad, an excellent Liberal Crime adventure game by Toady One and the open source community!
LCS in SourceForge - LCS Wiki - Forum thread for 4.04

weediz

  • Escaped Lunatic
    • View Profile
Re: Database for a fighting game
« Reply #6 on: August 15, 2011, 11:02:30 am »

Thanks for the advice, I figured xml would probably be the best option but last time I tried using it in a program I got overwhelmed by it.

However this time I'm making more progress, I'm using pugixml with C++ and I seem to be able to make it do everything I need.
Logged

Kay12

  • Bay Watcher
  • Fighting for Elite Liberal values since 2009!
    • View Profile
Re: Database for a fighting game
« Reply #7 on: August 15, 2011, 11:08:32 am »

Great!

One of the key advantages of XML, by the way, is its relative human-readability. By storing game data in XML files, as you may have already realized, will allow modifications without having to compile.

Good luck with your project! :)
Logged
Try Liberal Crime Squad, an excellent Liberal Crime adventure game by Toady One and the open source community!
LCS in SourceForge - LCS Wiki - Forum thread for 4.04