Xbox LIVE Indie Games
Sort Discussions: Previous Discussion Next Discussion
Page 1 of 2 (49 posts) 1 2 Next >

RPG Programming Using Xna, Real Time Combat System?

Last post 9/17/2010 3:42 PM by Zombie Monkey Games. 48 replies.
  • 11/22/2009 12:26 AM

    RPG Programming Using Xna, Real Time Combat System?

    Hi, yea its me again.

    My 2D game I am designing is going to use a real time combat system.
    I was wondering if anyone would be so kind to write a tutorial for me?
    It needs to be able to fit in with Jim Perry's book RPG Programming Using Xna Game Studio 3.0.

    I do not require this tutorial for about a couple days,
    since I haven't gotten all the way to the combat system chapter.

    I would appreciate this alot.
    Thanks,
  • 11/22/2009 1:14 AM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    Have you considered finishing the book before asking for help understanding it?
  • 11/22/2009 8:23 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    Its a long time since i read it, but here we go.
    First I'd advice you to look into the Roleplaying game Starter Kit.
    If you choose to use it, you've already got the base layers of the game running and you can start building your own real time combat system into it. (By real time combat I assume Zelda-like gameplay)

    You'd need each characters in your party to be drawn
    Each character should have attacking, defending... etc. sprites.
    You would want to tweak the Monsters by applying move functionality, so they can chase the hero/party and attack them.
    Also you should think about what will make YOUR combat system unique so you wont end up programming a generic piece of trash everyone could have made, which isnt fun to play.
    If you plan on making magic and items you might want to review your controls, maybe apply a battle HUD and a pause function to stop the mobs, while the player chooses his next move.

    Apart from all this you should already have a general idea of how to balance out the gameplay core mechanics (How many Health Points the party/hero and enemies should have, how they move, what kind of attacks they do, how much damage they deal.. etc.)

    And all of this should of course be be integrating into the non-combat gameplay.
    I dont know if you can get someone to write you a tutorial for all of this.
  • 11/22/2009 9:47 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    Im not asking for help understanding it, I'm asking for someone to write a tutorial on how to do so(as said above).

    I quickly looked through the book to see what type of combat system, magic system, etc. I would be using.
    I saw that it was a turn-based combat system, and I needed a Real time combat system.

    Does this answer your question?


    Its a long time since i read it, but here we go.
    First I'd advice you to look into the Roleplaying game Starter Kit.
    If you choose to use it, you've already got the base layers of the game running and you can start building your own real time combat system into it. (By real time combat I assume Zelda-like gameplay)

    You'd need each characters in your party to be drawn
    Each character should have attacking, defending... etc. sprites.
    You would want to tweak the Monsters by applying move functionality, so they can chase the hero/party and attack them.
    Also you should think about what will make YOUR combat system unique so you wont end up programming a generic piece of trash everyone could have made, which isnt fun to play.
    If you plan on making magic and items you might want to review your controls, maybe apply a battle HUD and a pause function to stop the mobs, while the player chooses his next move.

    Apart from all this you should already have a general idea of how to balance out the gameplay core mechanics (How many Health Points the party/hero and enemies should have, how they move, what kind of attacks they do, how much damage they deal.. etc.)

    And all of this should of course be be integrating into the non-combat gameplay.
    I dont know if you can get someone to write you a tutorial for all of this.


    Yes, I have downloaded and tried out the RPG Starter Kit and would prefer to start from scratch
    with my own sprites and code. Ok, I mean legend of zelda type combat.
    I won't have anyone else be able to join your party(at least I haven't thought that far ahead).
    Yep, I'm working on the animations. Ok, Thanks,
  • 11/22/2009 10:28 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    The combat system described in Jim's book is turn based. You are going to have to implement a timing system to handle combat and the best one that comes to mind is done by 3D Buzz in their XNA tutorials. What that tutorial will show you is how to give each of your mobs an attack interval rather than doing combat round by round. If every mob does combat at a fixed interval, say one second, then you could still use a lot of Jim's code. Instead of pausing for the round... you could automate the round on the fixed interval. I have the code from the 3D Buzz tutorial, but I'm not clear on the copyright. I'll be glad to share it with an Admin's permission. Come to think of it... Jim does something similar with his Bonus struct on page 42. Basically, you need a duration and an interval variable.

    EDIT
    Also look at Jim's Combat Simulator starting on page 162. What this demonstrates is that Jim's combat engine can happen as fast as you click the button (Real Time). Your timer mechanism could call a method to do something very much like what is described on page 170 in Figure 6-4.
  • 11/23/2009 12:57 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?


    "the best one that comes to mind is done by 3D Buzz in their XNA tutorials."

    Don't you have to pay for that?

    "Basically, you need a duration and an interval variable."


    Though there are more things I would need to create it.
    I'm not going to list health, because thats idiotic listing it(everybody knows health).
    I would need a collision that appears in front of the character when he/she
    swings their weapon, and it would need to last as long as the animation does.
    Then I would check to see if the sword collision collided with anything,
    and if it collided with it, remove X amount of health. Then, I would need a Shield Collision
    that... well, blocks magic/arrows/weapons etc. and it goes on.

    The only problem is that I have never been good with collisions(AIs too).
    If there is an easier way, go ahead and tell me.
    Thanks,
  • 11/23/2009 7:45 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?



    I strongly doubt that anyone is going to write an actual tutorial for you. If you have specific questions, youre more likely to get answers.

    Aflakjuju:

    I would need a collision that appears in front of the character when he/she
    swings their weapon, and it would need to last as long as the animation does.
    Then I would check to see if the sword collision collided with anything,
    and if it collided with it, remove X amount of health. Then, I would need a Shield Collision
    that... well, blocks magic/arrows/weapons etc. and it goes on.


    Exessively simplified, what you need to do goes something like:

    if (player is swinging)
    {
       foreach (enemy e in PotentialTargets)
       {
          if (players sword collides with e)
          {
              remove some health from e, possibly depending on shields, blocking status of e etc;
          }
       }
    }
  • 11/23/2009 8:52 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    Most RPG systems don't base combat on what the avatars do, the avatars do whatever the RPG engine tells it to do. It first determines if the character hit his opponent and the appropriate actions are rendered on the screen. If you reduce combat to what happens on the screen you don't have an RPG game any longer.
  • 11/23/2009 9:23 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    Ok, Thanks u551.
  • 11/23/2009 9:26 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    I second Jim's suggestion.
    Just to make it a bit more clear. You do not want to calculate the collisions during combat at all, your rpg system will decide (based on range, position, AoD or anything else) if there was a hit or not. In case of a hit the appropriate attributes (health, exp, mana, dex, whatever) will be updated and an action flag set on the player object (this can be locally or even remote in case of a MORPG). The player object will render an animation sequence based on the flag (hit, hitting, evaded, blocked etc).


    HTH
    Riki
  • 11/23/2009 10:44 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    Ehhehe, here i go again debating with everyone else. Anyway, if the system is such that you can attack into direction, without specific target, you will have to know who you hit, e.g. calculate collision on screen. Which does not by the way prevent you from applying any rpg rules. The hit can still be ignored on a dice roll or such.
  • 11/23/2009 11:15 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    Sorry, I don't quite understand what you guys are saying. The combat system I need is going to be the legend of zelda type combat. The enemy really isn't going to be able to dodge at all, but they can use their shield though. I'll have a variable for how long they can hold the shield, and in that time you can't do any damage. Its not going to be like, you walk up to the enemy and you stay there until one of you is defeated. It all happens in the same screen. Not like pokemon. Sorry, I'm just trying to clear some things up.
  • 11/24/2009 12:32 AM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    Aflakjuju:
    Sorry, I don't quite understand what you guys are saying.

    Then maybe your goals are a bit too high.
  • 11/24/2009 12:56 AM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    u551:
    Ehhehe, here i go again debating with everyone else. Anyway, if the system is such that you can attack into direction, without specific target, you will have to know who you hit, e.g. calculate collision on screen. Which does not by the way prevent you from applying any rpg rules. The hit can still be ignored on a dice roll or such.


    I would recommend having an actual battle engine with the responsibility of calculating if a monster/item/chest has been hit my the character.

    It sounds like you want to place gameplay logic (collision/range checks and health/mp manipulation) into the draw method. That is a risky business because (apart from being bad design) it can end up being pretty much unmaintainable code if you are in a medium or larger team.

  • 11/24/2009 1:08 AM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    ok then, I haven't gotten to the combat part yet, but you guys know better then I do.
    Thanks,
  • 11/24/2009 1:13 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    anceru:

    It sounds like you want to place gameplay logic (collision/range checks and health/mp manipulation) into the draw method.


    Definately not, sorry if I was unclear about that. I hope original poster didnt start doing it that way...
  • 11/24/2009 2:44 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    Last night I had time to think about what you guys have said, and I thought it was possible to put collisions in a class,
    But I guess not. If one of you could explain what you guys are saying in more detail(if possible), then I would really appreciate it.
    Thanks,
  • 11/24/2009 3:06 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    In your Update method, you want to call your battle engine and make it check for collisions/range on your map. The engine should change the characters' and/or monster's AnimationState flag (could be enumeration {walking, attacking, missing, hitting}) depending on is collision is detected (and if the hero is able to hit the monster if you use Evasion/Accuracy modifiers).
    Later in the draw method, whatever class that is responsible for drawing the characters on the map would check each character's and/or monster's AnimationState flag and make sure to draw their animations based on it.
    This require that you have already got the animation classes in your code. (if you build your game based on the RPG starter kit each character will have a Walk and Idle sprite, all you have to do is add more :) )

  • 11/24/2009 3:34 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    You can put your collision detection in a class, but that's not the answer IMO for doing combat resolution. Animations like swinging a weapon should just be a visual representation of what the combat engine is doing behind the scenes. If the player tells the avatar to attack an enemy, the combat engine kicks in and resolves the attack. If you have separate animations for hitting an enemy and missing an enemy the combat engine sets the appropriate animation based on the resolution of the attack. How complicated you want to make this depends on you.
  • 11/24/2009 6:16 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    @anceru, Ok, I am making all of the sprites myself.

    Ok, Thanks.
  • 11/24/2009 7:28 PM In reply to

    From "Hello World" to RPG - why?

    Sorry for kinda stealing this thread for something so off topic, but I was always wondering why all the people who start coding decide to make a RPG game after finishing the Hello World ????
    Please note that I am not having any particular person in mind, just a general question.


    Now back to something more on topic and the OP:
    Please take my advice I usually know what I am talking about even if I sound like a dipshit most of the time.
    Don't do any collision detection. You can use that for moving, but even for that there are much better solutions than collision.
    * Do something doable, not something you will need to read 101 tutorials with every single one of them pointing you to 5 new links.
    * Do something you already know how to do or at least choose to implement the ideas you know they can be implemented
    * Do something small, reduce all the features as much as you can just to get something up & running. It will be 1000x easier to build new features on a already working game with one single feature (like movement) than to develop a non working game with 20 features
    * Do not even start complex things (like mesh collision), you always can decide later that you need exactly that and replace the current function/class/whatever with feature X

    What you should do is:
    * make your character movable
    * make at least few animations
    * make it world aware (avoid running through wals and obstacles)
    * implement a dice system - you need to roll dices to decide whether you did hit a mob, not to check sword collisions vs enemy. This will become the most important part of your game - trust me!!!
    * make a usable menu with character setup or whatever you need to start the game
    * do not start with any AI except maybe implementing a spawnpoint concept and most primitive "move towards player if in range" AI logic


    That's all folks
    I am kind of exhausted with all those similar topics regarding game design and mesh collisions.
    I will be very happy to help though - if there is a very specific question and I know the answer.

    HTH



  • 11/24/2009 8:01 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    I was always wondering why all the people who start coding decide to make a RPG game after finishing the Hello World?

    LOL, your right. I should start with something simpler.

    What you should do is:
    1. make your character movable
    2. make at least few animations
    3. make it world aware (avoid running through wals and obstacles)
    4. implement a dice system - you need to roll dices to decide whether you did hit a mob, not to check sword collisions vs enemy. This will become the most important part of your game - trust me!!!
    5. make a usable menu with character setup or whatever you need to start the game
    6. do not start with any AI except maybe implementing a spawnpoint concept and most primitive "move towards player if in range" AI logic

    1. Check.
    2. Check.
    3. Not yet.
    4. Nope.
    5. Yes.
    6. No.

    I changed it to a number list so its slightly easier to read.
  • 11/24/2009 10:13 PM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    Dudes, the poster said he wants zelda-like combat. Not much RPG there. You choose your target by hitting him, so youll have to do collision test, and if theres dices to roll to check actual hit, do it, but they cannot be rolled before you have a target.

    And yeah RPG as a first project is somewhat... Ambitious.
  • 11/25/2009 4:28 AM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    he,he guess I am the only one here who never played zelda :-)
    But the topic is explicitly set to RPG prg. + combat system and there is no such thing like collision based combat in a RPG. You choose your target by R or L clicking on it and a good dice roller with configurable parameters is the very heart of all combats.
  • 11/25/2009 5:27 AM In reply to

    Re: RPG Programming Using Xna, Real Time Combat System?

    ERiba:
    he,he guess I am the only one here who never played zelda :-)

    Nope, I don't do Zelda games either. I prefer real RPGs. :)
Page 1 of 2 (49 posts) 1 2 Next > Previous Discussion Next Discussion