Topic:   Roguesoft Battle Engine   (Read 36848 times)


0 Members and 3 Guests are viewing this topic.

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Roguesoft Battle Engine
« on: March 26, 2009, 06:14:16 AM »
I'm working on a powerful yet easy to understand open source battle engine to promote RPGs, and here's what I have so far:

link removed

The engine is turn based and supports 1 on 1 combat. Currently the engine contains attack strength, attack accuracy, attack evasion and status effects. I'll get crackin' on Spells soon and then Items. Eventually I'd like to give monsters multiple attacks to choose from and possibly even multiple attacks per turn, but I'll work on the easier stuff first.

Important: You don't need to understand any of the code to use the engine in your game, you just need to set the stats of your game's enemies on card 7. (the "Encounter" card) These are the stats for each enemy:

Quote
EnemyName$
- The name of the enemy.

EnemyCardPic
- The number of the card containing the enemy's picture.

EnemyHP
- The health of the monster when the battle begins. (should equal "EnemyMaxHP")

EnemyMaxHP
- The total health of the monster. Healing effects won't restore health above this number.

EnemyCondition$
- The status condition of the monster. ("Normal", "Poisoned", "Asleep" etc.) Should equal "Normal".

EnemyWeapon$
- The name of the enemy's weapon. Example: "The Orc attacks with its Orc Crossbow!" or "The Grey Wyrm attacks with its Dragon Talon!"

EnemyATKBase
- The minimum amount of damage inflicted when an attack hits.

EnemyATKBonus
- A random amount from 1 to this number will be  inflicted when an attack hits.

EnemyWC
- The enemy's weapon class. ("chance to hit" improvement) The base chance to hit is 50/50.

EnemyAC
- The enemy's armor class. ("chance to avoid" improvement) The base chance to avoid is 50/50.

EnemyInflictPoisonChance
- The chance for an enemy to poison the player on a successful attack hit. A random amount between 1 and this number is rolled, if the number is 1 the effect occurs. (set to 0 to remove the effect)

EnemyInflictSleepChance
- The chance for an enemy to charm the player to sleep on a successful attack hit. A random amount between 1 and this number is rolled, if the number is 1 the effect occurs. (set to 0 to remove the effect)

The you set the player's stats in the same way:

Code: [Select]
PlayerName$ = "string"
PlayerHP = value
PlayerMaxHP = value
PlayerCondition$ = "string"
PlayerWeapon$ = "string"
PlayerATKBase = value
PlayerATKBonus = value
PlayerWC = value
PlayerAC = value
PlayerInflictPoisonChance = value
PlayerInflictSleepChance = value

So all you need to do to initiate a battle is this:

Code: [Select]
EnemyName$ = "Whatever"
GOTOCARD BattleCard_Encounter

Simple, sweet, and sugar free. You can easily edit the amount of damage Poison inflicts as well as the chance of Sleep recovery by changing the vars on card 2. Anyone is free to modify and/or add to the source file, so if you can't be bothered waiting for me to implement improvements, feel free to hit the code yourselves. The vars all have easily readable names, and I've commented pretty much every routine to make the entire thing understandable to anybody.

Suggestions and feedback would be greatly appreciated, as I'm making this for the GMG and wanna add your ideas to the engine. Also, if any of my explanations seem confusing or if there's something you don't understand, tell me and I'll explain in more detail. The engine looks a little complicated with all the vars, but I assure you it's really easy to use. :)

As always: Enjoy!
« Last Edit: September 16, 2009, 03:44:44 AM by Silverwind »
I survived the spammage of 2007

Al Staffieri


  • GMG-er

  • **

  • no avatar

  • Posts: 452

  • I love GameMaker
Re: Roguesoft Battle Engine
« Reply #1 on: March 26, 2009, 11:40:34 AM »
excellent I just tried it out. I'm going to upload it to the GameMaker addons page.

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Roguesoft Battle Engine
« Reply #2 on: March 26, 2009, 03:58:13 PM »
Good idea. :) I'm halfway through adding spells already, so I'll probably post an update tomorrow.
I survived the spammage of 2007

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Roguesoft Battle Engine
« Reply #3 on: March 28, 2009, 09:43:55 AM »
Here's the update: http://www.mediafire.com/?jgotyn5wjtz

Now all stats are written in percentile format with the exception of damage, (which is still left to user discretion) thus setting PlayerInflictPoisonChance to 25 would result in a 25% chance of poisoning an enemy when an attack hits.

The update's main addition is the spell system though. It's really easy to add spells to the game, just edit the "Spell List" sub routine in button 2's script on card 8. You'll also need to add the following line to the "<<" and ">>" buttons once for each spell in your game:

Code: [Select]
IF PlayerSpellSelected = 1 THEN PlayerSpellSelected$ = PlayerSpell1$

So if there's 5 spells in your game, the code would look like this:

