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
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

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

#241 Post by DaFool »

Yay, thanks to your hints I've been able to make my lovely explosion effect work, so I'm working on creating other effects. I noticed also that when a character walks, it leaves whatever effect stat graphics behind! (The effect then catches up of course once the character stops).

I haven't yet added the status bar effects since I'm still experimenting on the most straightforward method of displaying information to the player. The appended bar in the Active demo sort of does not seem to work the way I wanted to, so I created various graphic states (complete with orange / yellow and red states for low health) but aren't yet sure how to implement it (Conditionswitch?)

For the health bars and other effects which will most likely be illustrated using symbols, I'm not sure how to display all of them in an uncluttered fashion. I've been thinking of creating some sort of box matrix for graphics which will contain the portrait of the character's face and all of its associated symbolical stats, then overlayed with text showing specific numbers. Since the status display box will be quite large, I could just invoke it using some "Examine" or "Inspect" Skill of some sort, which will work for friends and enemies.

(If I weren't making a tactical battle map with 12vs12 battles and instead just have a straightforward 4vs6 FF-style battle, then I can pour attention to making a static-position UI showing character faces which would be one giant Conditionswitched image, then just overlay the text on top of it since the xpos/ypos would be consistent)

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

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

#242 Post by Jake »

DaFool wrote:Yay, thanks to your hints I've been able to make my lovely explosion effect work, so I'm working on creating other effects. I noticed also that when a character walks, it leaves whatever effect stat graphics behind!
In the effect code, when you show the effect, are you including in your at_list any transforms which got passed into the Show function via the transforms parameter?

It's something I'd not done myself in the CurrentFighterPointerEffect code, 'cause that was written before 6.11 where transform-composition worked... if you replace the first line of the CurrentFighterPointerEffect Show method with this:

Code: Select all

            transforms.append(self._fighter.Position.Transform)
then it'll work there - the Show method will have the same transforms passed into it (basically the move, in this case) as was used on the fighter, so the effect will keep up with the fighter's position.
DaFool wrote: The appended bar in the Active demo sort of does not seem to work the way I wanted to, so I created various graphic states (complete with orange / yellow and red states for low health) but aren't yet sure how to implement it (Conditionswitch?)
Well, since you're going to be displaying them via a bit of code which is just there to display bars, you could always just use an if at that point to choose which colour to display, at the same time as you're choosing how big to make 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: Battle Engine - Alpha 4 release, downloads in first post

#243 Post by DaFool »

you could always just use an if
Well, duh (stupid me :lol: )

I've just created an extended Special Move / "Henshin" / major summoning sequence that lasts a few seconds and has its own sound/voices and which takes up the entire screen. It's basically just the main character doing some crazy poses. It's pure ATL / renpy code but I've tried to embed as much of it in a python block so an accidental rollback won't break the battle. I used ridiculously large z-order values to make sure that the sequence plays on top of everything else.

The problem is to invoke it, you must use the 'call' function, which assumes that you're in a linear renpy block. All other actions are taken care of in the MagicFighterAttackSkill and you just register them in the assets.rpy. So how do I integrate this linear sequence... should I create an Alternate MagicFighterAttackSkill, and try to convert the henshin sequence into a class/def of some sorts? After the special move animation plays out, I want to default back to a regular magic attack animation showing the enemy taking damage, just with larger damage numbers.

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

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

#244 Post by Jake »

DaFool wrote: I used ridiculously large z-order values to make sure that the sequence plays on top of everything else.
As it goes, you could also get the 'Effects' layer from the battle engine, which by default (in BattleSchema) is above the fighters and bg and everything.
DaFool wrote: The problem is to invoke it, you must use the 'call' function, which assumes that you're in a linear renpy block. All other actions are taken care of in the MagicFighterAttackSkill and you just register them in the assets.rpy. So how do I integrate this linear sequence... should I create an Alternate MagicFighterAttackSkill, and try to convert the henshin sequence into a class/def of some sorts?
You certainly could. Alternatively - especially if you were going to do several of these - you might prefer to just use renpy.call_in_new_context to call into the label where your special-effects-display code is, and return at the end of it - that'll suspend the battle engine stuff for a little while, run into your display code, then pick up where it left off after the display code is finished.
Server error: user 'Jake' not found

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

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

#245 Post by DaFool »

Hmmm, it's supposedly working -- I can hear the sound, and feel the pause, and the text descriptor I added says that it's playing, but I just can't see it during the battle. I tested it outside of battle and it works perfectly.

I already set layer='master', zorder = 9000, and disabled all the other ui stat displays. I tried using

$ effectslayer = self._battle.GetLayer("Effects")

But apparently there is no battle associated with MagicFighterAttackSkill.

I defined the animation sequence transforms as global variables, so my sequence is simplified as follows:

Code: Select all

    python:       
        renpy.music.play(..., loop=False)        
        renpy.show(..., transform1
        ...
        renpy.show(..., transform2 etc.
        
        renpy.pause(2.0, hard=True)

        renpy.hide(...
        renpy.hide(
I'm suspecting that the BattleEngine redraws itself on top of it or something to that effect.

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

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

#246 Post by Jake »

DaFool wrote: I already set layer='master', zorder = 9000, and disabled all the other ui stat displays.
As you suspect, the battle layers are all on top of master and below transient, so that would be why.
(If I hadn't done that, then I'd have to remove the Ren'Py scene that was in place before the battle started, and I'd rather not impose that on whoever's using the engine; if I draw the battle on top of all the Ren'Py layers, I don't have to worry about what's drawn already, and it should still be there when the battle ends.)
DaFool wrote: I tried using

$ effectslayer = self._battle.GetLayer("Effects")

But apparently there is no battle associated with MagicFighterAttackSkill.
You should instead use fighter._battle... or just _battle, as it's set as a global variable when the battle is started (or created, I forget offhand).

The idea is that you don't need a specific separate skill instance for each fighter that has that skill, since skills are often going to be shared amongst many different fighters... so skill instances don't have any inherent fighter-specific state (so they're not tied to a particular fighter) and don't have any battle-specific state (because the fighter shouldn't be tied to a single battle, so you can use the same fighter instance across many battles).
Server error: user 'Jake' not found

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

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

#247 Post by DaFool »

Victory!!! :)

One last question, is there a method to hide all displayables on the "UI" layer, temporarily, then bring them back up? The ActionPanner controls are getting in the way of my awesome henshin sequence.

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

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

#248 Post by Jake »

DaFool wrote: One last question, is there a method to hide all displayables on the "UI" layer, temporarily, then bring them back up?
Not specifically; a better idea would probably to be just to draw your special effects on a layer over the top of the UI. You can do this relatively easily by either using a different layer name, or customising the layer order.

The default set of layers is defined as such (in engine-schema.rpy, line 100 or so):

Code: Select all

{"BG": 0, "Fighters": 0, "Stats": 1, "Effects": 2, "UI": 3, "Overlay":4}
That's a mapping from layer-name (you have to use these layer names in the engine really, as several of them are used by parts of the engine itself) to layer sequence number - the lower the sequence number, the further 'down' it is, so 'Overlay' above goes over the top of everything. If you want, you can specify your own ordering by passing a dictionary like that into the 'layers' named parameter of CustomSchema, or by creating your own Schema class which returns the layers how you want.

(Basically the engine inserts a load of its own layers into the Ren'Py sequence just below 'transient' called 'battle0', 'battle1' and so on, and these layer names map to those actual layers when you call GetLayer with one of those names as a key.)
Server error: user 'Jake' not found

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

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

#249 Post by DaFool »

Using the Overlay layer solved the problem for me.

Next topic, I have finished defining the squares for my biggest battle map, and I notice a slowdown when the characters are walking... as if the engine "stops and thinks" everytime the character nudges to the adjacent square. It's not really so much of a problem but it's no longer a smooth walking animation when the character slows down and speeds up like that. I'm thinking it's because I have a lot of areas which are only 1-2 squares wide or otherwise unpassable if there's another character blocking the way.

Are destructible scenery elements implemented yet? Is there a 'RemoveScenery' function defined somewhere that I haven't seen yet? I noticed when I was using RemoveRect and RemoveSpace that the squares removed this way will permanently remove LoS in the battle map. So those two methods only work on the fringes of my map, but not in the middle since I still require LoS. Besides, I can only define them prior to battle.

Since my map consists of ravines and destroyable bridges, I defined my ravines as empty Scenery (using "empty.png"), with BlocksPosition=True and LoS=True so that units can fire at each other across the gaps but cannot jump nor walk across if there's no bridge. It would be nice if I can just pass a 'None' or an empty displayable to the AddScenery function.

Each bridge is where I have a hard time defining. It is an inverse destroyable unit (meaning, when destroyed, BlocksPosition will go from False to True, not vice versa). So maybe that's something to consider in implementing destroyable scenery.

Another thing is that I want the scenery to cooperate with dummy enemy units. An example would be an enemy NPC unit that only runs away -- it moves and BlocksPosition and has hitpoints. That way I can define different WinConditions such as "Take out that fuel truck" which can be done either by targeting the truck directly or destroying the bridge supports under it. I think one of your older demos had that chase mission (with an enemy that runs away), but it was using a Path map not a grid one -- I'll have to take a look again. Or I can have that fuel truck not be able to attack the player's characters, but be able to attack only scenery -- such as destroying a wall for a quick getaway.

How about when scenery is repairable? Will it work similar to the Resurrection function? Should I just define all scenery with hitpoints as dummy enemies... and if they don't move, remove their enemy turn contribution?

How does one implement sequential mission objectives? Should I just create all the WinConditions and add them all as extras in one go, each with a priority rating? Or should I just define one WinCondition at a time, then restart the battle based on the last turn positions but with the subsequent WinCondition?

Sorry for the barrage of questions! I'm just cross-checking my concerns before I dig in and finally work on the main tactical elements (the terrain).

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

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

#250 Post by Jake »

DaFool wrote: Next topic, I have finished defining the squares for my biggest battle map, and I notice a slowdown when the characters are walking... as if the engine "stops and thinks" everytime the character nudges to the adjacent square. It's not really so much of a problem but it's no longer a smooth walking animation when the character slows down and speeds up like that. I'm thinking it's because I have a lot of areas which are only 1-2 squares wide or otherwise unpassable if there's another character blocking the way.
I doubt it, because all the calculations as to which path to take are done before the character starts moving at all; it's more likely to be a thing I introduced when I did animation-state-transitions in an attempt to be cleverer than they perhaps need to be; it's something I've been looking into myself recently as well. Try commenting out the two transition calls in engine-display.rpy on lines 207 and 220 (approx.) and see if that helps.

(I'll try to mitigate the slowdown between steps before removing them entirely - for example, I'm not checking in that method whether the fighter is already in the state it's being told to change to - which I really should - meaning that steps taken in a straight line still have those transition gaps between them...)


DaFool wrote: Are destructible scenery elements implemented yet?
Not yet, no - I've been getting some of the big-ticket items (like hex maps) out of the way first.

I'm also still considering how best to go about stuff like that - the simplest answer is just to have the scenery behave very much like a regular Fighter, so they have X Health and once that health is gone, they're destroyed and no longer block LoS/movement. But as you've suggested, there are lots more semi-common cases that it would be nice to take into account.

I'm thinking it's probably best done as a multi-state Fighter, so the game-designer can set the multi-state Fighter up to look at a particular stat (in this case, and probably the default, Health) and then say "for health between 100 and 50, use this Fighter instance; for health between 50 and 0, use this instance; for health below 0, use this other instance" and each of those instances can be entirely different; different sprites, different behaviours, etc. Like that, one could create a "Sci-Fi Defence Shield" Scenery item which blocks move but not LoS when it's undamaged, goes opaque and blocks both when it's damaged, and then smokes a lot and blocks LoS but not move when it's destroyed.

The other benefit to this kind of approach is that the same multi-state Fighter can be used to create those stereotypical multi-stage bosses, where their attacks get more powerful as they get low on health. ;-)
DaFool wrote: Is there a 'RemoveScenery' function defined somewhere that I haven't seen yet? I noticed when I was using RemoveRect and RemoveSpace that the squares removed this way will permanently remove LoS in the battle map. So those two methods only work on the fringes of my map, but not in the middle since I still require LoS. Besides, I can only define them prior to battle.
Actually, there's no caching of paths or LoS in the engine, so you should be able to use those methods during battle as well, it's just trickier 'cause you might have people standing in the squares that get removed, or even pre-calced paths if for some reason you do it after having looked up a move/LoS and before having used it.
DaFool wrote: Since my map consists of ravines and destroyable bridges, I defined my ravines as empty Scenery (using "empty.png"), with BlocksPosition=True and LoS=True so that units can fire at each other across the gaps but cannot jump nor walk across if there's no bridge. It would be nice if I can just pass a 'None' or an empty displayable to the AddScenery function.
On one hand, I'd hope you could - I was sure I'd added code to cope with that a while back. Is it not working for you? I'll add it to my list to look into...

On the other hand, I'm intending to make a richer set of map-editing commands once I add position-properties (stuff like "it takes you X MP to move through this marshy square" and so on); when I do that, I'll also add blocks-LoS and blocks-Move to positions, so that (for example) you can have a no-LoS square you can walk through (dense greenery?) and a no-Move square you can see through (like your ravines) without having to define Scenery for it. I guess my goal is to make it such that you only need Scenery for things-which-might-change-easily (e.g. destroyable fences) and things-which-need-a-sprite.
DaFool wrote: Each bridge is where I have a hard time defining. It is an inverse destroyable unit (meaning, when destroyed, BlocksPosition will go from False to True, not vice versa). So maybe that's something to consider in implementing destroyable scenery.
It's on my list!
DaFool wrote: Another thing is that I want the scenery to cooperate with dummy enemy units.
Well - if you have destroyable bridges which block movement when they're killed, this will all play well with the regular functions to check movement and LoS paths, so presuming your hypothetical enemy is going to check for movement the same way existing Fighters do, then it should Just Work.

As to destroying bridge supports underneath it, I guess that's up to the Scenery itself; I'll bear this kind of case in mind when I get to the Scenery stuff; I'm vaguely thinking of a behaviour function similar to Items and Skills - maybe literally Skills, even - which can be assigned to various things like 'when this Fighter dies', which could be used for (for example) killing everything on a Bridge scenery when it gets destroyed.

DaFool wrote: How about when scenery is repairable? Will it work similar to the Resurrection function?
Actually, making sure that Scenery doesn't behave exactly like dead fighters and allow things like Resurrection spells and healing potions to be used on it is one of the challenges of damageable scenery! Certainly I intend to make it possible to have 'repair scenery' skills, but it might just come down to healing skills which have a different effect based on target attributes - after all, it might be that you also want to have a Druid character who can re-grow damaged trees and bushes but can't do anything with man-made things like walls or bridges!
DaFool wrote: How does one implement sequential mission objectives? Should I just create all the WinConditions and add them all as extras in one go, each with a priority rating? Or should I just define one WinCondition at a time, then restart the battle based on the last turn positions but with the subsequent WinCondition?
At the moment, this is really left entirely as an exercise for the reader - I've got a long-term ToDo item of "make more varied win conditions", but I've not put much thought into it, really. If you have any suggestions, then suggest away, and if it's holding you up in any way then let me know and I can re-prioritise it.

But yes - generally, I would expect win conditions of any sort to be added as an Extra. If you want to have a set which are literally sequential, then I would expect you'd probably just want to have one Extra, maybe with a set of subordinate classes of its own, so the class can control which objective is currently 'active'?
Server error: user 'Jake' not found

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

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

#251 Post by DaFool »

I've been extending the magic and range skill sets of my fighters in the meantime.

I'm kinda stuck though in trying to convert MagicFactionAttackSkill into an AreaAttack skill. The problem with an AreaAttack (such as a mortar attack) is that you should be able to target an empty square devoid of fighters and scenery as the epicenter of the attack. Then the area of influence should be able to stretch a certain definable radius from that central point and damage whatever damageable objects there are within that radius (ideally, as a function of distance from the epicenter, so objects/fighters at the fringes are damaged less than objects/fighters right at the center). I want it to have the option for a collateral damage type of attack so that the weapon does not discriminate at all between factions: friend, foe, or scenery -- anything within its radius is fair game. In addition, there is a range requirement which is ideally set starting just out of the caster's position (meaning the caster of the area spell cannot accidentally damage himself, just his compatriots, unless if it's a healing area spell.)

The next step after we have a circular area attack would be pattern-based area attacks like you see in Disgaea (crosses, H-shapes, rectangular blocks, single-file) etc.

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

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

#252 Post by Jake »

DaFool wrote: I'm kinda stuck though in trying to convert MagicFactionAttackSkill into an AreaAttack skill.
I've actually just put my laptop away, so I can't be completely specific about which functions to call, but the basic process would be:

- Target a position (I think there's a static method on TargetData you can use to simplify this, even.)
- Once you have your position, find all positions within a certain radius. If you can wait 'til Alpha 5 there'll be a new "GetPositionsInRadius" method that you can use for just that - I rationalised the way the battlefields find positions as part of the work on hex-maps - but for now I think there's a GetPositionsWithinRange on the Battlefield instance that you can use to much the same effect.
- For each position, check if there's anyone/thing in it that might get damaged; there's a method on the Battlefield called "GetOccupier" or something which takes a position and returns a list of occupants.
- Once you have that list, you can just damage each occupant in turn - and if you want to make damage drop off as distance from epicentre increases, there's also a 'GetRange' (IIRC) method which will find you the range between any two positions.
DaFool wrote: The next step after we have a circular area attack would be pattern-based area attacks like you see in Disgaea (crosses, H-shapes, rectangular blocks, single-file) etc.
Well, put it this way - in the next release there'll be methods on the Battlefield instance to get positions within a certain radius of a target point, along a line between start and end points, and within an axis-aligned rectangle with opposite corners at the start and end points given. So you should be hopefully able to construct effects like these relatively easily between those methods.




(Speaking of alpha 5, though - I more or less finished a simple CRT implementation today, so I just need to get a couple of UI things done and I should have alpha 5 - with these helper functions and hexmaps and the previously-mentioned examples - out soon.)
Server error: user 'Jake' not found

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

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

#253 Post by DaFool »

I'm excited for Alpha 5!

I have just minor concerns at the moment, namely the displaying of skills in the selection list. The font is too small and I couldn't find the particular style that changes it. I've only managed to increase the font of the battle announcements.

Also, is there a way to break up the skills selection choices into isolated rectangles? I know renpy does that by default with buttonmenu, but this is a different ui system featuring appended lists. I'm eyeing an Android conversion in the far future so I'm already designing the UI to be touch-input-friendly.

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

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

#254 Post by Jake »

DaFool wrote: I have just minor concerns at the moment, namely the displaying of skills in the selection list. The font is too small and I couldn't find the particular style that changes it.
The styles are all defined in engine.rpy, starting line 19, and the property values of each style for the demo are defined in assets.rpy, starting line 230. Hopefully each of the styles has a descriptive enough name to guess what it's used for!

The style for the text in the skill-selection menu is "PickSkillText", which inherits property values from "BattleMenuButtonText". I don't think I define any text properties in the demo, though...
DaFool wrote: Also, is there a way to break up the skills selection choices into isolated rectangles?
Sure.

Presently, there's a Frame set as the background for BattleMenuWindow (assets.rpy, line 240); if you don't want a big bounding box, remove this.

Next, if you want to give every menu button in the game a border, then add a Frame to the background property of BattleMenuButton (existing def line 246) - maybe the smaller-border box used for BattleButton (line 249)?

If you only want to add it for the pick-skill buttons, then you'll need PickSkillButton (and if you want a different button for subskills, PickSubSkillButton). PickSkillButton inherits from BattleMenuButton, and PickSubSkillButton inherits from PickSkillButton.
Server error: user 'Jake' not found

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

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

#255 Post by DaFool »

First presentable dummy 'battle' (just dummy enemies). Animation is very jerky and I could use the 2X faster Ren'Py right now. Then again there were just too few frames in the prerenders to begin with. I think it would also make sense to bind the panning controls to the arrow keys so won't accidentally select a unit while panning.

[link edited out]
Last edited by DaFool on Sat Dec 18, 2010 3:00 am, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users