RPG Battle Engine - Alpha 7.5, downloads in first post

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
azureXtwilight
Megane Procrastinator
Posts: 4118
Joined: Fri Mar 28, 2008 4:54 am
Completed: Fantasia series (ROT and ROTA), Doppleganger: Dawn of The Inverted Soul, a2 (a due), Time Labyrinth
Projects: At Regime's End
Organization: Memento-Mori VNs, Team Sleepyhead
Location: Yogyakarta, Indonesia.
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#76 Post by azureXtwilight »

So I was trying to add a new skill whenever the character leveled up using this code:

Code: Select all

 gerald = PlayerFighter("Gerald",  Speed=40, Attack=50, Defence=60, Health=300, MP=200, XP=0, Level=1, sprite=GetGeraldSprite())
        
        geraldLevels = LevelPlan(gerald)
        geraldLevels.AddLevel(30, {'Speed': 2, 'Attack': 5, 'Defence': 3, 'Health':15}) #lv 2
        geraldLevels.AddLevel(90, {'Speed': 3, 'Attack': 7, 'Defence': 2, 'Health':20}) #lv 3
        geraldLevels.AddLevel(180, {'Speed': 4, 'Attack': 9, 'Defence': 2, 'Health':25}) #lv4
        geraldLevels.AddLevel(300, {'Speed': 5, 'Attack': 9, 'Defence': 3, 'Health':30}) #lv5
        geraldLevels.AddLevel(420, {'Speed': 6, 'Attack': 2, 'Defence': 2, 'Health':30}) #lv6
        geraldLevels.AddLevel(560, {'Speed': 7, 'Attack': 3, 'Defence': 4, 'Health':35}) #lv7
        geraldLevels.AddLevel(680, {'Speed': 8, 'Attack': 5, 'Defence': 5, 'Health':35}) #lv8
        geraldLevels.AddLevel(800, {'Speed': 9, 'Attack': 7, 'Defence': 3, 'Health':40}) #lv9
        geraldLevels.AddLevel(1000, {'Speed': 10, 'Attack': 5, 'Defence': 4, 'Health':40}) #lv10
        geraldLevels.AddLevel(1140, {'Speed': 11, 'Attack': 3, 'Defence': 5, 'Health':45}) #lv11

I copied and pasted the code

Code: Select all

gerald_level = gerald.GetStat("Level")
        if gerald_level  >= 2:
            gerald.RegisterSkill(Library.Skills.HammerFist)
        if gerald_level >= 4:
            gerald.RegisterSkill(Library.Skills.Heallv1)    
        if gerald_level  >= 5:
            gerald.RegisterSkill(Library.Skills.Haymaker)    
        if gerald_level  >= 7:
            gerald.RegisterSkill(Library.Skills.Protect)    
        if gerald_level  >= 9:
            gerald.RegisterSkill(Library.Skills.SuckerPunch)    
        if gerald_level >= 11:
            gerald.RegisterSkill(Library.Skills.HammerFist2) 
to the next battle setup (the second battle and so-on, so that the "level" stats are defined) and it works. I guess it'll be a help to anyone who wants to do the same thing, although the long-term effect isn't known yet.

It's kinda good to have the first battle as a "tutorial" easy battle or whatnot for the sake of the code to work XD
Image

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#77 Post by Jake »

azureXtwilight wrote: I guess it'll be a help to anyone who wants to do the same thing, although the long-term effect isn't known yet.
Levelling-up imparting skills is something I've been meaning to do for a while and haven't got around to yet, sorry!

What you posted should work fine, though. The only drawback I know of is that unlike the regular level bonuses, those skills won't be lost if the fighter's XP ever goes down. (The regular XP bonuses have code to roll back the bonus if the fighter's XP goes below the threshold they were awarded at, since some games may want to - say - have a fighter lose a bit of XP every time they're knocked out, or something.)
Server error: user 'Jake' not found

Friendbot2000
Regular
Posts: 161
Joined: Tue Feb 15, 2011 8:00 pm
Projects: Mutagen : Journey to Haven's Landing
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#78 Post by Friendbot2000 »

Code: Select all

 geraldLevels.AddLevel(30, {'Speed': 2, 'Attack': 5, 'Defence': 3, 'Health':15}) #lv 2
Azure,
Is the 30 the XP threshold that the character has to meet to level up?

Also, got another question for you Jake.

So for my game I plan to do Fire Emblemesque battles with isometric grids and whatnot. In the game there will be a lot of different story factions and also enemy class types. Would it be wise to put each story faction and enemy type into its own specific faction that you declare when constructing the battlefield?
Visit my game development group's Facebook page : Timekeeper Games
Mutagen : Journey to Haven's Landing Facebook Page
Follow our Twitter feed too : TK Games

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#79 Post by Jake »

Friendbot2000 wrote:

Code: Select all

 geraldLevels.AddLevel(30, {'Speed': 2, 'Attack': 5, 'Defence': 3, 'Health':15}) #lv 2
Azure,
Is the 30 the XP threshold that the character has to meet to level up?
That part of the code she posted is from the regular battle engine XP support - have a look in the XP demo for comments on all of that.

The number 30 in the above example is how much XP the fighter needs to gain on top of their previous level to hit the next level. So if you have three AddLevel calls with 10, 15 and 25 respectively, then the fighter needs to accrue a total of 50XP to hit the third level.

Friendbot2000 wrote: So for my game I plan to do Fire Emblemesque battles with isometric grids and whatnot. In the game there will be a lot of different story factions and also enemy class types. Would it be wise to put each story faction and enemy type into its own specific faction that you declare when constructing the battlefield?
Factions in battles determine three main things:

- Who wins and when
- Who takes their turn and when
- Which fighters are considered valid targets

If you set a battle up with the simple win condition, then the battle will only end when a only single faction survives - so the player and their allies at least should be in a single faction.

If you use a SimpleTurnSchema, then each faction takes their turn all at once - so if you set up six factions in the battle, then there will be a cycle of six different factions' turns.

The 'friendly' or 'enemy' targeting options are literally just driven off "is the other fighter in the same faction as me or not". So if you set up a player's allies in a separate faction, then you'll be able to attack them but won't be able to cast friendly-only spells on them. Perhaps more importantly, if you set up two separate AI factions then they will happily attack each other.



Generally you want just two factions in most battles - the player's side and the AI enemy side. If you want allies that the player doesn't directly control, then just add AI fighters to the same faction as the player. Factions in your story and factions in your battle setup are two separate things.

If you want to depict the Hatfields versus the McCoys versus Federal Agents, then set them up as three separate factions - they'll each happily attack each of the other two factions.
Server error: user 'Jake' not found

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#80 Post by Jake »

So!

It's nearing March, which means NaNoRenO - would anyone be interested in a quick release of the scripting stuff (here's an example of what it'll look like) in time for NaNo?

If nobody's interested I'd rather leave it until after in order to finish all the script commands I want to support and produce a decent set of demos/examples of script use... and to avoid the possibility of script commands changing between now and the scripting being finished. But if anyone would like to use it in NaNo projects, I'm happy to package it all up and provide a couple of quick demos to show how it's done.

(Otherwise I'll just get on with planning my own NaNo game, which will probably have a lot of rusty red in it.)
Server error: user 'Jake' not found

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#81 Post by DaFool »

Your nano game be battle engine-powered also? I'm thinking of using the dungeon crawling engine with some battle engine extensions to make something that isn't strictly a dungeon crawler.

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#82 Post by Jake »

DaFool wrote:Your nano game be battle engine-powered also?
Naturally! I'm planning on an isometric sci-fi tactics game right now.

I saw Nyaatrap's dungeon crawler, looks good! I started planning something like that as a battlefield a while ago, but got sidetracked thinking about raycasting, and that sidetracked me thinking about texturemapping, and that sidetracked me thinking about non-affine transforms, and that all just reminded me I've got lots of more-fundamental stuff that needs to be done before I start doing anything like that! ;-)
Server error: user 'Jake' not found

CaseyLoufek
Regular
Posts: 142
Joined: Sat May 28, 2011 1:15 am
Projects: Bliss Stage, Orbital Knights
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#83 Post by CaseyLoufek »

I always preferred games like the old D&D games and Ultima 3-5 where you had a first person dungeon navigation but went to miniatures-style combat. The dungeon crawler view really opens up a lot of options and I think Ren'py may now be a better choice than say DungeonCraft for such projects.

User avatar
latte
Regular
Posts: 176
Joined: Thu Jan 17, 2013 12:33 pm
Projects: Memories of Summer Winds, untitled KN
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#84 Post by latte »

Sorry for the extremely dumb question, but what does "active" battles mean? Can you make action RPGs with this?