Code: [Select]
IF PlayerSpellSelected = 1 THEN PlayerSpellSelected$ = PlayerSpell1$
IF PlayerSpellSelected = 2 THEN PlayerSpellSelected$ = PlayerSpell2$
IF PlayerSpellSelected = 3 THEN PlayerSpellSelected$ = PlayerSpell3$
IF PlayerSpellSelected = 4 THEN PlayerSpellSelected$ = PlayerSpell4$
IF PlayerSpellSelected = 5 THEN PlayerSpellSelected$ = PlayerSpell5$

Here are all the current properties a spell can have:

Code: [Select]
SpellEffect_HPRecovery = 0
SpellEffect_HPRecoveryBase = 0
SpellEffect_HPRecoveryBonus = 0
SpellEffect_Damage = 0
SpellEffect_DamageBase = 0
SpellEffect_DamageBonus = 0
SpellEffect_InflictPoisonChance = 0
SpellEffect_InflictSleepChance = 0

Here are the 5 template spells I've included in the game:

Code: [Select]
    IF PlayerSpellSelected$ = "Magic Missile" THEN
 Â     SpellType$ = "Offensive"
 Â     SpellEffect_DamageBase = 4
 Â     SpellEffect_DamageBonus = RANDOM 8
 Â     SpellEffect_Damage = SpellEffect_DamageBase + SpellEffect_DamageBonus
 Â   END IF

 Â   IF PlayerSpellSelected$ = "Sleep" THEN
 Â     SpellType$ = "Offensive"
 Â     SpellEffect_InflictSleepChance = 100
 Â   END IF

 Â   IF PlayerSpellSelected$ = "Heal Wounds" THEN
 Â     SpellType$ = "Defensive"
 Â     SpellEffect_HPRecoveryBase = 5
 Â     SpellEffect_HPRecoveryBonus = RANDOM 16
 Â     SpellEffect_HPRecovery = SpellEffect_HPRecoveryBase + SpellEffect_HPRecoveryBonus
 Â   END IF

 Â   IF PlayerSpellSelected$ = "Acid Arrow" THEN
 Â     SpellType$ = "Offensive"
 Â     SpellEffect_DamageBase = 3
 Â     SpellEffect_DamageBonus = RANDOM 7
 Â     SpellEffect_Damage = SpellEffect_DamageBase + SpellEffect_DamageBonus
 Â     SpellEffect_InflictPoisonChance = 25
 Â   END IF

 Â   IF PlayerSpellSelected$ = "Poison Cloud" THEN
 Â     SpellType$ = "Offensive"
 Â     SpellEffect_InflictPoisonChance = 100
 Â   END IF

I'm gonna write a readme soon which'll include instructions for everything, but until then: Enjoy!
« Last Edit: March 28, 2009, 10:17:35 AM by Silverwind »
I survived the spammage of 2007

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Roguesoft Battle Engine
« Reply #4 on: April 01, 2009, 03:15:52 PM »
So, what do you guys think? Is the interface easy enough to understand?
I survived the spammage of 2007

WarHampster


  • GMG Extraordinaire

  • ***


  • Posts: 1501

  • The People's Moderator
    • Arcade of the Absurd
Re: Roguesoft Battle Engine
« Reply #5 on: April 01, 2009, 03:22:36 PM »
I guess I should just buy Game Maker so I can be involved in this stuff.

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Roguesoft Battle Engine
« Reply #6 on: April 02, 2009, 09:07:58 PM »
That sounds like a great idea.
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Roguesoft Battle Engine
« Reply #7 on: April 03, 2009, 04:30:33 AM »
Hey Tireas, how did you go about handling multiple enemies in Darksville? Did you copy and paste the entire battle routine for each enemy, or did you use 1 routine and reference different stats for each monster? Also, can each monster attack each turn in Darksville?
I survived the spammage of 2007

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Roguesoft Battle Engine
« Reply #8 on: April 04, 2009, 12:16:31 AM »
Darksville's battle engine stopped working. I think it only worked at first because of a glitch in GM. But Rokeno's Battle Engine appears to be working.

Well handling multiple enemies was easy.
GroupAnumber
GroupAleft
So every time you kill one GroupAleft would be - 1
and after all GroupA was dead groupB would take its place and groupC would take groupB and D's, C's. I did that using the SWAP command

The battle engine only allowed all the bad guys in groupA and groupB to attack you. In Rokeno the monsters in groupC and groupD will be able to attack you if they are ranged or use magic.

In Darksville I used 1 hit point counter to describe the hitpoints for each bad guy so after one was dead the hp would re-randomize and you would have the next guys hp. In rokeno I fixed that problem by giving each bad guy his own hp by using String variables to contain them.

I used Repeat for for multiple enemies so after one was done it would go to the next and keep on doing that until all the enemies were done attacking.
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.