As a French person I feel like it's my duty to explain strikes to you. - AdrienIer

Create an account  

 
New lair monster generation algorithm

Download "CasterEXP6B.zip" to try it.
If you intend to participate in the "Earth Lore Sprite Analysis", I suggest using this version as it will be in the next update (unless someone finds a serious flaw).

So...what does this actually do?

-There are no numerical limits on primary or secondary monsters anymore. If you see "many cockatrices" and don't scout, you risk losing all your sprites because there might be 7-9 of them which is likely too much to handle. Note that this was already the case for secondary monsters, and having this outcome appear without a secondary monster is fairly uncommon. 80%+ of the encounter zones still have two types of monsters, albeit it might be a 7-2 or 8-1 setup.
-The monster type is picked randomly with an equal chance for each in both slots. So the chance no longer depends on costs and pre-rolled "intended number of monsters" values, nor the leftover fractional points after the first monster placed. Of course if the target budget is impossible to meet using the selected two monster types, it gets rerolled so the actual chances are not equal, but it won't depend on something as unrelated as the cost of other monsters not being picked. The greatest difference here is that having two expensive monsters appear together will be more likely (albeit places with enough budget for that are uncommon so don't expect it often -still having it with mid cost monsters will be a thing, the old code didn't generate things like 4 gorgons+5 stone giants ever).
-Always the more expensive monster is in the first slot - there is no such outcome when the primary monster is weaker but more numerous like 6 Unicorns with a single Archangel.
-Except for invisible monsters : These always go to the secondary slot even if they are the stronger one. Don't expect to go into a node with "Phantom Warriors" safely without properly scouting it first - Air Elementals might be lurking inside.
-As monster costs no longer have an unwanted influence on placing other monsters, they can be adjusted freely to match their actually difficulty - all costs have been revised and changed, some significantly (Phantom Beast for example is down to 100 points each). You can run "magicedt.exe" to see the numbers.
-If the primary monster is Great Wyrm, the secondary monster cannot be an Earth Elemental, Cockatrice, Great Lizard or War Bears.
-If there is only one type of monster, it cannot be Great Wyrm or Earth Elemental. Wyrms are very high value and too easy to defeat with flying ranged units (not just sprites, but anything and their value is relevant even in the midgame), while Earth Elementals are so ridiculously slow that any ranged unit can kill them easily while they still provide fairly good treasure.


Code:
jmp start

RND:
push ax
db 9Ah, 0D4h,00,0B0h,00
pop dx
retn

getunit:
push ax
mov bx, 24h
imul bx
mov bx,ax
pop ax
retn

getrandommonster:
invalid:
mov ax,42
call rnd
add ax,154
; Random fantastic unit

call getunit

cmp     byte ptr [bx+220h], 0 ; Floating Islands cannot be added
jnz invalid
push ax
mov     al, [bx+219h]
cbw
cmp ax,[bp-4] ; Check for the correct realm
pop ax
jnz invalid
retn

swap:
mov ax,[bp-8]
mov dx,[bp-0Ah]
mov [bp-8],dx
mov [bp-0Ah],ax
retn;

start:
push di
push si

mov word ptr [bp-2],2 ; allowed difference 2%
mov word ptr [bp-0Eh],0
reroll:
call getrandommonster
mov [bp-8],ax
rerollsec:
call getrandommonster
cmp ax,[bp-8]     ; Primary and secondary must be different
jz reroll
mov [bp-0Ah],ax

call getunit
mov di,bx

mov ax,[bp-8]
call getunit

cmp [bp-8],167 ; Primary monster invisible? Always secondary!
jz invisible
cmp [bp-8],194 ; Primary monster invisible? Always secondary!
jz invisible

mov ax,[bx+216h] ; Primary monster cost
cmp ax,[di+216h] ; Secondary monster cost
jge safe
invisible:
call swap
safe:

; Selected primary and secondary monster

cmp word ptr [bp-8],189
jnz notwyrm
; Primary monster is great wyrm
mov ax,[bp-0Ah]
cmp ax,179 ; War Bears -> Reroll
jz rerollsec
cmp ax,187 ; Earth Elemental
jz rerollsec
cmp ax,181 ; Cockactirces
jz rerollsec
cmp ax,182 ; Great Lizard
jz rerollsec

notwyrm:
mov word ptr [bp-0Ch],0
rerollamount:
mov ax,10
call RND
dec ax ; 0-9 primary monsters
mov di,ax ; Nof primary monsters
mov ax,9
sub ax,di
inc ax
call RND
dec ax ; Can have 0 of these
mov si,ax ; Nof secondary monsters

mov ax,[bp-8]
call getunit
mov ax,[bx+216h]
imul di
push ax
mov ax,[bp-0Ah]
call getunit
mov ax,[bx+216h]
imul si
pop cx
add cx,ax ; Total cost of rolled monsters


