niektb Posted July 23, 2013 Report Share Posted July 23, 2013 (edited) Hi everyone,I just started programming AI's, but as I try to understand the working of the currently existing AI's, there are a few questions raising:1. Which functions in the API are required for the AI to work properly? (e.g. gamestate etc.)2. All AI's use a plan-queue-system. Are there other systems possible?3. Why are the AI's stateless and is this required?Glad there is a forum over here. Regards,Niek Edited July 23, 2013 by niektb Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 23, 2013 Report Share Posted July 23, 2013 1. Technically, none. However the common-api (all versions) provide a few custom classes and a few basic functions.A function called "HandleMessage" will be called every turn (with the game state as a parameter, and optionally the shared component). You can check this in the file base.js in any common-api (though v3 uses the shared component which makes this slightly more complicated).2.Yes, if you can make one work.3.Because they weren't designed that way. It isn't required. Quote Link to comment Share on other sites More sharing options...
niektb Posted July 24, 2013 Author Report Share Posted July 24, 2013 Could someone please rewrite scaredybot for APIv3?Using APIv3 instead of v1, I tried to make scaredybot train a villager, but it gives me a bunch of errors that sharedAI is not defined in base.js (line 51).Am I not permitted to upload .js files??? Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 24, 2013 Report Share Posted July 24, 2013 niektb: common-api-v3 is not really designed to be used without the shared script at the moment (it's a little buggy). You can try setting "useShared": true in data.json, that might fix those errors. Quote Link to comment Share on other sites More sharing options...
niektb Posted July 24, 2013 Author Report Share Posted July 24, 2013 (edited) To all JS-programmers: It might be useful to use jshint as debugger in stead of the one included in the game. (Or in combination with) Edited July 24, 2013 by niektb Quote Link to comment Share on other sites More sharing options...
niektb Posted July 25, 2013 Author Report Share Posted July 25, 2013 Okay, I downgraded my AI to v2 but now I get an comparable error, namely that _entities[id] is undefined at line 226 from base.jsThis is my current code:function NiBotAI(settings){ BaseAI.call(this, settings); this.turn = 0;}NiBotAI.prototype = new BaseAI();NiBotAI.prototype.OnUpdate = function() { if (this.gameFinished){ return; } this.turn++;};What is wrong?Second question:Is there a way to reload scripts, so I don't have to reload the save game every time? Quote Link to comment Share on other sites More sharing options...
gameboy Posted July 25, 2013 Report Share Posted July 25, 2013 About the upcoming new version of Aegis AI, when released?Is it this week?, Or next week? Quote Link to comment Share on other sites More sharing options...
zoot Posted July 25, 2013 Report Share Posted July 25, 2013 About the upcoming new version of Aegis AI, when released?Is it this week?, Or next week?When it's done. 1 Quote Link to comment Share on other sites More sharing options...
RedFox Posted July 25, 2013 Report Share Posted July 25, 2013 When it's done.When it's done.â„¢ Quote Link to comment Share on other sites More sharing options...
niektb Posted July 25, 2013 Author Report Share Posted July 25, 2013 (edited) About the upcoming new version of Aegis AI, when released?Is it this week?, Or next week?Wraitii is currently rewriting lots of code in Aegis AI.http://www.wildfiregames.com/forum/index.php?showtopic=17144&pid=271828&st=20entry271828 Edited July 25, 2013 by niektb Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 25, 2013 Report Share Posted July 25, 2013 nietkb: this is a bit baffling to me. Does qBot work when you start it?Also: I know of no way to reload AIs live. Quote Link to comment Share on other sites More sharing options...
niektb Posted July 26, 2013 Author Report Share Posted July 26, 2013 (edited) After updating and rebuilding the solution everything goes fine, though it gives a warning. Where do I find an error log?Hmm...When I'm scanning with JSHint through APIv3 I get several errors like the following:In Shared.js:- 356,9: 'for each' is only available in Mozilla JavaScript extensions (use moz option).In map-module.js:- 5,1: 'const' is only available in JavaScript 1.7.Is this known?P.S. How do I send in a patch? (I've fixed several typographic errors in APIv3 like missing semicolons etc.)Edit: patch attached. Wriattii's patch from APIv3 is also inside. APIv3.patch Edited July 26, 2013 by niektb Quote Link to comment Share on other sites More sharing options...
gameboy Posted July 26, 2013 Report Share Posted July 26, 2013 Is it an error can not be resolved? :unknw: :unknw: Quote Link to comment Share on other sites More sharing options...
niektb Posted July 26, 2013 Author Report Share Posted July 26, 2013 Is it an error can not be resolved? :unknw: :unknw: Which one do you mean? Quote Link to comment Share on other sites More sharing options...
Nolanjoker Posted July 26, 2013 Report Share Posted July 26, 2013 he talk about a issue related to Aegis Bot. Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 26, 2013 Report Share Posted July 26, 2013 nietkb: those warning are actually normal, we're using spidermonkey and thus it supports stuff like "for each" (though I usually avoid it as it tends to be slow). I'll check your patch. Quote Link to comment Share on other sites More sharing options...
gameboy Posted July 27, 2013 Report Share Posted July 27, 2013 (edited) @wraitii:Also: 'I know of no way to reload AIs live.' BTW:Is this error can not be repaired? About Aegis AI Bot.BTW2: Is this problem no one can solve it?I'm pretty sure god won't help either Edited July 27, 2013 by gameboy Quote Link to comment Share on other sites More sharing options...
gameboy Posted July 28, 2013 Report Share Posted July 28, 2013 How can we do? Do need a month to solve it? :unknw: :unknw: :wallbash: :no: :no: Quote Link to comment Share on other sites More sharing options...
zoot Posted July 28, 2013 Report Share Posted July 28, 2013 How can we do?Download the source code and begin working: http://trac.wildfiregames.com/wiki/GettingStarted Looking forward to your patch. 3 Quote Link to comment Share on other sites More sharing options...
gameboy Posted July 29, 2013 Report Share Posted July 29, 2013 Oh,My God! Quote Link to comment Share on other sites More sharing options...
niektb Posted August 22, 2013 Author Report Share Posted August 22, 2013 When I'm trying to run my own AI, I get the following error at startup:WARNING: JavaScript warning: Script value conversion check failed: JSVAL_IS_BOOLEAN(v) (got type undefined)Does anyone know a way to solve this? Quote Link to comment Share on other sites More sharing options...
wraitii Posted August 22, 2013 Report Share Posted August 22, 2013 I'm not completely sure what started that error… It's happening on the normal AI too, but I haven't found the error, it's very odd. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.