Rather large project

0 favourites
  • 7 posts
From the Asset Store
With this template you can create your own archer game and customize it however you want.
  • Hi guys!

    I've been working on a project for the last couple of weeks, and recently created an AI system for 4 cpu players, however, I later decided to expand it slightly, and so I am going through the code and fixing things here and there so I can use as many ai players as I want.

    However, I've hit a snag. For some reason my ai stop fighting (both each other and human players) seemingly randomly upon a spawn.

    Not sure why, and that's why I'm here.

    I have tried recreating it as a smaller file, but there's something in my code that is causing a conflict. I was wondering if some kind person out there might be interested in giving my code a quick debug. It still has a couple of glitches, but that's because I haven't finished updating it all to the new system. I just want to know why they stop fighting.

    In any case, if you think you're good enough with C" to help me out, please let me know and I will PM you the code. The file is quite small (under 2mb) but it does have over 300 events. Many are not important, and I think I'm close to figuring out the problem.

    Anyway, hope someone out there can help!

  • Ok, $50 if someone can help!

  • Just want to start by saying im not here to offer to debug your code :D

    But what you could do, as I find very useful, when I run into stuff like you have here, and uncertain what is going on, is to make a list. That visually keep track of everything about the object causing problem.

    In my current project for instant I have objects with 76 variables, that are manually added, so something is bound to go wrong at some point. But having a list to where I can add those variables and keep track of those, that might cause problem is a really big help.

    In your case you could make it so it constantly keep track of the enemy.UID, Target.UID, etc.

    If you know that each enemy should keep track of its target. Then at some point. It might loose target and the target.UID might show something strange.

    Another way is to simply add a text object and simply set it to "Check" when the "code reader" gets to it. And then you just move it around to the places where you suspect things might go wrong.

    Anyway good luck finding the problem :D

  • YAY! I was able to replicate the issue!

    https://copy.com/mTfTkCSikS1vrcrN

    For some reason, if both ships (as shown in the attached example) do not have their booleans set to true to fire at the same time, neither ship will fire. I find this odd, personally, as I thought family only checked which was true. If I remove the 'Trigger once' command, it works, but it's constant.

    Very strange. I fixed this by using a global variable that is changing, rather than an instance variable, but I'd be interested in knowing what exactly I'm doing wrong here...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Trigger once shouldn't be used in situations like this with multiple instances and for each loops. In your example, there is always instances that have laserleft equaling true and false, which means that both the trigger once events run every tick - meaning they only shoot once. Trigger once needs to not run in order to reset itself. If both ships are set to true, that means the trigger once events don't run every other tick, and therefore it works.

    Here's an example of how to do it better: http://www.amirai.net/forums/StopsShooting2.zip

    At least, that's what I thought you were basically trying to achieve. This way, it doesn't matter how many instances you have or what the other instances are doing.

    Is that $50 - or some of the $50 since you isolated it - still up for grabs? ^^ I could really use it...

  • Thanks Arima. The $50 was for someone to actually go through my 300+ event capx and figure out the problem. That was to save me from 5+ hours of tweaking. Sadly nobody seemed interested so I ended up finding the problem and coming up with a solution on my own.

    It's appreciated though, and I will PM you directly if I get stuck again with my code as a whole with a cash incentive.

  • Yeah, that's what I thought, thought it was worth asking though just in case.

    Cheers to keeping me in mind for any future debugging needs. :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)