Turn based battle system pointers request

6 replies [Last post]
Posts: 1030

In SVO, we'd like to replicate the Earthbound Turn based Battle System, example: http://www.youtube.com/watch?v=nAmBIljqgR8
We've compiled some things we'd like to tackle, but we don't really know how to handle this correctly.

Here's some information:

Quote:
Battle Swirls
  • Only seen by team members
  • Person who collides with an enemy is 'invincible and frozen' during the swirl
  • Red swirl: person got ambushed --> swirl is smaller and lasts a few seconds
  • Green swirl: person ambushes enemy --> swirl is bigger and lasts longer
  • Neutral swirl: no ambush --> swirl is in between green and red, also lasts somewhere in between
  • These swirls also apply to enemy AI, but of course, for them it's the other way around (player ambushing an enemy = enemy gets ambushed --> red swirl for enemy AI)
Psychedelic backgrounds
  1. aPhRo suggested blurred fractals
  2. Darkfrost linked to a topic with more information

Outside battle view possibilities:
Lowered opacity (team: pulsating) - Several icons (outsiders, team members, ...) - SMAAAAAASH icon when a smaaaaash happened inbattle
Option of spectating the battle - not full screen - semi transparant - vulerable to ambushes

Single Player

Timing - Timed battle

  • 2 minutes time to select a move
  • When no move is selected after 2 min --> auto-turn (controlled by AI, customizable) for one turn
  • Disconnection from game --> Autoturn
  • Run away: Enemy & player blink 4s (invincible)
  • Die: 50% of cash on hand is lost + warped to last telephone to dad location (Save Point / Home Point)
  • Shout for help: Takes a battle turn - anyone can join to help out - no items drop, no exp gets given, cash is split into 30%-30%

Multiple players (No NPC Allies)

Things of single player apply

Group Leader

  • Person who creates the group is 'group leader'
  • You make a group when you invite someone and they join
  • Group leader can kick people out of the group
  • Group leader can pass along 'leader' to another group member
  • When group leader gets disconnected the second member to join the group gets leader (and so forth).
  • Only Group leader can invite more people
Timing

Start of each turn: 1minute time to select your move, no move selected => auto turn

Misc

  • Exp/cash shares: 1p (100%), 2p (65%), 3p (45%), 4p (35%) ==> higher exp shares encourages grouping
  • Level difference higher than 5: Extra equation based on level (only for EXP)
  • When dead at the end of a battle: Warped back to homepoint (for alpha)
  • 'Drawn in' range: half a gamescreen
  • When in battle: Click on or run into enemy to join battle (after current battle turn)
  • What happens if the teamleader disbands the group when there are still items in the treasure pool?
  • Teams cannot be disbanded entirely
  • When there's 2 people left in the team, and person A leaves, then all the remaining items in the pool go to person B
  • Boss battles have an extra condition
  • The highest level user in the battle cannot be more than 5 levels higher than the lowest one
  • What about when someone tries to run away? Does the entire group exit the battle? Only the person trying to run away?
  • Only the person who is trying to run will exit the battle

If you've got any idea on how to properly start coding on this (what design patterns to use for example, ...) that'd be awesome.

Some suggestions by other people:

JunJun wrote:
Trigger battle event
  • Object collision detection system by object distance (e.x object distance < Innocent or any netgore related or SMFL collision function(if it exists). Possible loop while moving around to check if someone is around wouldn't take much, performance wise anyways. Which means even the mob shall have this loop so if it runs on you it will initiate a battle with it having advantage, now if you run into it the battle initiates automatically once again but you have the advantage.
  • Battle advantages/initiation parameters
  • Run into a mob as a player(requires client side firstly and secondly server side coding)
  • A mob runs into you(requires sever side coding)
  • Once the battle is initiated the server shall send a signal to the client and the client will redraw and load a new frame with a new screen that will be the battle system screen.
  • Battle details as mentioned below. + server checking the battle progress
  • End of battle, server calculates the outcome and sends it to the client also stores it in some form of statistic in the database

aPhRo wrote:
I was thinking about design patterns and for actually creating the games i think a factory and observer patterns may fit well. I'll explain more when i have time.

Spodi wrote:
All you are going to need to do is expand, not rewrite. That is, you will just be building on top of what NetGore already does. On a high level, it may look something like:

Create a class for holding battle instance information (who the user is, who the NPCs are, and anything else you might want)
Add a reference to this class to User so you know what battle they are in (if any)
When they are in battle (when the reference is not null), do not allow certain events (movement, using items, etc) and allow battle-only events (this step is just a tedious game-logic one where you have to break down every action and determine if its allowed at the given time)
When a user enters a battle, send all relevant information to the client to start the battle display. Of course, also tell the client when a battle is over.
That should be about all it takes. The server still sees the user as just standing there, while the client is displaying this completely different screen. But things remain mostly the same.

Posts: 465

Ok its new years day and im really drunk but seriously design patterns are not meant to be used that way. Its not like you have a problem and suddenly you use erich gamma's "design patterns" and it all works and becomes really clean code, sorry aphro Sad

I haven't played earth bound, but before I give any advice I would like to know what you guys are really asking. For example do you want code examples, a code design or what. Like skye said "but we don't really know how to handle this correctly.", I don't really know what you mean. I'm happy to assist for code design and give some examples and what not. I don't know much about netgore so if its specific to that I can't really help, but otherwise I should be able to give some pointers. Cheers Smile

Posts: 1030

We would like some pointers to get on the right track. You don't have to have played Earthbound to understand the foundation of this kind of battle system, any turn based RPG would do.

Basically what I'm asking (and what DF told me he'd like) is some pointers on where to start, for example what do the server and the client have to do regarding checks, "entering" the battle, finishing/cleaning up a battle when it's over, ...

Posts: 13

I loved Earthbound, Mother 3 was pretty impressive too. OFF-Topic sorry.

Aeon Online
Recruiting Now!
Programmers and Pixel Artist's NEEDED!
Email dimethcone@live.com if you want to recruit
(I'm a horrible pixel artist. Preferrebally Breeze or something like LaTale or MapleStory character *Not chibi, would like them to be

Posts: 164

aPhRo wrote:
I was thinking about design patterns and for actually creating the games i think a factory and observer patterns may fit well. I'll explain more when i have time.

Umm... Factories are static methods that construct objects. Not a huge game changer. (really up to personnel preference, I only use them for certain objects like if they have a very complicated initialization procedure or if naming the constructors would provide more clarity in the code)

The Observer pattern (to my knowledge) is kind of stupid to use in .NET, just use delegates. The only point to using them is if you need a tad more cohesion then just a call back.

Let me just see if I can understand what the hell your saying:
1. (Battle Swirls): So these swirls happen right on the map for other players to see while the engaged players are actually fighting.
I need some rest, just got off a 10 hour flight.

I think you should definitely use interfaces. Yeah, that's not a design pattern, but use interfaces and properties. I wish I was more familiar with netgore, I could definitely give you some more pointers. Definitely consider what interface you need and how you need to use objects. I find it helpful to figure out how an object is going to be used/accessed/disposed/constructed/shared before slapping some fields in a class definition. Also think about how your going to define the data. What parts are in the data and what is hard coded in.

@JunJun:
It's kind of short sided to have a collision method run for both the player and mobs to determine who was really attacking who. Just have the player do the collision check and compare velocities. If the player was moving away and the mob was running after him (can be determined from velocity vector), the player got attacked in the back. If they were moving toward each other, they were probably going head to head. Yeah, sometimes people might get lucky by running straight into a mob without realizing it. Main point: Velocity comparison is you main tool when it comes to figuring out who was attacking who.

Go with what Spodi said. A battle instance class sounds good. You could use some attributes + enumerations to do some cool reflection based definitions for whether an action can take place at the current time (in the current state the player is in). Just a thought.

Posts: 263

Basically, all I want to know is what to use for it serverside - It needs to handle multiple users AND multiple enemies, and how to handle all this at the client end, in netgore. What to use, and what else there is in netgore I can look at for an example of this being used. Wasn't too sure where to start with that, so some help would be nice Smile

Most of the rest of the stuff, I have a decent idea on.

Posts: 531

Just going to defend myself a bit Tongue

To be fair i've only briefly read up on design patterns i can't find a decent book anywhere, and i'd just been messing around with the concepts and could see uses for them in the design i drew up but for the life of me can't find that design in my documents. I think i might have lost it when i backed up and deleted rubbish. Sad I'll look on my backup and if i can't find it i'll have another go after i've completed my assignment. D:

I'll get back to helping you guys out too btw i have every intention to. im just really busy.

There are 10 types of people in this world - Those who understand Binary and those who don't.