Author Topic: [Release]scene.bin ai size reduction project, v0.1  (Read 12940 times)

secondadvent

  • Insane poster
  • *
  • Posts: 287
  • Karma: 0
    • View Profile
this mod will attempt to keep the enemies acting as close to the originals as possible (with some small additions as necessary), while rewriting the ai to be as small as possible, to shrink the overall size of the scene.bin, and to make the code as optimized as possible, all while fixing ai bugs :-P. This is not a hard/balance mod, but rather something that can be used as a base for other mods and such, or for those who just want a bugfixed version of the original.

the size is being made smaller so that other mods will be able to safely add to it without having the space issue the psx version has, allowing for more people to use these mods. the size should become small enough over time so that you should not be able to make it become too large for the psx iso unless you were to add a massive amount to the ai, and i mean a LOT.

Current Release: v0.1, with changes to enemies up to air buster (game order, so the first two reactors :P). here is the link: http://files.filefront.com/13875177

Current Size: 256kb, but quickly approaching 248kb

each release will also have an updated kernel.bin (only for if you are not using a modded one), a list with the original/current ai sizes of the enemies, and a file to help people test the ai (if they wanna help me out  :wink:), showing every possible outcome the enemy will have, as in what it will do in one turn, on who, etc.

as of right now, 21 scene files are now empty (as in filled with nothing) that had no enemies used in-game, such as dummy enemies used during testing, as well as an enemy from a scene that has enemies that are used in-game. it is likely there are more to remove, but i haven't checked too far into this yet.
« Last Edit: 2009-06-09 03:26:01 by secondadvent »

warbaque

  • Fast newbie
  • *
  • Posts: 44
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #1 on: 2009-06-05 22:11:15 »
Continuing arguing about removing 2x multiplier from enemies.

Quote
That is after all the original intention of GS's AI.
= Halve all non-piercing damage during counter stance

If you wanted numbers
1st Form
      Guard Scorpion's Def = D (Min-Max 0-510) (Example 40)
      Guard Scorpion's MDf = M (Min-Max 0-510) (Example 256)
2nd Form
      Guard Scorpion's Def = D+((512-D)/2) (Min-Max 256-511) (Example 276)
      Guard Scorpion's MDf = M+((512-D)/2) (Min-Max 256-511) (Example 384)

This way there was no need for halving while keeping full controll over stats (0-510)

All incoming damage is halved during counter stance and regardless of original Def/Mdef values won't skyrocket absurdly high.

secondadvent

  • Insane poster
  • *
  • Posts: 287
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #2 on: 2009-06-05 22:42:10 »
ok, the initial stats are 40/300 when doubled, and without reducing the 300 mdef to 256, it is already different from the original version. now, adding the barriers, if i allowed it (still makes it different, since the barriers are visible, and normally it has no barriers), the mdef (if reduced to 256 first) would basically act the same as 384 mdef, but the 40 def would act much higher than the normal 255 it is given during the 2nd stage (276 != 255 :-P), and if the initial 300 mdef were not reduced, then it would act like 406 mdef.

