Jump to content

[javascript] Web Worker supported in RMS and AI?


rjs23
 Share

Recommended Posts

If i understand correctly, I would say that its mixtures of:

1. Hierarchical FSM or Behavior tree, (example: if there is a building foundation and this worker is capable of building it, then assign this worker. If not, then make this worker to gather something. This also can be events-driven type of action )

2 .Planner (example: picking which buildings to be used that are best for this civilization then customize the AI behavior later on ) This would usually happens initially.

3. Rule based (example: worker can't build too far, worker can't gather resource far away, can't build dock if there is no fish)

So far it would be Planner at the start of the game, then it would become combination of FSM/Behavior Tree/Rule Based ai format. That's how I would see in my AI once it evolves.

I hope that answered to your question. :boredom:

I expect it to be vague lol. its formatting reveal what kind of habit I have: laziness :lol2:

I don't expect people to use my code at this point because, well, its very immature at this point.

Someone should look into making a quality utility with maybe a high strategic level planner. For an RTS this should produce the most effective AI.

Link to comment
Share on other sites

Someone should look into making a quality utility with maybe a high strategic level planner. For an RTS this should produce the most effective AI.

Dont't get me wrong, but why don't you try it yourself? This is open-source...I myself made some experiments, but I never came to the point where I would show my code here in the forums because people would probably lough about it... but you seem to be more advanced, so why not doing it?

Link to comment
Share on other sites

Dont't get me wrong, but why don't you try it yourself? This is open-source...I myself made some experiments, but I never came to the point where I would show my code here in the forums because people would probably lough about it... but you seem to be more advanced, so why not doing it?

My advise: don't be afraid of being laughed at. We're all newbies at some points. Being laughed at happens to almost everyone. If you want feedback about your experiment, you should feel free to do it. Don't let other people scare you of showing your work. To be honest, I don't think the community of 0 A.D would even laugh at anyone work. It's a good community here.

Currently, 0 AD needs a better AI. It wouldn't hurt 0AD to have more AI.

Moloas, you should try if you want to. ;)

I would love to have more competition in AI section since I'm competitive-driven. It's like programming game to me.

Link to comment
Share on other sites

Dont't get me wrong, but why don't you try it yourself? This is open-source...I myself made some experiments, but I never came to the point where I would show my code here in the forums because people would probably lough about it... but you seem to be more advanced, so why not doing it?

I am actually busy doing something else. I am indeed making my own AI, but not for 0 AD. I just like to discuss AI which is why I post here, as well as some other places. Posting on forums doesn't take up too much time, but making a full AI for 0 A.D. is too time intensive. I might do one in a year or so when I'll have more free time.

The reason I am suggesting a utility based AI is because as a serious strategy gamer I have never been able to find an AI I couldn't smash even if it cheated with no fog on the map and large res bonuses.

Link to comment
Share on other sites

Heres the new update for the new AI bot.

It shouldn't crash anymore after finishing a dock, and economic management is improved (less stupid decisions).

It should be a stable at this point.

It still does not train any units yet. It does not perform any military action yet.

It will be the last update for a while.

I won't be as active as I am in 0AD community or the AI bot I'm working on anymore (I no longer have much free time anymore :( ). But I'll work on it every once a while when I can. I still enjoy working on the AI to have fun with it sometimes.

I won't be on IRC much but I'll check the forum once a while. Hopefully I'll be active again next summer!

Edit: this ai bot is not a fully functional AI bot. I'm only share this for the interested AI developers.

Good luck!

simulation.zip

Edited by rjs23
Link to comment
Share on other sites

  • 7 months later...
Anyway, I am curious to know if Web Worker is supported in AI and RMS? Is AI muilti threaded already supported? Having muilti-threaded AI could help with performance in late game.

According to this page, a basic implementation of web workers ("dedicated workers") has been supported as far back as Firefox 3.5. The version of SpiderMonkey we are using (SpiderMonkey 1.8.5) corresponds to Firefox 4.0, I believe.

Does anyone have any idea why web workers might not be enabled in our engine, even though it is supposed to be supported? I tried accessing the global 'Worker' object that is supposed to be the API for this, but got the error:

ERROR: JavaScript error: Console line 1
ReferenceError: Worker is not defined
@Console:1

Link to comment
Share on other sites

I think that's a function that Firefox makes available to scripts and not spidermonkey directly.

Like the functions you can access via "Engine.FunctionName()" in our scripts.

Interesting. Could we in theory implement it ourselves as such a function, do you think?

Link to comment
Share on other sites

The question is if it's good to have threading functionality for scripts or if we should just run some scripts in separate threads from the engine.

At the moment we should upgrade spidermonkey first anyway because there were a lot of changes related to threading.

But my plan is trying to move the whole AI to a separate thread once the spidermonkey upgrade is completed.

  • Like 1
Link to comment
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.

 Share

×
×
  • Create New...