Bad Revolt bug

Non-platform specific questions.

Bad Revolt bug

Postby CrackedP0t » Thu Mar 13, 2014 9:49 pm

A vicious bug in my game for last month's tournament.
Once the "Again!" button's been pushed, the autocatchers only target where I placed the enemy in the editor, despite the fact that I set it to not create in the beginning.
Here's the code:
Attachments
Revolt.zip
(17.83 MiB) Downloaded 138 times
/人 ◕‿‿◕ 人\
Fang Pictures, my game development company:
http://fangpictures.comuf.com
User avatar
CrackedP0t
 
Posts: 157
Joined: Mon Dec 30, 2013 5:49 pm
Location: Crested Butte, CO (The US of A)
Score: 8 Give a positive score

Re: Bad Revolt bug

Postby lcl » Thu Mar 13, 2014 11:47 pm

I found the problem and created a fix.

The problem is that somehow GE doesn't always determine actor pointers to destroyed actors as NULL's, but actually points to the data the already destroyed actor had.
So, to avoid that I made an actor variable called exist and set that to 1 on every badshot actor's create actor event.

Then, where ever you used to check if (clone != NULL) or if (closestshot != NULL) just check if (clone->exist) and if (closestshot->exist).
You can also remove the check for if (clone->x != 0) and if (clone->y != 0)

Then, for the case when the actor can't find any clone that's free to start chasing on, you have to do something or it'll just continue with the previous direction and velocity and drift away from screen.
One way is to have an else statement and set it's directional_velocity to 0 there.

The other one is to have walls surrounding the game area and then adding PhysicalResponse between the actor and the walls, or a code to change it's angle to the opposite direction or something else.
EDIT: For example you could just throw a
Code: Select all
angle -= 180;

to the actor's Out of Vision -event. I tested it, and it works even when the value would go to negatives. If the angle is 45 and this code triggers, the angle gets set to 225 instead of -135. It's a noobish way to code it, but GE seems to be made to support it so I guess it's "legal" to do so. :)
--- EDIT ENDS ---

Then another problem is that GE's clone numbering isn't the clearest one possible.
I noticed that your for loop goes from bottombadshot to badshots, with bottombadshots being the number of the lowest indexed clone.
However, it was coded in a way that allowed that number to be wrong. And also, GE resets the clonenumbers to 0 if all clones get destroyed.
So I recommend you to just loop from 0 to badshots.

I hope this helps. If you need my fixed version ged, I can send it to you, but these instructions should be enough to help you fix it by yourself. :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Bad Revolt bug

Postby CrackedP0t » Fri Mar 14, 2014 12:49 am

OK, it seems fixed to me.
But would you mind checking it over?
Attachments
Revolt.ged
(In case it's not obvious, the data's in my previous post)
(23.14 KiB) Downloaded 119 times
/人 ◕‿‿◕ 人\
Fang Pictures, my game development company:
http://fangpictures.comuf.com
User avatar
CrackedP0t
 
Posts: 157
Joined: Mon Dec 30, 2013 5:49 pm
Location: Crested Butte, CO (The US of A)
Score: 8 Give a positive score

Re: Bad Revolt bug

Postby lcl » Fri Mar 14, 2014 2:13 am

I can't check it right now, I'm going to sleep. But I'll check it tomorrow.
However, if you need me to check if it is fixed, it sounds like there's something that doesn't work as you'd like it to, am I right? :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Bad Revolt bug

Postby lcl » Fri Mar 14, 2014 6:36 pm

I took a look at it and noticed one thing missing. But that was because I forgot to mention adding it xD

You have to add a destroy actor event to the badshot actor where you set its exist = 0.
Otherwise it looks basically the same as my version did.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron