EssexUniversityMCTS / gvgai

This is the framework for the General Video Game Competition - http://www.gvgai.net/
Other
140 stars 69 forks source link

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

Open amidos2006 opened 7 years ago

amidos2006 commented 7 years ago

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.

diegopliebana commented 7 years ago

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

amidos2006 commented 7 years ago

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
amidos2006 commented 7 years ago

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?

diegopliebana commented 7 years ago

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.

amidos2006 commented 7 years ago

Done for now :)

diegopliebana commented 7 years ago

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