yes, that would be a shorter way to do it, but it is still not the same as the normal game unless you alter the initial stats of the GS (i am not altering any enemy stats, only moves when needed, stats are staying the same), or reduce the stats in battle. as i said, i am trying to make this mod as close to the original as possible, no stat changing (only moves if needed), and keeping the ai as true to the original as possible, and adding a status to the GS would defeat the purpose, even if it did something similar. now, when i finish this and get to my hard mod, then i will definitely be doing whatever i can to make the ai as compact as i can while doing what i want, but even then i probably would make the barriers a last resort, especially since i plan on implementing a way to make the enemies level as you do (not all will level every time you do, and stat gains will be from a random amount to give variation... a big pre-battle for every enemy, that is different every time... have to set all enemies' base stats to level 1 as well, so that enemies do not get too pumped up if they are already souped up a ton. this will be a while from now though, and i plan to make it as evil as i possibly can :-P), and giving certain statuses/resistances to enemies, as well as certain new moves as they become higher level is a priority >:D.

ok, current progress (will eventually add a text file listing changes as it gets farther along):
name:               original ai size:     new ai size:
MP                    861                  227
Guard Hound      256                  114
Mono Drive        418                  190
Grunt                861                  234
1st Ray              42                    42
Sweeper           161                  131 (main) (added darkness giving ability to it's smoke attack, since the ai is based
                                               9 (pre-battle)  around you being blinded from it, 100% inflict with 75% atk accuracy)
Guard Scorpion   62 (pre-battle)           90 (pre-battle) (relative defense boost added, halved defenses first*)
                        701 (main)                 645 (main)
                        23 (general counter)   23 (general counter)
                        45 (death counter)     33 (death counter) (removed hurt anim. setting)

*both versions apparently double defense before the battle begins, halving it is so that the defenses can be made to be exactly the same as the original, but with added support for those who wish to edit the enemy stats, since normaly GS would have set defenses no matter what you changed his defenses to. guard scorpion will add 106 to the base defense now (it's base 150 mdef will become 256, the normal stage 1 mdef for it), and in the second stage, it will add 235 to def, and another 128 to mdef (becoming 255def/384mdef at normal stats). the min/max for these values at each stage is 255d/361m in stage one, 490d/489m in stage two.
« Last Edit: 2009-06-05 23:06:37 by secondadvent »

warbaque

  • Fast newbie
  • *
  • Posts: 44
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #3 on: 2009-06-05 22:57:36 »
My last post wasn't about barriers.

And there's about 8% difference in damage between 255 and 276.

1st Form
      Guard Scorpion's Def = D (Min-Max 0-510) (Example 40)
      Guard Scorpion's MDf = M (Min-Max 0-510) (Example 256)
2nd Form
      Guard Scorpion's Def = D+((512-D)/2) (Min-Max 256-511) (Example 276)
      Guard Scorpion's MDf = M+((512-D)/2) (Min-Max 256-511) (Example 384)

I think this works better with all values between 0-512

secondadvent

  • Insane poster
  • *
  • Posts: 287
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #4 on: 2009-06-05 23:14:35 »
i thought i read about barriers in the one post on the proud cloud thread... i dunno what i was thinking about then :-P.

and i know the difference isn't much, but i want it to be exactly the same initially as the original in performance and stats, with only things added to fit into the original ai, like adding cure to adamantaimai, and giving smoke shot from the sweepers the ability to add darkness, since their ai checks for enemies with the darkness stat when selecting a target for smoke shot, that means it was originally supposed to add darkness, and they just forgot about putting the status change on the move :-P.

i know i am being picky, but i want everything to be as close to the original ai as possible. if it was supposed to set defense to 333, and an easy way would set it to 350, i wouldn't accept it, even if it took half the space to do. i'd have to check to see if doing it your way would even save much if any space to begin with...

ok, if i were to use yours, it would be much smaller, but if i could remove the auto def doubling, then i would only be a small bit bigger, and produce much more accurate results compared to the original. you could consider removing the auto double as going against what i am trying to do, but every other normal stat caps off at 255, and yet the defenses are automatically sent past their cap at or over 128 defense, and this feature is what will cause me issues throughout every enemy that has a def change in battle, and will plague me through any future mod i do. to me, removing it is like removing a bug, since your character's defense does not get doubled initially, and there is the move dragon force, which is used by an enemy, meaning defense was not initially doubled for enemies, else this move would not be an enemy skill (it raises the defense mod, essentially increasing your battle defense). i think that the def doubling was a last minute addition to try to increase the difficulty, wich didnt work too well (the game was rushed too much).

only problem... i have no idea where to go to turn off the auto doubling <_<.
« Last Edit: 2009-06-05 23:51:57 by secondadvent »

warbaque

  • Fast newbie
  • *
  • Posts: 44
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #5 on: 2009-06-05 23:54:41 »
Quote
My last post wasn't about barriers.
I mentioned about barriers in PrC thread.

I'm just against removing natural 0-510 Def stat range since it allows things like cool new features like real-time weapon change enemy with 25% physical defence and 75% magical

secondadvent

  • Insane poster
  • *
  • Posts: 287
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #6 on: 2009-06-06 00:07:45 »
i dont need it to be gone for this mod, since my GS already works by halving it initially, i just really want it for my future mod :-P. any other enemy can have it too, but it just takes up more room this way.

warbaque

  • Fast newbie
  • *
  • Posts: 44
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #7 on: 2009-06-06 17:53:36 »
I must have misread at some point since I thought you wrote at some point that you were adding Def/2 to every single enemy's AI to get rid of Def doubling.

secondadvent

  • Insane poster
  • *
  • Posts: 287
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #8 on: 2009-06-06 18:35:53 »
no, no, i meant that i would like to turn it off through the core of the game (probably in the exe or something, just dont know where atm), only GS has that for now, as well as any other def setting enemy i stumble across, so it shouldn't happen to too many other enemies. i am just adding it to make the ai work more accurately for me, thats all.

i have finished checking all of the enemy ai (actually finished last night) up to and including GS, so if you or anybody wants to test it out, just tell me. i know the first instance of each in the scene.bin "should" work, since i already directly tested them, but any that i had to copy the ai to may not work, since it was all manually retyped back in for each one.

sides... it'd take 36 bytes to halve both defenses (18 apiece), and per enemy would quickly build up... if i were to change it in the core, if it were, say def x 2, then i just make it def x 1, and not have to remove anything ^^.

wow... ok, grashtrikes ai is set up to check for any non-slowed enemy and use silk on them, if they have enough mp to use it, however their silk attack does not cost any mp at all, since they have 0 mp. if you follow through their logic, they will ALWAYS use silk until the enemy is slowed, even if they cannot be slowed, causing a potential loop there. also, their next step checks to see if an enemy is slowed, and chose a random slowed target if they are slowed, and if not, then chose a random target. now, if all people do become slowed, they will begin to attack (no sooner), and will always target a slowed person (all are slowed anyway), so i have a predicament.

either i give their silk move mp cost, and give the grashtrikes mp as well, going against my normal rules to fix an issue (to make it as close to intended as possible), and be able to barely reduce the total ai, or i keep the potential loop and get a bigger ai reduction. i think it is time i have to break my rules a bit :-P. actually, i DID say that i was trying to make it as close to what was intended as possible while fixing bugs, and this can be seen as an ai bug (more of an oversight actually), so i guess its time to fix it up >:D.

ok now, how much mp to make it cost, and how much mp to give them? their base chance to hit is 90% (with guaranteed infliction on hit), so with no magic evade, it will usually hit, and if you are immune, they would use it however many times each to try and slow you. my guess is that allowing each to be used twice max is pretty good, any higher would make them take too long before attacking. also, mp cost should be at, or a little lower than normal slow spell, probably lower since it is kind of a "natural" ability for them, though it could be 255 mp cost for all i care, and i could give them 510 mp, but that is kind of pointless. meh... normal is 20 mp, but i think 8 is good :-P.

hmm... i made GS so that he is hacker friendly when changing stats, but so far with enemies using mp (those that check their remaining mp), i have not made it friendly there... people will have to manually change the check in the ai (only need to change one value, but still) if they change the mp cost of the abilities used... an auto check is possible easily, but takes more room to do, only about 2 bytes more though :P. i will have to make sure all mp using enemies have the check for the move's ability, but if the move is removed, then problems may occur, so it is kinda lose/lose either way.

it also seems that they were originally supposed to cause damage with their silk attack since they have magic power (enemies that don't have magic attacks have no magic), and their silk attack is set to do magical damage, but with no attack power for the move (unlike normally where it is set to "no damage calculation"), but i will not be adding that in, at least not right now, and if i did it would do very little damage.
« Last Edit: 2009-06-06 19:53:39 by secondadvent »

warbaque

  • Fast newbie
  • *
  • Posts: 44
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #9 on: 2009-06-06 20:01:42 »
When you fight agaist them it's not possible to be immune agaist slow. And afterall they ARE stupid insects so I wouldn't find it weird if they tried to continuously slow you even when they have already failed on it multiple times.

But for MP amount, I would say about 2-4 castings (or more if you have items to heal that status at that point)

secondadvent

  • Insane poster
  • *
  • Posts: 287
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #10 on: 2009-06-06 20:16:45 »
i know they are stupid, but i have a "no fool left out" policy, so even crappy enemies are given what they were meant to have :-P. an infinite loop is not really good anywhere, and giving them two castings is nice, since they appear in groups of 2-4, is plenty. now, you can have magic evade to lower the chances (not by much, but still) of being hit, and this is (hopefully) going to be a base for other mods, so it is possible that they will have other types of equipment available, as well as the possibility for different materia, so it is possible that slow could be prevented, then no matter how powerful they were made, they would NEVER attack, this is just a bug fix.

also, i updated the mono drive to check fire's mp cost (actually, people will have to change the ai for new moves anyway, so that it checks for the new move's mp instead), so if fire were to be upped in price, there would never be a "out of skill points" message appearing, they'd just physically attack the rest of the fight. only cost me one (not two ^^) byte to add, so no big deal, more friendly than the other way. going to work my way to corneo's mansion before any testing, to speed up the process, and test in one fell swoop.

ok, another predicament... the blugu enemy's ai is set up around checking for paralysis in combination with it's hell bubbles move (to see who is attacked with it), but hell bubbles causes sleep... so either i change the ai to check for sleep, or else i change hell bubbles to cause paralysis instead (easier actually). since i am basing things off of the ai, hell bubbles will now cause paralysis instead of sleep, and paralysis is worse because physical hits will not cure it.
« Last Edit: 2009-06-06 20:41:58 by secondadvent »

warbaque

  • Fast newbie
  • *
  • Posts: 44
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #11 on: 2009-06-06 21:09:48 »
I'm not sure about paralysis. You can't heal it without esuna, angel whisper or white wind, spells that you most likely do not have at that point and 2 blugus can paralyse your entire party quite fast if you're unlucky.

secondadvent

  • Insane poster
  • *
  • Posts: 287
  • Karma: 0
    • View Profile
Re: scene.bin ai reduction project
« Reply #12 on: 2009-06-06 21:29:49 »
but, that is where the ai is pointing to. if sleep and paralysis were right next to each other bitwise, then i would probably assume it was a mistake for the ai to use paralysis (even though it is used multiple times in the ai). also, you do not have access to anything to remove sleep for that matter, though it is removed by being hit, so no big difference there. also, they can only use it about a third of the time IF the ai takes a few turns beforehand.

basically, the first turn it is possible (a 1/4 chance then), then after that it has to take up to two more turns until the 1/3 chance activates, and if the chance fails, then they have to wait another two turns for another 1/3 chance, so it isn't like they will be using it very commonly on you either way. they do come in groups of 2-3, so if all do get it on the first turn (a 1/64 chance), they have a 80% chance on contact of paralysis landing (essentially an overall 1/125 chance of all three getting paralyzed), so not very likely, and if all three do somehow use it, there is about a 50% chance that all three will be affected... not too good of odds of it happening.

also, another oddity is that hell bubbles has an attack power of 12, but does no damage, while silk has no atk power, but calculates damage... maybe a mixup, and these guys were supposed to damage and paralyze you (kind of like a magical cross-slash?). so many unknown things going on...

ok, about your post in the PrC thread, it is possible to set whatever in-battle flags, since many enemies do that normally (an example is the mono drive, which prints a warning/enemy sighted dialogue box at the start and attacks after that, never displaying the message after that. also, the programming logic for the enemy ai is much different from most programming languages you may be used to. the best way to learn it is to look at other people's coding, though the ffvii ai used initially is usually lain out in a very unusual and inefficient way for many of the enemies, but mine is also hard to follow because i program weird, but in an efficient way :-P.

ok, the blugu enemy is a mess of an ai... i should get a good bit of shrinkage here, but it will take some time, unlike the previous three enemies that were actually half decently done. i also noticed that some enemies actually share ai, showing how rushed ffvii was, since the ai was barely even made to be efficient, much of which isn't even properly working, something that only hackers and those who made the game (sans adamantaimai bug) would notice, since things work normally otherwise.

paralysis only lasts 8 units of time, while sleep lasts 26, so being unable to smack yourself out of it is a fair trade.
« Last Edit: 2009-06-06 23:38:42 by secondadvent »

warbaque

  • Fast newbie
  • *
  • Posts: 44
  • Karma: 0
    • View Profile
Re: scene.bin ai size reduction project
« Reply #13 on: 2009-06-07 01:06:31 »
I repost this here in case you missed it eventhought it was mostly directed at Crysalis.

What can and what can't be done with current AI scripting?

So the solution could be to make enemies give way less exp so levelling up is slower and the time you meet bosses you are much lower level but this would then mean getting to the magical level 99 and level 60 points much harder and less likely in a normal game, I do agree enemy AI's need to be improved especially on bosses and of course stronger attacks ones that hurt enough so that you do actually have to heal in battles and even consider fighting on the back row/use sadness, but doing this alone is useless if the enemy gets no attacks in, and the best way to ensure they get attacks in is to boost their hp/dexterity and defenses.

I started my balance/hard mod from completely different perspective. Average EXP/AP is multiplied by 2 and boss EXP/AP by 5. This way player is about lvl 90 when they reach The Northern Crater and difficulty isn't completely ruined for those who wish to max their levels.
Damage multipliers removed from UWs. I haven't yet decided should I replace it with some other effect or leave them as "normal" weapons.
If Shield protected against non-elemental magical damage I would make KotR hit everyone on the screen (your own party included). So if you wanted to cast it and survive you would need some preparations or final attack+restore/phoenix. In any case the effect can't be made a lot weaker since the animation takes forever so it has to dish some damage. It's the MP cost that is the problem. If it killed you everytime you summoned it requiring you to use final attack+restore for example that would make miming it a lot harder. Or alternatively (1-3)xShield 180-540MP for preparations but if I remember correctly Shield protected only against physical and elemental magic damage. Items excluded.

If you wanted harder battles enemies need to have a lot stronger attacks than they do in vanilla/unmodified game. AI needs to be smart and it needs to react players actions, for example use spells like dispel and debarrier.
What I personally find annoying are the enemies that have 1 basic attack and 1 stronger attack and they choose their attacks completely by change. After that difficulty of the battle becomes dependant on players luck. Does it use it's stronger attack or do I get lucky and it uses it's weaker attack multiple times in a row without using the stronger one. Of course if the attacks had a different Att% with stronger attack having smaller change hitting I could understand why it chooses weaker attack over stronger one.

By the way is it possible to make enemies not use certain spell afer certain events during fight.

Example
start.flag=0

if flag=0
  select all cast Fire3
  if damage > 0
    set flag 0
  else set flag 1
  endif
else chew bubblegum
endif

I haven't touched the actual AI-data yet so I don't know how it looks like or what commands it uses. That's way my crude example

Chrysalis

  • Insane poster
  • *
  • Posts: 252
  • Karma: 4
    • View Profile
Re: scene.bin ai size reduction project
« Reply #14 on: 2009-06-07 02:43:18 »
I initially tried to add the following changes to kotr.

increase cost over 250 (sucked when realised max is 255)
make max level 3 so 3x per battle, and to even level up to level 2 would be same as current level 4 and level3 same as current level 5.

I then tried to take the ignore defense flag off so its significantly weaker against bosses (since all boss's in my game especially late game have good magic defense) but this in some cases made it too weak, it went from doing 9k or so damage per hit to sometimes only 100 per hit.  So for now I have kept the ignore defense flag on and took down the base damage so it does around 2k-3k per hit, so total damage is more than zero bahamut but not insane.

Of course late game kotr isnt that powerful when you compare to other things eg. 4x cut with 9999 limit break removed will do similiar damage to kotr and omnislash also similiar.  This is why I consider many hp's far too low, to me a boss battle has to last a long time thats the #1 rule, even if its just the same AI but the battle lasting longer its an improvement.  Once thats fixed then the battle can be made genuinly harder with AI improvements and stronger attacks.

By the way your idea for kotr to harm everyone is very good, to get round the shield not protecting issue you can decrease the accuracy down to something that will miss as often as normal attacks and then ways for players to survive could be having a very high defense %.  So wearing mystile for example.

If I understand you correctly you will be balancing the game so the player is expected to be around level 90 at the end? and to compensate for the higher level requirements you will make it easier to level up so less training.  If so I like the idea of this.

What I did in my game, (since I lack the skills to edit AI.)

1 - I set most normal enemies with a attack, magic and dexterity boost meaning most enemies you meet will get their turn first and get an attack in, the idea was for the attack too hurt, the dexterity defenitly worked as I rarely go first in fights but most attacks are still far too weak. Also luck boost to every enemy so critical hits more frequent.
2 - I set a few random encounters to signficantly more diffilcult, large hp boost, larger boosts than normal on the attack and dexterity stats, as well as some defensive boosts.  These fights I tend to make more rewarding like extra exp and small chance of good item.
3 - all enemies get level boosts, trying to keep enemies that are inside 4x and 5x levels still inside them, so enemy skills remain effective on same enemies.
4 - all boss's large boosts especially on hp and mp, early boss's have lower boosts and all boss's after midgar larger boosts.  Typical boosts to HP are early boss's triple HP, mid game bosses 4x HP and late game bosses 10-20x HP.  In addition large level boosts as well as large stats boosts, initially I went too far on some boosts and had to tone it down a bit, but I still have many bosses way too easy.  Some are genuine tough battles tho.
5 - safer sephiroph, in addition has couple changes to attacks. super nova ignores status defense, heartless angel adds chance of poison and ignores status defense, of course slow+poison on someone with 1hp will kill them, so basically heartless angel becomes a 1hp attack with a chance of death.  He has massive defense boosts since his hp cant be effectively boosted.
6 - all enemies are much easier to steal from, this is something that makes game easier but it was just silly before on the default settings, most items 83% chance of success, but special items like weapons and elixir reduced to 51%.

To me obvious AI boosts are.

1 - a counter attack that either heals or drains, so the enemy will be able to attack+heal (since the heal is a counter).
2 - more status affects in attacks such as confusion and petrify.
3 - ability to use peerless.
4 - to react to current state of battle, eg. casting haste onself after slow in affect.
5 - ability to cast summons including kotr.
6 - have stocks of elixir, especially some boss's.
7 - to be able to revive other enemies.
8 - have a random chance of breaking players equipped accessory. once broken it is lost.

NFITC1

  • No life
  • *
  • Posts: 2903
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: scene.bin ai size reduction project
« Reply #15 on: 2009-06-07 03:04:35 »
I'd love to see more peerless in the game. I considered removing one/all of the sources and replacing them with some rare-status inducing attacks. Peerless would be one such effect, as would dual and darkness.

secondadvent

  • Insane poster
  • *
  • Posts: 287
  • Karma: 0
    • View Profile
Re: scene.bin ai size reduction project
« Reply #16 on: 2009-06-07 04:24:11 »
@nfitc1: yeah, many of the stats are underused, but i think that is because the game was massively rushed. i was planning on making my balancing/hard mod after finishing the compressed ai mod, but it seems that you guys are more interested in the hard mod right now :-P. i will probably start going back and forth between the two then, after either getting to air buster, or the end of the shinra building (boss galore), and working my way up to that point in my hard mod. i do plan on balancing out the game a lot, and the rarer statuses are definitely making the cut.

peerless will likely be item only (sans aerith of course), or on a late game materia, since it has too much cheapness for an early game ability. darkness will likely be placed onto a separate materia (kind of make separate materia for each specific status type, element type, etc, and it is possible that i will remove the X pluses, since they can definitely break the difficulty), making use of all the room i possibly can in the materia section. dual drain (sap) is likely to be added to the bio materia as bleed/sap, and mixed together with one of the bio spells (likely bioga, making a poison/sap combo which could be deadly, especially if an enemy has it).


@chrysalis: most mods make you start weaker, and make the enemies as strong as they can, but something that isn't usually done is lowering the character growth, thereby limiting the maximum stats you are able to obtain. mix this with limited/no sources, and you have much more room to make enemies grow, since the overall enemy stat average will need to be reduced as well. if you capped lv 99 strength at 70 or so, and removed ultimate weapon abilities, combined with reduced weapon power, then the enemies will not have to be made too much stronger to give you trouble. the lower you place your characters, the more room enemies have to grow without altering the game engine. if you were to make your people have the stats used in paper mario, without editing the base enemies at all, then it is likely that you wouldn't make it past the first fight, though if you did (possible), you are almost certainly not making it past the guard scorpion. if you take the normal character growth in ffvii, and pumped up the enemies even really high, an experienced person will still have little trouble beating it. if you slash your own people (not just abilities' power, but those as well as stat growths), that is a bigger boost than raising the enemies.

if all weapon power was halved (giving ultima weapon 50 atk and making it do normal damage), with a lv 99, 70 strength cloud, you would do ~2350 damage to a 0 defense enemy. as you can see, that is much less than the normal lv 99 9999+ damage, and if 4xcut were weakened as well, then it is likely that without critical hits, you wouldn't even hit the cap. this game has a lot of potential, and i plan on tapping into as much of it as i can, making enemies much stronger than you makes you need to use a strategy other than final atk+phoenix/raise, kotr, 4xcut (and 4xcut counter). darkness will be something that will be greatly helping you out, as will silence, though i will be making enemies change their patterns when afflicted with certain statuses. you can also increase the amount needed to fill your limit bar, making limits much more difficult to get, making things even more difficult.

also, since the ai can do pretty much anything (including change your immunities), it is possible to give you death sentence, possibly with other ailments, and give you immunity to death and immunity to restorative spells, making you a guaranteed dead man with no way of resurrecting yourself, since immunity would be preventing it. if anybody gets that, it'd likely be like a tonberry (knife attack XD), or northern crater enemy/side boss.

the only ai problem (not actually an ai problem, but something related to it) right now is the fact that animations need to be added to enemies to use other types of attacks. for example, the MP (guard at the start of the game) cannot directly use magical attacks, unless it uses it with either it's tonfa attack animation, or machine gun animation, since it wasn't made to use magic, and the actual magic attack animation will not be used, but rather it will show the normal attack done by the MP, but with the magic's effects. I do not know anything about adding animations, and is something that i would likely need help with, and even enemies that can use magic have camera oddities (camera doesn't act right... too slow or fast for the spell depending on the enemy's magic casting animation), but will display the correct magical attack animation. that issue will probably be the biggest obstacle to overcome once you know the ai language pretty well, but if you know how to edit their animations as well (their actual animations in the battle.lgp file, not the animations in the scene.bin, in case i confused you), then you are set, and can make anybody use any move.

when i do begin my hard/balanced mod, i will be testing it every step of the way to make sure everything is balanced nicely (especially since ai is in the mix, though i still always test my work for a while), and if it doesn't suit my needs/others' needs, i will raise the difficulty accordingly >:D.


@warbaque: basically anything is possible with ai if you are creative, though you have limited space (not that any enemy even reached the limit in the normal game, but with mass modifications to power bosses, it *may* be reached, though i still doubt it :-P). increasing the exp/ap is fine, but only if the enemies are getting a nice boost as well, and if you can still easily take everything down, then it isn't good enough >:D. you can easily set the enemy ai to use flags, create custom stats, give auto statuses, bring them back to life automatically when killed the first time (still working out the bugs for multiple times, and i do not know how to fix invisibility, but i know how to avoid it :-P), attack multiple times a turn, and other things as well.

some things that may be possible via ai is to make other enemy battles appear after finishing the fight (i know it can be done by editing the scene file, never looked into doing it via ai), allowing for multiple item steals, such as making it allow you to steal again, and possibly adding different items to be stolen depending on certain conditions (i would love this, and it is likely possible since exp/ap can be set in ai), as well as changing dropped items (again would love this, many different possible uses, such as different drops based on level, or based on your actions in battle). like i said, there is much possible through ai, i would need specific examples to know if it could be (currently) done or not... i am also going to try to figure out as many unknown variables as posible, for even more flexibility with the ai, i already know the invisibility flag (it may just disable the idle animation... possibly resetting the idle animation would bring it back?), the flag to keep the enemy from using the normal death animation, and the magic counter (it counts the amount of times you are hit with magical attacks) variable, though i sadly didn't find any physical/general version of that... they may be with the magical one, and i just set it up wrong, but i am not too sure on that...

but yeah... if you have an idea that you would like to know if it could be added into the ai, just post it here and i will see what i can say about it (still learning myself, but i think i am doing ok :-P).

whew... a long post, but i think i covered everything (hopefully...).
« Last Edit: 2009-06-07 04:51:57 by secondadvent »

warbaque

  • Fast newbie
  • *
  • Posts: 44
  • Karma: 0
    • View Profile
Re: scene.bin ai size reduction project
« Reply #17 on: 2009-06-07 05:18:15 »
I can't figure out how Sephiroth's main AI works

Quote
LocalVar:0000 <- 2
TargetMask <-  (TargetMask.GreatestElementalDamage >= 5) <- what does this do for example
If (TargetMask)
{
   Debug.Print: "RESIST EARTH MONSTER" ; 0
   LocalVar:0040 <- 1
}
TargetMask <-  (ActiveMask.FormationNumber == 25) <- same question
If ( ( (TargetMask And  (TargetMask.Status:Death == 1) )  And  (Random MOD 3 == 0) ) )
{
   LocalVar:0020 <- 8

}

ElseIf ( (BitCount(AllActiveOpponentMask) == 1) ) <- BitCount and AllActiveOpponentMask?
{
   TargetMask <- RandomBit(AllActiveOpponentMask)
   If ( (TargetMask.BattleRow >= 16) )
   {
      LocalVar:0020 <- 29

   }
   
Else
   {
      LocalVar:0000 <- 1
   }

}

Else
{
   TargetMask <- AllActiveOpponentMask
   If (Random MOD 3 + LocalVar:0040 == 0)
   {
      LocalVar:0020 <- 38
      LocalVar:0040 <- 1

   }
   
ElseIf (Random MOD 3 + LocalVar:0040 == 1)
   {
      LocalVar:0020 <- 32

   }
   
Else
   {
      LocalVar:0020 <- 35

   }
   
Else
   {
      POP(Random MOD 3 + LocalVar:0040)
   }
   Perform(LocalVar:0020, LocalVar:0000)
SCRIPT END

How does script functions use if function
is for example
If (something) equivalent of If (something==1)

NFITC1

  • No life
  • *
  • Posts: 2903
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: scene.bin ai size reduction project
« Reply #18 on: 2009-06-07 06:54:59 »
Quote
(TargetMask.GreatestElementalDamage >= 5) <- what does this do for example

I had a discussion with Akari about the function of code 96. Apparently, it takes two arguments: character mask and an element. What it does is goes through all the characters in the character mask and set their GreatestElementalDamage value (within their unit data 4058h) to the elemental damage modifier of that element. So when this is checking the "GreatestElementalDamage" it's checking the status of the Earth Elemental. This will prevent him from using Quake3 further on down.

Quote
TargetMask <-  (ActiveMask.FormationNumber == 25) <- same question

This is targeting any character with a formation number of 25. I'm not really sure what this means, but I believe that it's checking to see if Young Cloud is alive.

Quote
ElseIf ( (BitCount(AllActiveOpponentMask) == 1) ) <- BitCount and AllActiveOpponentMask?

BitCount is a count of the number of bits that are active in that value. AllActiveOpponentMask is a mask (of bits) that indicate which opponents are still alive.

Let me attempt to simplify his code for you.

Quote
AttackType = Command.Magic
Target <- TargetMask.ElementalDamage(Earth) >= 5

If (Target) Then  ' If Target is non-zero
   Debug.Print "RESIST EARTH MONSTER"
   ResistEarthMonster = 1
End If

Target <- ActiveMask.FormationNumber == 25

If (Target and (Target.Status.Death) and Random MOD 3 == 0) Then

   Attack <- Life2

Else

   If BitCount(AllActiveOpponentMask) == 1 Then

      Target <- Random.Opponent

      If Target.BattleRow >= 16 Then ' in back row probably
         Attack <- Fire3
      Else
         AttackType <- Command.Attack
      End If

   Else

      Target <- AllActiveOpponents

      If (Random MOD 3 + ResistEarthMonster == 0) Then
         Attack <- Quake3
         ResistEarthMonster <- 1   ' This line is pointless
      ElseIf (Random MOD 3 + ResistEarthMonster == 1) Then
         Attack <- Ice3
      Else
         Attack <- Bolt3
      End If

   End If

End If

Perform(Attack, AttackType)

Since everything is init'ed to 0 then Attack will be 0 if AttackType is Command.Attack (1h). Otherwise it'll be Command.Magic (0h). So the odds of Sephiroth casting Quake3 are 1:3 IF there's not a monster that nullifies or absorbs Earth Elemental. Even though he has a Restore Materia, he will never use it in battle. You could get him to use it out of battle, I suppose. I never tried it. He'll also never use Fire3 on all enemies like this.

warbaque

  • Fast newbie
  • *
  • Posts: 44
  • Karma: 0
    • View Profile
Re: scene.bin ai size reduction project
« Reply #19 on: 2009-06-07 08:36:42 »
Quote
Quote
Since everything is init'ed to 0 then Attack will be 0 if AttackType is Command.Attack (1h). Otherwise it'll be Command.Magic (0h). So the odds of Sephiroth casting Quake3 are 1:3 IF there's not a monster that nullifies or absorbs Earth Elemental. Even though he has a Restore Materia, he will never use it in battle. You could get him to use it out of battle, I suppose. I never tried it. He'll also never use Fire3 on all enemies like this.
I always found it weird all other Sephiroths elemental spells had all materia linked to them except fire. Instead there was an empty slot. I always thought that this was a mistake on developers part but now I see AI tells different story.
Fire3 intentionally casted only on single enemies when normal attack would do ½ damage because of back row modifier. And because of that I think that casting Fire3 at all is impossible with this AI since if I understood "ElseIf ( (BitCount(AllActiveOpponentMask) == 1) )" correctly Sephiroth will only use normal attack and Fire3 against single targets. In vanilla scene.bin all enemies in flashback come in groups and Sephiroths kills them all in once either with Ice3 or Bolt3 and if for some reason 1 enemy was left alive it would always be in front row -> so no Fire3
Have I understood "ElseIf ( (BitCount(AllActiveOpponentMask) == 1) )" part correctly? Is this what actually happens?
« Last Edit: 2009-06-07 15:20:13 by warbaque »

secondadvent

  • Insane poster
  • *
  • Posts: 287
  • Karma: 0
    • View Profile
Re: scene.bin ai size reduction project
« Reply #20 on: 2009-06-07 13:25:08 »
@nfit1c: i believe that row 16 is the "can't reach" row, since zemzelet sets its row to row 16 when it flies up. oh, and imagine a fully ai controlled party... that would actually be pretty fun to do for boss battles (big ones)... see how long your ai lives against... your ai :-P.

@warbaque:  that is essentially right, but a way to make your second statement right (since putting just one nonzero value, say 23 for instance, could be wrong, even though it is still non-zero) would be to make if (something >= 1), because it will always be a (positive) non-zero value, though just if (something is much easier to write, and saves space :-P.
« Last Edit: 2009-06-07 13:27:50 by secondadvent »

warbaque

  • Fast newbie
  • *
  • Posts: 44
  • Karma: 0
    • View Profile
Re: scene.bin ai size reduction project
« Reply #21 on: 2009-06-07 13:55:51 »
@warbaque:  that is essentially right, but a way to make your second statement right (since putting just one nonzero value, say 23 for instance, could be wrong, even though it is still non-zero) would be to make if (something >= 1), because it will always be a (positive) non-zero value, though just if (something is much easier to write, and saves space :-P.

My 1st statement was
Quote
If (something) is equivalent of If (something==1)
what would if statement return when using following value for example
something=0 If (something) returns 0
something=1 If (something) returns 1
something=23 If (something) returns 0
something=-23 If (something) returns 0

And second
Quote
If (something) is equivalent of If (something=/=0)
something=0 If (something) returns 0
something=1 If (something) returns 1
something=23 If (something) returns 1
something=-23 If (something) returns 1


Because in scripting languages I've been more recently working with
If Variable has been just shorter and more efficient way of using If Variable==1

secondadvent

  • Insane poster
  • *
  • Posts: 287
  • Karma: 0
    • View Profile
Re: scene.bin ai size reduction project
« Reply #22 on: 2009-06-07 14:26:28 »
actually, you have them reversed... if (something) returns true whenever the number isn't 0, so 346456456 would be true, 0 would be false. if (something == 1) would only return true when something is equal to one, so only 1 will ever return true, nothing else.

well, if (something=/=0) would work as if (something), but takes an extra three bytes in the ai to do, opposed to the if(something) method. if you use if (not(something)) in the ai (essentially an if(something == 0) statement), it does the exact opposite, and is good for whenever you ned to check something against the value 0, since it takes less room in the ai to do.

yay... blugu lost 99 of it's 262 byte size >:D. heh... and it looks like smogger isn't too much different ai-wise from the blugu, just an extra check, and a few modifications to add to make it work. just like with the MP and grunt enemies, since their ai was exactly the same originally (except moves used and random chances... exact same size)... i love it when enemy ai is the same (at least for this mod... overall that isn't a good thing >_>).
« Last Edit: 2009-06-07 14:37:37 by secondadvent »

NFITC1

  • No life
  • *
  • Posts: 2903
  • Karma: 72
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: scene.bin ai size reduction project
« Reply #23 on: 2009-06-07 14:56:46 »
actually, you have them reversed... if (something) returns true whenever the number isn't 0, so 346456456 would be true, 0 would be false. if (something == 1) would only return true when something is equal to one, so only 1 will ever return true, nothing else.

well, if (something=/=0) would work as if (something), but takes an extra three bytes in the ai to do, opposed to the if(something) method. if you use if (not(something)) in the ai (essentially an if(something == 0) statement), it does the exact opposite, and is good for whenever you ned to check something against the value 0, since it takes less room in the ai to do.

If (something) works just as well as if (something <> 0). This includes negative values. The reason is the jump 70 which jumps if the popped value is 0. If the previous value is 0 then it jumps over all the next few statements. Also remember that just because things are compiled one way doesn't mean it's the only way to do it. Optimizing Assembler code is a huge task that requires you to know more than just the language it was written in.

And second
Quote
If (something) is equivalent of If (something=/=0)
something=0 If (something) returns 0
something=1 If (something) returns 1
something=23 If (something) returns 1
something=-23 If (something) returns 1

This is correct.

secondadvent

  • Insane poster
  • *
  • Posts: 287
  • Karma: 0
    • View Profile
Re: scene.bin ai size reduction project
« Reply #24 on: 2009-06-07 15:10:56 »
yeah... and i wouldn't recommend doing what i am doing, even to myself :-P. with programming the ai, there are many ways to do things, some are better than others, but none "have" to be done a certain way. you could intentionally make the ai do 10x the work to do something, but it could still get the same answer as something 1/10 the size.

the ai does a normal sized script in one frame of the game, so unless you loop things massively, or program really bad, and when i say this, i mean REALLY bad... like using 1kb for a common enemy that only has two attacks :-P, it shouldn't seem any different in-game.