Jump to content
Sign in to follow this  
niektb

AI development questions

Recommended Posts

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. :stinker:

Regards,

Niek

Edited by niektb

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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??? :P

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 by niektb

Share this post


Link to post
Share on other sites

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.js

This 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?

Share this post


Link to post
Share on other sites

About the upcoming new version of Aegis AI, when released?

Is it this week?, Or next week?

When it's done.
  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 by niektb

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

@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 :D

Edited by gameboy

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...