mov ax,[bp+12h]
mov bx,100
add bx,[bp-2]
imul bx
mov bx,100
idiv bx

cmp ax,cx
jl bad

mov ax,[bp+12h]
mov bx,100
sub bx,[bp-2]
imul bx
mov bx,100
idiv bx

cmp ax,cx
jg bad

jmp done
bad:
inc word ptr [bp-0Ch]
cmp word ptr [bp-0Ch],50
jle rerollamount

inc word ptr [bp-0Eh]
cmp word ptr [bp-0Eh],50
jle reroll

add word ptr [bp-2],2
jmp reroll

done:

mov cx,si
pop si

or di,di
jnz ok1
mov di,cx ; Zero primary monster : move up secondary to primary slot
mov ax,[bp-0Ah]
mov [bp-8],ax
xor cx,cx
ok1:

or cx,cx ; no secondary monster and Earth Elemental or Wyrm? Reroll
jnz ok3
cmp word ptr [bp-8],187
jz redo
cmp word ptr [bp-8],189
jz redo
jmp ok3
redo:
push si
jmp bad
ok3:


mov ax,si
mov     dx, 18h
imul    dx
les bx, [089D6h] ; Dungeons
add     bx, ax

or di,di
jnz ok2
; zero of both monsters
mov byte ptr es:[bx+5],0
mov byte ptr es:[bx+6],0
jmp nosecond
ok2:

mov al,[bp-8]
mov es:[bx+5], al
mov ax,di
mov es:[bx+6],al
or cx,cx
jnz secondaryexists
nosecond:
mov byte ptr es:[bx+7],0
mov byte ptr es:[bx+8],0
jmp over
secondaryexists:
mov al,[bp-0Ah]
mov es:[bx+7],al
mov es:[bx+8],cl
over:
pop di
Reply

I just did some quick testing with this, starting several new games and only checking out the ruins and nodes close enough to be relevant to a fast start strategy.

Anecdotally (since I just did 8 test games) everything looks tougher now. High-value monsters are now the norm.

Out of the 6 test games on Arcanus, exactly 0 looked suited to the sprite strategy. The potential problem would be: other strategies, that nobody ever accused of being broken, also wouldn't be able to handle those ruins / nodes / etc.

Just to save myself from copious note taking, I only recorded the results of scouting (sending in spearman / swordsman) for the nodes. Here's what I found:

With power on High:
Game A: nearby node 1 = 3 stone giants, node 2 = 2 chaos spawn, node 3 = 2 djinn, node 4 = 4 chimera
Game B: nearby node 1 = 1 djinn and 3 air elementals, node 2 = 1 stone giant and 5 sprites, node 3 = 4 phantom beasts

With power on Good:
Game A: nearby node 1 = 9 chaos spawn, node 2 = 1 stone giant and 5 cockatrices, node 3 = 1 sky drake and 8 phantom beasts
Game B: nearby node 1 = 2 chimera, node 2 = 4 stone giant, node 3 = 2 efreet, node 4 = 7 phantom beast and 2 phantom warrior, node 5 = 6 phantom beast

With power on Fair:
Game A: nearby node 1 = 1 sky drake, node 2 = 4 air elementals, node 3 = 3 fire giants and 6 hell hounds, node 4 = 2 storm giants and 5 phantom beasts
Game B: nearby node 1 = 4 chaos spawn, node 2 = 2 storm giants and 4 phantom beasts, node 3 = 4 chimera, node 4 = 9 hell hounds

Myrran, power on High:
Game A: nearby node 1 = 4 sky drakes, node 2 = 6 doom bats, node 3 = 7 storm giants and 2 phantom warriors, node 3 = 2 behemoth and 1 giant lizard
Game B: nearby node 1 = 2 hydra and 5 chaos spawn, node 2 = 4 sky drakes and 5 phantom beast, node 3 = 6 doom bats and 3 chimera, node 4 = 9 chimera

Btw, where would I find magicedt.exe?
Reply

Another note: sorcery nodes are still the exception, in that any amount of phantom beast / warrior is a complete pushover. Thus, if you were playing most of these games you'd beeline to the sorcery nodes and ignore everything else. As Seravy noted in the other thread, sorcery nodes are potentially a problem for balancing the entire game, not just sprites.

I think the basic issue is that sorcery has no mid-level global summons. The combat summons suck: phantom beasts are among the easiest monsters in the game to fight in ruins / nodes, despite their high threat in wizard vs wizard combat. Meanwhile, air elementals are like other invisible monsters, in that they're kind of a trick card and would be really aggravating to see too frequently. They're either too strong or a pushover, and they're also literally impossible for many builds since even if you're beating them, they end up fleeing and 5 moves + invis + flying is too much to chase down (AI / strategic combat has no such issue!).

This actually feels like a broader problem in-game: sorcery wizards, especially in high challenge modes like Extreme, end up with massive hordes of nagas roaming around pointlessly in mid-game. A couple games ago I saw Merlin fielding an army of like 90-100 nagas, all of which were moving together from left-right across the map for no apparent reason (he was never at war with anyone).

