| | |
RPG Battle Action
Thread Solved |
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?
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?
Sorry LaMouche, I think we were thinking the same thing at the same moment.
Take a look at http://www.daniweb.com/techtalkforums/thread59965.html
I was thinking of changing the hitlist itself depending on weapon, armor or monster.
Take a look at http://www.daniweb.com/techtalkforums/thread59965.html
I was thinking of changing the hitlist itself depending on weapon, armor or monster.
Last edited by vegaseat; Oct 30th, 2006 at 11:15 pm.
May 'the Google' be with you!
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?
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?
If in doubt, reach into the trash can and remove the user guide.
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.
If in doubt, reach into the trash can and remove the user guide.
•
•
Join Date: Jul 2006
Posts: 608
Reputation:
Solved Threads: 150
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:
That is, if the character casts the limit break, he jumps to the front of the line.
Jeff
In the specific case of a limit break, it would be easy to implement without a double queue:
Python Syntax (Toggle Plain Text)
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
![]() |
Similar Threads
- RPG Battle Simulation (Python)
- Rpg (Python)
- RP Battle Simulator (Java)
- global or function? (Python)
- Enhancing a Text based RPG (C++)
Other Threads in the Python Forum
- Previous Thread: RPG Battle Simulation
- Next Thread: Random.choice, A Pronouncing Dictionary, The Polysemy
| Thread Tools | Search this Thread |
abrupt accessdenied ansi anti apache application approximation argv array backend beginner book builtin calculator change converter countpasswordentry curved dan08 dictionaries dictionary dynamic edit enter file float format function heads homework import inches input keyboard lapse library line lines linux list lists loop microphone mouse movingimageswithpygame mysqlquery newb number numbers numeric output parameters parsing path phonebook plugin pointer prime programming progressbar py2exe pygame pyopengl python random recursion redirect remote reverse scrolledtext session simple software sprite statictext statistics string strings syntax table terminal text textarea thread threading time tlapse trick tuple tutorial twoup ubuntu unicode unit urllib urllib2 variable wordgame write wxpython






