EssexUniversityMCTS/gvgai

[Important][BUG] CloneSprite Effect doesn't work well

Opened this issue · 6 comments

Clone sprite (or anything that create sprite) if it happens due to EOS or Time Event. At the same time it creates the same itype of the object causing the event. The system crashes because of the for each loop. As we are changing in the list at the same time traversing it.

Do you have a specific game and level where this happened to you? It'll help me find and fix.
Thanks Ahmed!

It was a generated game here is the data in something similar to it (Just wait till the enemies reach EOS, I think same problem will happen with timer events becz its designed in the same way:

BasicGame square_size=32
SpriteSet
background > Immovable img=oryx/space1 hidden=True
base > Immovable color=WHITE img=oryx/planet
avatar > FlakAvatar stype=sam img=oryx/spaceship1
missile > Missile
sam > orientation=UP color=BLUE singleton=True img=oryx/bullet1
bomb > orientation=DOWN color=RED speed=0.5 img=oryx/bullet2
alien > Bomber stype=bomb prob=0.01 cooldown=3 speed=0.8
alienGreen > img=oryx/alien3
alienBlue > img=oryx/alien1
portal > invisible=True hidden=True
portalSlow > SpawnPoint stype=alienBlue cooldown=16 total=20 img=portal
portalFast > SpawnPoint stype=alienGreen cooldown=12 total=20 img=portal

LevelMapping
    . > background
    0 > background base
    1 > background portalSlow
    2 > background portalFast
    A > background avatar

TerminationSet
    SpriteCounter      stype=avatar               limit=0 win=False
    MultiSpriteCounter stype1=portal stype2=alien limit=0 win=True

InteractionSet
    avatar  EOS  > stepBack
    alien   EOS  > cloneSprite
    missile EOS  > killSprite

    base bomb > killBoth
    base sam > killBoth scoreChange=1

    base   alien > killSprite
    avatar alien > killSprite scoreChange=-1
    avatar bomb  > killSprite scoreChange=-1
    alien  sam   > killSprite scoreChange=2

Are you gonna modify this part of the code to allow it? or should I flag this problem in the logger as a warning and ignore it every single time it happens?

I won't be able to look at this until CIG deadline has passed. If there's a way to avoid the crash, let's go ahead with that for the moment.

Done for now :)

Thank you Ahmed. I'll re-open it just so I can remember it's there and needs a proper fix.