Is the idea of adding a new sorcery monster totally unreasonable at this point? Or.. if nodes are the only real problem in your estimation, what about having a defensive effect similar to fortress lightning? Might be interesting if sorc nodes used an aether sparks or psionic blast scaled to their power. I also think it would make a lot of sense to only allow phantom warrior / beast in nodes, not ruins.
Reply

You probably had bad luck, the total amount of monster points in lairs is unchanged.
I've seen quite a few places with "many war bears" "many sprites" "few giant spiders" etc on the few maps I generated for testing.
The chance of one strong monster instead of many weak ones might be slightly higher but I don't think it should be this bad.

Quote:Is the idea of adding a new sorcery monster totally unreasonable at this point?

We can't add a monster without removing one and I don't want to remove anything.

If this really is a problem we can force these to always contain an air elemental or storm giant but I feel we would be going in the wrong direction there.
We are trying to balance things, not eliminate them. Weak targets need to exist for any entertaining game.
Sure, those phantoms might be still easy but their monster point value is so low you won't get any big treasure out of it. It's 100 for beasts and 25 for warriors.

Limiting how great wyrms can appear is fine because it doesn't change overall distribution much - there are other strong nature monsters and wyrms can still appear, just not without a ranged/webbing/whatever monster. On the other hand they have major impact on game balance - they provide top level treasure and can be taken out easily and early without this limitation - but only by very specific units.
Sorcery creatures have none of these features. They have a low treasure value now so their effect on game balance is low, they are a major part of monster distribution (pretty much half of the Sorcery realm is affected) and they can be taken out by anything equally easily.
Reply

Thoughts on my comment that phantom beasts would be far better being similar to air elementals rather than phantom warriors? (Specifically by making them faster and giving them a gaze attack)? Phantom warriors are in every game, so the similarity to phantom beast is extremely pronounced. Air elementals are often only in nodes - even if you play or fight a sorcery wizard, you may never encounter them. So having phantom beast more similar to them would not detract from the game in my opinion; and that would solve the issue of phantom beasts being pushovers (which is the only expensive sorcery unit that causes this problem). That would still leave some weak nodes, but not nearly as many, and the treasure would be better guarded.
Reply

I'm against that mainly because it would give an overpowered early game spell to the realm that's supposed to be weak exactly at that.
Phantom Beasts are already extremely good for an Uncommon.
Though it would solve the problem with the AI that they summon these then cannot attack fliers anyway, that problem is no longer significant, the AI learned to put Flight on them when necessary.
Still the last thing we want for Sorcery is an early game combat spell that allows run-and-stall tactics anywhere. (The best thing in Air Elemental is that nothing can catch it. You literally can't lose battles if you have that spell, unless the enemy has true sight and direct damage - Phantom Beasts have more than double health for less cost so they'd be even stronger for that)
Not just because it's powerful for the human player but because it's powerful and annoying for the AI and would encourage wrong choices (not fighting Sorcery wizards early when they are still weak).

...anyway, I think having Phantom Beasts at low treasure value is an adequate solution for that part of the problem.
The spell being somewhat redundant is a different story but it's not THAT redundant. Beasts are better to summon if you need something that can survive longer than a single attack.
Reply

Reuploaded because there was a bug : Nagas were never generated due to being the last monster in the table.
Reply

Hadn't really thought about this till now, but the new monster generation may have very badly skewed things in favor of the AI.

Generally speaking, for strategic combat, summons don't get vastly better as they increase in rarity. There are exceptions of course *cough hydra* but overall something like a great lizard isn't hugely better than war bears.

For the human player in tactical combat though, rarity makes a huge difference. That's what they're balanced around.

Next, in strategic combat, number of units is one of THE biggest factors. But costs of monsters means that getting a higher rarity mobster in a lair now equates to lower number of units. For strategic combat 9 hell hounds is absolutely harder than 2 doom bats. Obviously I know which I'd rather fight in normal combat.

Finally, certain city troops (generally high figure 'basic' troops that require a fighters guild, such as pikemen, halberdiers, berserkers) are often as good as rare summons in strategic combat. The AI builds fighters guilds all the time, for good reason - which means they pump out the ideal strategic combat lair clearing troops everywhere.

All of these combine to mean there's a very good chance that at the sane time as monster generation improved for human difficulty, it probably made things overall easier for the AI, by a noticeable amount.
Reply

Agreed. For the time being I'm not going to release this change as 4.01 until we have more experience with it, as it seems to have made a lot of things worse. It might be the rare case when "more is less" as in more balance here results in even worse overall game balance. We might need to revise the algorithm or roll back.
Reply

I do like changing the monster value for determining treasure. I think that's very valuable, and will affect the AI 'the same' in a way that's intuitive to players.
Reply



Forum Jump: