Search Unity

Using 2D Sprites For a "Dragon Force"-Like Mass Combat Game?

Discussion in '2D' started by KrisSchnee, Mar 28, 2015.

  1. KrisSchnee

    KrisSchnee

    Joined:
    Mar 9, 2014
    Posts:
    15
    I'm thinking about imitating the basic battle mechanics of the old Sega game "Dragon Force", seen below. There was a 2D battlefield where armies of maybe 100 guys on a side fought. They ran left and right, attacking anyone they encountered, but there were also around 10 rows of sprites reaching into the background, and soldiers could run along the foreground-background axis. What do you think about a good way of setting that up?

    My thinking so far is, use a 3D camera to get scaling of sprites foreground->background. Let there be a grid defined in code, where soldiers move smoothly (Lerp) between points and each point can hold one soldier. When a soldier's AI runs, if it has reached a grid point, look for an adjacent point that's not marked as occupied. On success, mark it occupied, mark their current point unoccupied, and start moving. Also when reaching a grid point, consider attacking if there's an adjacent point occupied by an enemy. This way, soldiers won't physically overlap even if their sprites do (because one's in the foreground), and they can recognize when an enemy is near.

    However, there needs to be a way to indicate who's being attacked. It'd be nice to use Unity 2D physics here, but wouldn't there need to be a separate layer for every foreground/background row, with sprites rapidly changing layers? In the screenshot's foreground for instance, there's a big sword slash that should only hit the one blue-haired guy just left of the soldier, not the grey warrior whose sprite is touching the slash animation.

     
  2. lemmons

    lemmons

    Joined:
    Jun 20, 2016
    Posts:
    68
    Hey I had this exact same idea! I'm actually working on it right now. I love this game and would love to see any progress you've made, maybe we could collaborate or at least share findings?
     
  3. KrisSchnee

    KrisSchnee

    Joined:
    Mar 9, 2014
    Posts:
    15
    Wow, it's been a while since I worked on this project! I built a really basic demo at http://kschnee.xepher.net/code/unity/150406mass_combat.html with free movement in 2D, then one with a more complete battle and better efficiency at http://kschnee.xepher.net/code/unity/150428mass_combat.html . This second version has a 100v100 fight with several possible orders and different troop strengths. The AI and movement are based on an invisible grid; characters only move at fixed intervals in 8 directions. Combining Unity physics with the 2D'ish movement works, as with the ranged spell, and looks cooler than Dragon Force's horizontal-only arrows. I wasn't sure how much to impose my notion of a grid on Unity, eg. "should characters only be able to move to a grid node that hasn't been claimed as occupied by a troop that's about to move into it?" and "should a node represent where one guy can stand, or should it be able to hold one troop from each side?"

    Regarding gameplay, a modern game in this style should have the spectacle of huge numbers of troops clashing without RTS-like micromanagement. Still there should be squads so that you can have two or three troop types at once, taking different actions. The game should use the physics system for some basic terrain effects, like barricades and hovering characters. I'd like to see officers be less absurdly powerful than in DF, and fights often ending in withdrawals rather than 100% casualties. A mini-version of the DF map could make battles into more interesting sets of decisions where the player thinks, "I can't control everything that happens once I send my knights here, but I can tell them to hold this route while the clerics heal my wounded archers". DF's concept of slowly moving units on a map could be good for representing troop movements in between the side-view brawls, and for handling messengers, to play up the idea that you're not a war-god fully aware of the battle. If the concept of grid movement gets changed a bit, it could allow for loose vs. dense combat formations with various bonuses. I'd like to see wizards raising walls of ice, cloud-riding pegasi dropping rocks, and shield-bearers trying to haul a siege engine up to a castle wall.

    I will be completing a science fiction novel very soon, so I'll have time to devote to a different project. Do you have any screenshots or specific ideas in mind for your take on the concept?
     
    jc-drile77 likes this.
  4. lemmons

    lemmons

    Joined:
    Jun 20, 2016
    Posts:
    68
    Wow those demos are great prototypes. So I maybe got ahead of myself when I said "working on it right now". What that really means is I have an Evernote notebook absolutely chock full of ideas for this type of game and how it could translate to mobile really well. We have a lot of the same ideas like terrain, barriers, and different troop types and squads using AI to do stuff other than smack each other until the general kills like 40 dudes by himself.

    I also wanted the general to have abilities that affect the battlefield and to be more involved in the battle if they wanted to. Obviously you could choose to hang back and toss out sonic booms or spells but if you wanted to get into the fray and have auras that buff your troops, create barriers, or summon beasts to fight by your side that would make the battle system more interactive. Also having more beneficial effects from troop formations like +atk/-def, +speed/-atk etc. making general duels more interactive, and a bunch of other stuff.

    Some other games have touched on these ideas but never achieved the success of DragonForce. I picked up Aedis Eclipse on PSP for "research purposes" because I heard it was like a modern day DF but the execution was pretty poor and not enjoyable to me. I did like how the hero general was interactive in the battle and even the isometric feel was an interesting touch. Also DragonForce 2 (never released in english) touched on the general's involvement and the ability to mix troop types in a unit but I've never had the change to play it even though I've scoured the internet for a rom.

    I've always wanted to do game development but web development has been my full time job for a couple years now and has been taking up all my time. I just picked up Unity and realized after reading on /r/gamedev and the Unity forms that there's pretty much no way I'm going to hop right in and build my DragonForce+ so I'm starting small with platformers and roguelikes for the time being so I don't actually have any tangible work on the DF game even though it's my end goal.

    Even just reading your response about the grid was enlightening. I would love to stay in touch so we could share notes on our progress!
     
  5. lemmons

    lemmons

    Joined:
    Jun 20, 2016
    Posts:
    68
    Oh and side note about the grids, I found this site that goes into heavy detail about hexagonal grids and I think it might be useful for our situation when it comes to pathing and deciding how units interact with each other: http://www.redblobgames.com/grids/hexagons/
     
  6. KrisSchnee

    KrisSchnee

    Joined:
    Mar 9, 2014
    Posts:
    15
    http://kschnee.xepher.net/code/unity/160626army_battle.zip has today's draft of the code, cleaned up somewhat. I dusted off the old code and added the ability for soldiers to turn around and flip their sprites while running in the other direction. I've got the Animator for the soldiers set to have three variables: Attacking, FacingLeft, and Moving. Right now soldiers told to "advance" will start out moving forward but (since this is test code) randomly switch directions. They also auto-attack nearby enemies but appear to attack "forward" regardless of where the enemy is, rather than turning around. You're free to copy/modify/&c the code if it's at all useful. Thanks for the hexagon reference.