Battle Engine - Alpha 6 release, downloads in first post

Ideas and games that are not yet publicly in production. This forum also contains the pre-2012 archives of the Works in Progress forum.
Message
Author
User avatar
usul
Veteran
Posts: 415
Joined: Mon Oct 29, 2007 12:35 pm
Projects: Teachings of the Buddha, System-Addict, Generation XxX
Location: Quebec
Contact:

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

#181 Post by usul »

IIRC you simply need to declare your animation in your assets and you simply cal that image instead. As for the bobbing of the image when its turn is up, this is an extra that is called, simply comment it out and you won't get that effect.
"The universe is non-simultaneously apprehended"
— Buckminster Fuller

User avatar
emihaumut
Regular
Posts: 158
Joined: Fri Jun 27, 2008 12:19 pm
Projects: Rynspyr.
Tumblr: emihaumut
Github: yeewai
Contact:

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

#182 Post by emihaumut »

Thanks for the quick reply! Time for another silly question, lol, where would I call the image?

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

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

#183 Post by Jake »

emihaumut wrote:Thanks for the quick reply! Time for another silly question, lol, where would I call the image?
To make it so a particular animation plays just when you attack, you'll need to do a little bit more work, unfortunately - I'm trying to find a really neat way of making this easy for the user to set up, which is why I've not got around to writing a demo for it. Presently, you'll want to do something like this:

After declaring the BattleSprite for your fighter, before actually creating the Fighter using that sprite, add a line like this:

Code: Select all

  fighterSprite.AddStateTransition('default', 'melee', 'attack animation', 2)
- where 'fighterSprite' is the name of the sprite you're setting the attack animation for, 'attack animation' is the name of the image you've defined for attacks, and '2' is the duration of that animation in seconds.

Basically, as the fighter does stuff, various state-change events are sent to the sprite, changing it between states like "moving", "melee", or if they're not doing anything particular, "default". If you call 'AddStateTransition', it adds an animation that plays whenever the sprite is changed from one state to another... so here, we're adding an animation that plays whenever the fighter moves from "default" (doing nothing) to "melee" (making an attack).

Alternatively, if you have a continuous animation for your attacks, like firing a machine gun, you might want to simply:

Code: Select all

  fighterSprite.AddStateSprite('melee', 'attack animation')
which will display the 'attack animation' sprite for as long as it takes the engine to resolve the attack.


If you want to know which states are being used and changed between, then:

- uncomment lines 171 and 192 of engine-display.rpy (change the "#print" to "print")
- run Ren'Py with the 'console.exe' in the Ren'Py folder (assuming you're on Windows)

the state transitions it attempts to find and the transitions it uses will be printed out to the console window that gets opened at the same time as the Ren'Py launcher, in a form a bit like this:

Code: Select all

Looking for transition from default to melee
Found transition from default to melee
Looking for transition from melee to default
No transition found.
Server error: user 'Jake' not found

User avatar
emihaumut
Regular
Posts: 158
Joined: Fri Jun 27, 2008 12:19 pm
Projects: Rynspyr.
Tumblr: emihaumut
Github: yeewai
Contact:

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

#184 Post by emihaumut »

Hrmmm, the first line of code

Code: Select all

fighterSprite.AddStateTransition('default', 'melee', 'attack animation', 2)
didn't seem to work at all for me and the second line

Code: Select all

fighterSprite.AddStateSprite('melee', 'attack animation')
worked, but after the first attack, the animation skips from the first frame to the last.

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

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

#185 Post by Jake »

I'll put some time into checking and writing examples for the state-transition attack animations once I've got the panning work out of the way.

However:
emihaumut wrote:but after the first attack, the animation skips from the first frame to the last.
If you're using ATL for your animation, I'm pretty sure is a Ren'Py bug. I started a thread about it here:
http://lemmasoft.renai.us/forums/viewto ... f=8&t=7860
but it's so far seen no response. You can see the same issue with the spell animations in the various battle demos. If you want to get around it for now, then use the deprecated Animation to define your animations instead of ATL.

If you're not using ATL, then I would examine your Animation declaration and double-check that you're not accidentally setting it up wrong, make sure you've got looping set, etc.
Server error: user 'Jake' not found

User avatar
emihaumut
Regular
Posts: 158
Joined: Fri Jun 27, 2008 12:19 pm
Projects: Rynspyr.
Tumblr: emihaumut
Github: yeewai
Contact:

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

#186 Post by emihaumut »

Alright, thanks. :D Using Animation() worked. I thought it was weird that it'd work once and then fail, so I'm going to assume it is renpy at fault too.

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

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

#187 Post by Jake »

Jake wrote:I'll put some time into checking and writing examples for the state-transition attack animations once I've got the panning work out of the way.
I had a look - the problem was that I'd told you the wrong starting state. As a fighter acts he's first put into the 'acting' state, so if a skill changes his state the transition will be from 'acting' to (in this case) 'melee', not from 'default' to 'melee'. For a quick-and-dirty example, if you put the following into line 202 of the grid_demo.rpy file (just after 'bobSprite' is defined):

Code: Select all

  bobSprite.AddStateTransition('acting', 'melee', treeSprite, 1)
Then Bob will turn into a tree for 1 second before the attack-damage number bounces up. Replace treeSprite with an attack animation of your choice, and you're away!




(If you're using facings, then you can also specify the 'fromFacing' and 'toFacing' parameters to that, so you can provide animations for attacking in different grid directions or for turning between moves or whatever... but I seem to recall in your thread you'd said something about not wanting to have to do a million animations, so I'm guessing you're probably using the SimpleBattlefield?)
Server error: user 'Jake' not found

Abeiramar
Regular
Posts: 198
Joined: Wed Jul 28, 2010 10:37 am
Location: Portugal
Contact:

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

#188 Post by Abeiramar »

Hun... so I've been trying to code the battles in the past few days but I haven't got any luck so far :? . Guess I'm still a newbie at this...
So I want to code a battle like the "active_demo" one. What should I copy/paste and what should I modify?
Everything I do only seems to make new errors to pop-up :oops: .

User avatar
usul
Veteran
Posts: 415
Joined: Mon Oct 29, 2007 12:35 pm
Projects: Teachings of the Buddha, System-Addict, Generation XxX
Location: Quebec
Contact:

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

#189 Post by usul »

I started putting in a background and character sprite and thought I'd share it with you.
Attachments
Screenshot.png
"The universe is non-simultaneously apprehended"
— Buckminster Fuller

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

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

#190 Post by Jake »

Usul - it's looking interesting! Thanks for sharing.
Abeiramar wrote:Hun... so I've been trying to code the battles in the past few days but I haven't got any luck so far :? . Guess I'm still a newbie at this...
So I want to code a battle like the "active_demo" one. What should I copy/paste and what should I modify?
Unfortunately, I've not got around to documentation yet, meaning that the demos are really it for the moment...

I would recommend starting with the assets.rpy and activedemo.rpy files, and copying that into a new file in your game. Then take the 'audio', 'gfx' and 'scenery' folders, and all the .rpy files starting with 'engine', and put those into your game folder as well. (Personally, I'd recommend creating a new folder called 'engine' and putting the engine*.rpy files in there, to keep them separate).

From there, see if you can run the active demo in your game folder by doing a 'jump active_demo' from somewhere in your game. Once you've got that far, backup your work so far so that you can easily get back to that point, and start making small changes to things like fighter names and stats to see how the changes you make reflect in-game. You can change the graphics and sound effects by editing assets.rpy.

If you have any specific questions, feel free to either ask them here or PM me.
Server error: user 'Jake' not found

blakjak
Veteran
Posts: 224
Joined: Fri Dec 21, 2007 2:36 pm
Location: France
Contact:

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

#191 Post by blakjak »

usul wrote:I started putting in a background and character sprite and thought I'd share it with you.
Nice wizard sprite =)

User avatar
usul
Veteran
Posts: 415
Joined: Mon Oct 29, 2007 12:35 pm
Projects: Teachings of the Buddha, System-Addict, Generation XxX
Location: Quebec
Contact:

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

#192 Post by usul »

How do you change the state when the character is hurt (damage). There's no perform action for that is there?
"The universe is non-simultaneously apprehended"
— Buckminster Fuller

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

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

#193 Post by Jake »

usul wrote:How do you change the state when the character is hurt (damage). There's no perform action for that is there?
Not right now, no - although I probably ought to add a built-in state for it, really.

In the meantime, you can do it yourself with an Extra, something along the lines of:

Code: Select all

    class DamageState(Extra):
        
        def __init__(self, offset=(0,0)):
            self._offset = offset
        
        def FighterDamage(self, fighter, damage):
            if (damage > 0):
                fighter._battle.ChangeFighterState(fighter, "damage")
                fighter._battle.ChangeFighterState(fighter, "default")
- just add that to your battle like you'd add any other extra (e.g. RPGDamage) and it should transition the fighter to 'damage' and then back to 'default' every time he takes >0 damage. Then you can add a StateTransition animation on "default"->"damage" to show your fighter getting hurt and it'll show up whenever he takes a hit.
(Damage less than 0 is actually a healing effect, so it would seem odd to have the hurt anim play when he gets healed!)
Server error: user 'Jake' not found

User avatar
usul
Veteran
Posts: 415
Joined: Mon Oct 29, 2007 12:35 pm
Projects: Teachings of the Buddha, System-Addict, Generation XxX
Location: Quebec
Contact:

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

#194 Post by usul »

If it's not built in, then something's really weird!! I declared a 'damage' sprite in my game script while trying to figure out where I should add this state, but when I was testing the game, to my surprise the damage sprite was in effect when the character was hit. Perhaps you already built it in and forgot about it!?! Anyhow, declare a sprite that responds to the 'damage' state and you don't need to do anything more!! (in the isometric grid, haven't tested the others).

Here's the pic to prove it, the Warlock just took a hit of Aqua from the water elemental.
Attachments
Screenshot-1.png
"The universe is non-simultaneously apprehended"
— Buckminster Fuller

User avatar
usul
Veteran
Posts: 415
Joined: Mon Oct 29, 2007 12:35 pm
Projects: Teachings of the Buddha, System-Addict, Generation XxX
Location: Quebec
Contact:

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

#195 Post by usul »

I just realized something about the combat system in the Game Engine, fighters and enemies never miss. Will you be integrating a system where you take into account each character's stats (such as agility, attack, defense) to test whether or not each attack hits or misses? Because right now its pretty much a gamble on which character does the most damage, and how many hit points you have going for you.
"The universe is non-simultaneously apprehended"
— Buckminster Fuller

Post Reply

Who is online

Users browsing this forum: No registered users