CaseyLoufek
Regular
Posts: 142
Joined: Sat May 28, 2011 1:15 am
Projects: Bliss Stage, Orbital Knights
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#85 Post by CaseyLoufek »

Active mean dynamic initiative order. Instead of A then B then C going and repeating that cycle, each character gets a few action points each "tick" and any characters with over 100 points get to act. So on many rounds nothing may actually happen.

It makes timing much more precise and makes it easy to have one character take one 4 actions for every 3 another character performs for example. Characters don't have to have the same amount of turns.

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#86 Post by Jake »

Specifically, the 'active' battles are meant to mimic those seen in traditional JRPGs, like earlier Final Fantasy games (the name is a reference to FF's "Active Time Battles"). Each character's 'readiness' bar fills up at a different rate, and once full they get to take a turn.

As opposed to 'turn based', where everyone on one side takes a go and then everyone on the other side takes a go.




Action-RPGs would really need real-time input processing, enemy AI and so on. While that's perfectly possible with Ren'Py, it's also different enough from the kind of games this engine is aimed at that it's not really feasible to support both of them at the same time. I'm not planning on including any proper real-time elements in this project.
Server error: user 'Jake' not found

User avatar
latte
Regular
Posts: 176
Joined: Thu Jan 17, 2013 12:33 pm
Projects: Memories of Summer Winds, untitled KN
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#87 Post by latte »

Thank you. When you put it like that, it's perfectly understandable that you don't plan to include real-time elements, so probably I'll experiment with the active battle system for the time being.

While this deviates from the purpose of the thread, does someone know an engine that supports action RPGs and can be integrated into a Ren'Py game? That is, if such thing exists.

Friendbot2000
Regular
Posts: 161
Joined: Tue Feb 15, 2011 8:00 pm
Projects: Mutagen : Journey to Haven's Landing
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#88 Post by Friendbot2000 »

Unfortunately using Renpy for action oriented games really isnt feasible. It is possible, but it will require a lot of skill and you will have to sacrifice a lot to load balance. Action games are processor heavy and require a lot of rendering power that Renpy probably can't handle. If you infuse it with python it might be possible. You have to understand that Renpy is geared and centered around visual novel style game dev. It can be extensible to adapt games that resemble Fire Emblem, but 3D modeling and animation is really outside the scope of the language. Not to mention the nightmare you would have trying to debug it in the QA stage. Of course I am assuming you are thinking about 3D modeling and other things like that. 2D action animation really isnt a problem, but know that you will be doing a ton of drawing to make the animations not look like garbage and you will need to be very comfortable with python to achieve what you want.
Visit my game development group's Facebook page : Timekeeper Games
Mutagen : Journey to Haven's Landing Facebook Page
Follow our Twitter feed too : TK Games

User avatar
Mole-chan
Veteran
Posts: 333
Joined: Thu Aug 27, 2009 12:46 am
Completed: DUAEL, Escape from Puzzlegate
Projects: A Bird with Gold-Mended Wings
Deviantart: mole-chan
Skype: mole-chan
itch: moleworks
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#89 Post by Mole-chan »

Hello, me again. Hopefully the last bug fix before the game is ready to go.

I tried to adjust the loot drop procedure you helped me with earlier to also drop items by amending this code.

Code: Select all

    $itemGet = dropItem.pick()
    if itemGet:
        $equipmentGet = dropEquipment.pick()
        if equipmentGet:
            $item_dropped = basicStore[(renpy.random.randint(0, 9))]
            $inv.AddItem(item_dropped, 1)
        else:
            if location == "Moordell" or location == "Byesdam" or location == "mountain":
                $item_dropped = secondaryStore[(renpy.random.randint(8, 11))]
            else:
                $item_dropped = basicStore[(renpy.random.randint(10, 11))]
            $inv.AddItem(item_dropped, 1)
        $item_name = item_dropped.Name
        "Enemy dropped a(n) [item_name]!"
    return
   
It picks items from an array and adds them to the inventory. It works, but the resulting items have no quantity in the new store, and thus can't be sold.
I'm not sure what would be causing this, and would appreciate the help.

Thank you!

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

Re: RPG Battle Engine - Alpha 7.5, downloads in first post

#90 Post by DaFool »

I'm really wishing for a drag n drop version of the panning code. This would make the Android version more intuitive by making the whole map pannable by swiping.

Post Reply

Who is online

Users browsing this forum: No registered users