Page 20 of 22

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Mon Sep 05, 2011 6:44 pm
by Jake
New release - Alpha 6, including experience, levelling, condition/result events (allowing more-complex win conditions), multi-square scenery and lots of bug-fixes - including a much-improved panning camera.

More details in the first post in the thread, and the release can be downloaded from here:

Alpha 6 - Zipped game directory[9.9MB]



I'm not promising to keep updating this thread with up-to-the-minute information, so - as Blakjak helpfully noted before - if you're interested in more prompt news about ongoing battle engine development, it's best if you subscribe to the email newsletter here:

http://eviscerate.net/newsletter/subscriptions

- obviously, I won't give your email address to anyone and I'll only use it for battle-engine-related mail, and you can unsubscribe via an automated system at any time.

I can also be reached for direct questions through the contact form on my website here:

http://eviscerate.net/contact

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Wed Sep 07, 2011 4:05 am
by TsukiShima
Woah, this is great, it reminds me of NIS games, since most of them are role-playing strategy games. I'll try this once my downloads here finished.

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Wed Sep 07, 2011 4:56 pm
by Abeiramar
Thanks for your hard-work, Jake :D !

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Wed Sep 07, 2011 7:54 pm
by LVUER
Jake, you're still alive ^_^ jk
Glad to see you still around here... miss you, you know.

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Wed Oct 26, 2011 5:09 pm
by Mole-chan
XD I feel like I'm a bit late to the party, but I just thought I'd thank you for this lovely engine! You did a great job <3

Though I do have one small, probably embarrassingly obvious, question concerning the XP/level up system. I can't seem to find any way to permanently store the stat/level gains given in battle. For example, if I do a battle, level up, save in a regular ren'py portion between bouts, then quit and reload, all the stat gains will be gone. I've managed to permanently store everything else by putting it in an init python block in its own .rpy file, but the levelplans don't allow me to do this, and the stat gains disappear between plays. am I doing something wrong here, or is this simply a feature that hasn't yet been implemented?

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Wed Oct 26, 2011 5:49 pm
by Jake
Mole-chan wrote:XD I feel like I'm a bit late to the party, but I just thought I'd thank you for this lovely engine! You did a great job <3
You're welcome, I'm glad you like it!
Mole-chan wrote: I've managed to permanently store everything else by putting it in an init python block in its own .rpy file
I must admit, I carelessly didn't do much save/load checking on the level/XP stuff, because there's nothing there that struck me as any different to other stuff I've done which successfully saves/loads. I'm just getting back to battle engine development after getting distracted by moving house (it turns out that takes ages) and I'll do some more save/load testing soon.

That said, the general rule with any Ren'Py development is to not declare your running-the-game variables in an init block, so hopefully you should find that your problem is solved simply by changing your init python block to a label which gets called directly after the start label.


Basically, when Ren'Py saves a game it only saves variables which have had a new value directly assigned to them since the game started, thus it ignores everything which is only directly set in an init block. When it loads a game, it will run all of the init blocks (thus setting your XP back to the starting values) and then load in just those variables which were saved - so if the XP data wasn't picked up by the save, that could well be why you don't see it when you reload that save...

This is a general caveat with any Ren'Py variables which aren't just text or numbers; you can get away with it a lot of the time, but it's a good habit to get into to initialise all your variables just after the start label rather than in an init block. Init blocks are really there just to define non-playthrough-specific data like graphics and animations, which never change and don't need to be saved in the game-save file.

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Wed Oct 26, 2011 6:09 pm
by Mole-chan
Jake wrote:
Mole-chan wrote:XD I feel like I'm a bit late to the party, but I just thought I'd thank you for this lovely engine! You did a great job <3
You're welcome, I'm glad you like it!
Mole-chan wrote: I've managed to permanently store everything else by putting it in an init python block in its own .rpy file
I must admit, I carelessly didn't do much save/load checking on the level/XP stuff, because there's nothing there that struck me as any different to other stuff I've done which successfully saves/loads. I'm just getting back to battle engine development after getting distracted by moving house (it turns out that takes ages) and I'll do some more save/load testing soon.

That said, the general rule with any Ren'Py development is to not declare your running-the-game variables in an init block, so hopefully you should find that your problem is solved simply by changing your init python block to a label which gets called directly after the start label.


Basically, when Ren'Py saves a game it only saves variables which have had a new value directly assigned to them since the game started, thus it ignores everything which is only directly set in an init block. When it loads a game, it will run all of the init blocks (thus setting your XP back to the starting values) and then load in just those variables which were saved - so if the XP data wasn't picked up by the save, that could well be why you don't see it when you reload that save...

This is a general caveat with any Ren'Py variables which aren't just text or numbers; you can get away with it a lot of the time, but it's a good habit to get into to initialise all your variables just after the start label rather than in an init block. Init blocks are really there just to define non-playthrough-specific data like graphics and animations, which never change and don't need to be saved in the game-save file.
c: I see. I'll admit I'm new to using Renpy for anything besides..well..visual novels. xD So a lot of that stuff hadn't occurred to me.

And I tried your suggestion and it worked like a charm! c8 Thank you so much, that saved me a lot of trouble down the road. xD

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Wed Oct 26, 2011 6:18 pm
by Jake
You're welcome - glad I could help!

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Sat Oct 29, 2011 3:03 pm
by Chorvaqueen
Hey uhm I've tried the a6 release and when I hit start, once I've clicked the info menu this pops up
I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/script.rpy", line 49, in script
d "This is the sixth Alpha release of the battle engine code. To explain to anyone unfamiliar with release terminology, generally speaking:\n- an alpha release is an early release which probably has bugs, doesn't have all the intended features and some things may dramatically change before final release.\n- a beta release is a later release which should be more or less feature-complete and mostly interface-stable (so API calls you were using won't change from one release to another, but still buggy.\n- after that, you get to release candidates, which are expected to be feature-complete and [relatively] bug-free, ready for final release.{nw}"
KeyError: u'relatively'

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "C:\Program Files (x86)\Renpy\renpy-6.13.4\renpy\execution.py", line 261, in run
File "C:\Program Files (x86)\Renpy\renpy-6.13.4\renpy\ast.py", line 396, in execute
File "C:\Program Files (x86)\Renpy\renpy-6.13.4\renpy\exports.py", line 696, in say
File "C:\Program Files (x86)\Renpy\renpy-6.13.4\renpy\character.py", line 762, in __call__
File "C:\Program Files (x86)\Renpy\renpy-6.13.4\renpy\substitutions.py", line 218, in substitute
File "string.pyo", line 549, in vformat
File "string.pyo", line 571, in _vformat
File "string.pyo", line 632, in get_field
File "string.pyo", line 591, in get_value
KeyError: u'relatively'

Windows-post2008Server-6.1.7601-SP1
Ren'Py 6.13.4.1637

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Sat Oct 29, 2011 3:13 pm
by Jake
Chorvaqueen wrote:Hey uhm I've tried the a6 release and when I hit start, once I've clicked the info menu this pops up
Yeah, this is because in 6.13, PyTom changed the way that string interpolation works - so it used to be the case that you could use square brackets normally in dialogue text, but now you can't, because Ren'Py tries to treat it as a variable that needs to be inserted into the string.

I'm going to be doing another release relatively soon with some ease-of-use changes, and I'll fix this then - but if you want a quicker fix, then you can just go into the script.rpy file, find the bit where it says "[relatively]" and change it to "(relatively)"... ;-)

I believe it's just an error that occurs in the info section, so you should still be able to go through the demos without any problems.

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Thu Nov 03, 2011 3:18 pm
by Mole-chan
I'm..I'm afraid I have juuust a few more stupid questions. xDD; This is kinda the last few things I have to figure out beforehand, so I shouldn't be troubling you after this.

1) I implemented a battle condition that drops a random amount of money at the end of a battle. It gets called fine in the first battle. In the boss battle (I'm just using the demo battles with minor alterations to test features), however, it never gets called. It's quite puzzling, since I'm pretty sure I set it up the same way both times.
Here's the code for that, if it helps:

Code: Select all

#stored in char_stats.rpy
$drop_loot = AnyCondition()           
    $drop_loot.AddCondition(FactionDestroyedCondition('Enemies'))
    $drop_loot.AddResult(CallLabelInNewContextResult('calc_loot'))


label calc_loot:
    $loot_gain= avg_level * renpy.random.randint(20, 50)
    "Received %(loot_gain)d coins!"
    $money+= loot_gain
    return
#stored in battle_def.rpy in python block before battle declared. Shouldn't matter, as levelplans are stored the same way and seem to be accessed just fine.
avg_level = cadfael.Stats.Level + clone.Stats.Level/2

I'm calling it both times by adding the condition to the battle, so I'm not sure why the second one isn't going.

2)The game is quite linear, so backtracking, and thus grinding if boss is too hard to beat, is not possible. I'm making up for this by having a gym in each town, where all the stats can be buffed (within reason). All of them have come along quite smoothly save for XP. I'm really not sure how to even approach this. Directly upping the stat causes the game to think it's in battle, which is a bit inconvenient. I'd just like to know if there's a way to do this. XD;

3) Last one. :'D Kinda came out of nowhere. Basically the equipment screen, which I copied directly from the demo for now, is throwing up an error. Specifically, interacting with a non-empty widget or stack. There's seemingly no cause, as I haven't altered it in any way before it started doing this.
So most of the code in the equip screen proper is the same. Only thing different is how it's called via ui button.

Code: Select all

init:
    $ money_disp = None
    $equip_button_on=False

    python hide:
        def money_overlay():
            if money_disp:
                ui.text ("Money:" + str(money_disp),
                         xpos=0.0, xanchor="left",
                         ypos=0.0, yanchor="top")

        config.overlay_functions.append(money_overlay)
    

        def equip_button():
            if equip_button_on:
                ui.textbutton(_("Equipment"),
                    xpos=0.98, ypos=0.02,
                    xanchor='right', yanchor='top',
                    clicked=renpy.call_in_new_context('equipment'))
        config.overlay_functions.append(equip_button)
My only guess is the "sell" screen is interfering with it. Again, I don't know why. I have modified it, but one of the modifications was undoing those modifications. It should be better now. So I'm a bit lost. Here's that, if it helps. A lot of the stuff here is just placeholder, I really want to figure out how to get it working, first. xD;;
Store.rpy (handles interacting with the salesperson)

Code: Select all

label store:
    $money_disp=money
    s "Welcome! How can I help you?"
    jump store_menu
label store_menu:
    menu:
        "Buy":
            jump buy_what
        "Sell":
            jump sell
        "Nevermind":
            jump store_leave
            
label buy_what:
    s "What would you like to buy?"
    menu:
        "Potion - %(potion_price)d coins":
            $item = "potion"
            jump quantity

label store_total:
    s "That will be %(total_price)d coins, please!"
    $money-=total_price
    $money_disp=money
    jump store_thanks
            
label store_thanks:
    $money_disp=money
    $equip_button_on=False
    s "Thank you for your patronage! Is there anything else I can do for you?"
    jump store_menu
label store_leave:
    s "Alright then. Drop by any time!"
    $money_disp=None
    jump go_where
    #once again, the return will be replaced with a jump back to town
label quantity:
    $ quant = renpy.input("And how many will that be?")
    $ quant = int(quant.strip())
    jump purchase
label purchase:
    if item=="potion":
        $inv.AddItem(Library.Items.Potion, quant)
        $total_price = potion_price * quant
        
    jump store_total
        
label sell_price:
    s "I can give you %(item_worth)d coins for this. Is that ok?"
    menu:
        "Yes":
            jump sell_item
        "No":
            s "Ok then. Is there anything else I can do?"
            menu:
                "Yes":
                    jump store_menu
                "No":
                    jump store_leave

return
    
    
Sell.rpy (handles selecting item to sell from equipment)

Code: Select all

label sell:
    
    python:
        finished = False
        
        
        while finished == False:
            ui.window(style=style.BattleMenuWindow, xmaximum=700, xminimum=700, ymaximum=500, yminimum=500)
            
            # Three layout rows - one for the prev/next buttons, one for the equipment controls,
            # one for a 'done' button.

            vp=ui.viewport(draggable=True, ymaximum=400)
            ui.vbox()
            for e in equipment:
                ui.textbutton(_(e.Name),
                    clicked=ui.returns(('sell',e)), style=style.BattleMenuButton)
            ui.close()
                # End of equipment list items

            ui.bar(adjustment=vp.yadjustment, style=style.vscrollbar, ymaximum=400, yminimum=400)




                # End of right panel
                # End of two columns of equipment
            ui.textbutton('Done', clicked=ui.returns( ('done', None) ), style=style.BattleButton, xalign=0.5)
                # End of two layout rows
            
            result = ui.interact()
            command=result[0]

            param = result[1]
            
            if command=="sell":
                if param.Name=='Steel Helmet':
                    item_worth =sh_price/2
                
                else:
                    item_worth=100
                
                renpy.call_in_new_context('sell_price')
            elif command =="done":
                finished = True
label sell_item:
    $money+=item_worth
    $equipment.remove(param)
    $finished = True

    jump store_thanks
