Member Avatar for Mouche

This is a split from another thread. I'm trying to think of a good way to simulate action other than just a hit/miss list. I want more complicated results andalso so that the character doesn't always die...

Hmmm... okay.

So I think I would do it like this:

my_str = weapon # fists default!
my_life = 10
weapon = fists
fists = 1
dagger = 2
short_sword = 3
broad_sword = 5

So when the character picks up a new weapon, you change the self.weapon variable... this could apply to armor, too.

What about hit/miss system?

Recommended Answers

All 7 Replies

I like vegaseats Idea for the list usage, but maybe it could be altered alittle bit, say

my_str = weapon # fists default!
my_life = 10
weapon = fists
fists = 1
dagger = 2
short_sword = 3
broad_sword = 5

def battle():

Member Avatar for Geek-Master

Since this is a discussion about the battle system in an RPG, I would like to touch on the turn base aspect of it. LaMouche asked about it in the thread from Vegaseat here http://www.daniweb.com/techtalkforums/thread59965.html.

Here is what I've come up with. In most standard RPGs where there is a battle between the player's team and a few monsters or boss, they each get a turn. Some games allow for a wait or active mode. The wait mode allows each entity in the fight to perform their action before the next one performs theirs. On the other hand you have an active battle system mode which others are performing their actions while you are deciding on what your character is to do. Active mode in my opinion is more fun and more difficult to program. So the question is how do I manage everyone's request during the fight and when they get to perform these actions.

The first thing that jumped in my mind was to create a queue. That way who ever was the fastest could add their action and move on. Just to step aside for a moment and talk about timing in the turn base system. Each entity will have their own statistics that determine how it interacts with its environment. For the turn base system you would use Agility to determine who acts first, second and so on. Sounds like it would work, but only for a basic approach. If you ever played Final Fantasy 7 and executed a limit break you might see where I'm going with this.

In FF7, whenever someone performs a limit break, it seems they skip the others requests to act in the battle and do their thing first. Lets say Tifa was first and has been assigned to attack MonsterA, but Cloud executes his limit break. Then all of a sudden Cloud goes before Tifa. Well a queue can't do this. Its function is First In First Out, so a queue is inadequate for the job. I would like to know what would be better. I've looked at a Deque in C++, but I'm not sure. It does act like a vector in the way you can access values via index and that it could be re-allocated during run-time. However, a vector is contiguous in memory where a deque isn't, so you can't use pointer arithmitics. The reason why I'm not sure about the deque is if you execute something in the middle, can you remove it without causing a gap in the queue?

Member Avatar for Geek-Master

I talked with one of our CIS instructors who had no problem answering how to handle higher priority actions in a battle. His solution was to create two queues. The first being the high priority actions and a second for normal actions. Whenever the game loop runs through just query for any actions in the priority queue first and execute them before the normal actions. He also told me that this scenario is only good for one exception, if there were more he recommended using some sort of tree data structure.

Let's assume that you're implementing the queue with a simple list.

In the specific case of a limit break, it would be easy to implement without a double queue:

if action == limit_break:
   action_queue = [character] + action_queue
else:
   action_queue.append(character)

That is, if the character casts the limit break, he jumps to the front of the line.

Jeff

Member Avatar for Geek-Master

So is the second line a re-allocation of the queue?

So is the second line a re-allocation of the queue?

hope u make that battle sys

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.