I'm sorry for asking so much. OTL

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Thu Nov 03, 2011 4:41 pm
by Jake
Mole-chan wrote: 1) I implemented a battle condition that drops a random amount of money at the end of a battle. It gets called fine in the first battle. In the boss battle (I'm just using the demo battles with minor alterations to test features), however, it never gets called. It's quite puzzling, since I'm pretty sure I set it up the same way both times.
Here's the code for that, if it helps:

Code: Select all

#stored in char_stats.rpy
$drop_loot = AnyCondition()           
    $drop_loot.AddCondition(FactionDestroyedCondition('Enemies'))
    $drop_loot.AddResult(CallLabelInNewContextResult('calc_loot'))
I'm calling it both times by adding the condition to the battle, so I'm not sure why the second one isn't going.
This is a bit of an oversight of mine, I'm afraid - when you create a condition of any kind (such as the AnyCondition you're creating for your drop_loot) it starts off in the 'not fired' state (as in, it hasn't been run yet). When its condition/s are met, it runs its result/s and then sets itself into the 'fired' state, and it'll never run its results again. This is to stop unwanted multiple firings - if you had a condition like "when bandit1 is killed or bandit2 is killed or bandit3 is killed, play a short scene", you don't want the "hey, these guys can fight, maybe we shouldn't rob them!" scene to play when you kill the first bandit, and again when you kill the second bandit, and a third time when you kill the third bandit!

The problem is that if you add the same condition to a second battle, it's already been fired, so it won't fire again for that second battle. I probably ought to reset the condition when it's added to the second battle, and I'll try and remember to do that for the next release. You can get around this in two ways:

- re-create the condition for each battle. I was kind of expecting people to do this, to be honest! You could do something like this:

Code: Select all

python:
    def Loot():
        c = AnyCondition()           
        c.AddCondition(FactionDestroyedCondition('Enemies'))
        c.AddResult(CallLabelInNewContextResult('calc_loot'))
        return c
...

Code: Select all

    $ drop_loot = Loot()
And that would get you a brand-new, ready-to-be-triggered condition each time you call the 'Loot()' function.

- Secondly, you could modify your drop_loot condition after each battle to reset it by hand. You can do this something along the lines of:

Code: Select all

    $drop_loot._fired = False
... but while that's quicker and easier, there's the (frankly very, very small) risk that I may change the way the internals of the conditions work at some point in the future and break that code. I wouldn't worry about it, though, it's not likely to happen.
2)The game is quite linear, so backtracking, and thus grinding if boss is too hard to beat, is not possible. I'm making up for this by having a gym in each town, where all the stats can be buffed (within reason). All of them have come along quite smoothly save for XP. I'm really not sure how to even approach this. Directly upping the stat causes the game to think it's in battle, which is a bit inconvenient. I'd just like to know if there's a way to do this. XD;
... eheh, unfortunately that's one area I still need to invest some time in - making sure that all the in-battle stuff can also be done outside of a battle! It's definitely something I'm working on, but as a workaround hack in the meantime, you could try this (after the battle, before the gym changes the stat):

Code: Select all

    del brian._battle
- for a fighter variable named 'brian', this will remove the link from that fighter to the last battle they were associated with, which should hopefully be enough to stop the in-battle 'stat changed' event from firing... I should probably be doing this at the end of the battle anyway, and certainly it's something I need to look at. Sorry!


The last one I'll have more of a look at when I have more time, but it looks to me to be a regular Ren'Py UI issue, so you might be able to get an answer in the regular Ren'Py support forum.

I'm sorry for asking so much. OTL
No problem! Let me know if you have any problems with any of that!

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Thu Nov 03, 2011 5:32 pm
by Mole-chan
XD I see. Recreating the drop loot function seems to work fine. Thanks <3

The XP is a little problematic, as it only allows me to do it once. After that it complains the fighter no longer has a battle attribute (expected). But the thing is I'm checking to make sure the attribute still exists before deleting, and it'll throw up an error regardless.

It's a little difficult to gauge if the stat is actually being changed, either. But it's a direct change so it should be. xDD

and it doesn't throw me into battle, which is progress!
Thank you very much for your help. c:

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Thu Feb 02, 2012 10:41 pm
by AERenoir
Um, i tried to launch it but this error happened:

Code: Select all

I'm sorry, but an uncaught exception occurred.

AttributeError: 'Say' object has no attribute 'attributes'

While loading the script.

-- Full Traceback ------------------------------------------------------------

  File "G:\Downloads\renpy-6.12.0\renpy\bootstrap.py", line 279, in bootstrap
  File "G:\Downloads\renpy-6.12.0\renpy\main.py", line 177, in main
  File "G:\Downloads\renpy-6.12.0\renpy\script.py", line 494, in load_script
  File "G:\Downloads\renpy-6.12.0\renpy\script.py", line 168, in __init__
  File "G:\Downloads\renpy-6.12.0\renpy\script.py", line 379, in load_appropriate_file
  File "G:\Downloads\renpy-6.12.0\renpy\script.py", line 300, in load_file
  File "G:\Downloads\renpy-6.12.0\renpy\script.py", line 278, in load_file_core
AttributeError: 'Say' object has no attribute 'attributes'

While loading the script.

Ren'Py Version: Ren'Py 6.12.0e
What happened?

Re: Battle Engine - Alpha 6 release, downloads in first post

Posted: Fri Feb 03, 2012 5:36 am
by Jake
AERenoir wrote: What happened?
It's hard to say - the error you've posted happened entirely within Ren'Py code, I don't see any of the battle engine script files in the traceback at all.

How did you go about unpacking the battle engine and launching it? I wonder if there's some problem that could have been caused by files going in the wrong place or something. Does the Ren'Py demo with Eileen explaining the features work?