[javascript] Web Worker supported in RMS and AI?
#1
Posted 30 July 2012 - 07:04 PM
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.
I'm researching around to begin the AI creation for fun but before I begin, there are several things I would like to know:
1. is there any references document for AI
2. list of deprecated functions that shouldn't be used but exists in game? I would like to try to avoid outdated functions.
3. What are the 0AD AI system's most weakness?
I'm excited to learn how to make AI and possibly contribute something useful!
#2
Posted 30 July 2012 - 10:04 PM
#3
Posted 30 July 2012 - 10:07 PM
Kieran P [ aka k776 ]
Wildfire Games Open Source Development Manager
Contact me: kieran@wildfiregames.com
#4
Posted 30 July 2012 - 10:35 PM
Geek377, on 30 July 2012 - 10:04 PM, said:
k776, on 30 July 2012 - 10:07 PM, said:
So far, I'm still researching around what 0ad has to offer for muiltithreading. Does it offer JavaScript's Web Work or is there alternative to it?
Edited by rjs23, 30 July 2012 - 10:39 PM.
#5
Posted 31 July 2012 - 12:32 AM
#6
Posted 31 July 2012 - 12:55 AM
Wildfire Games Programmer
Contact me: deiz@wildfiregames.com
#7
Posted 31 July 2012 - 02:53 AM
Deiz, on 31 July 2012 - 12:55 AM, said:
Is there an option to disable outputting warning such as:
WARNING: JavaScript does not always return a value.
#8
Posted 31 July 2012 - 03:56 AM
Wildfire Games Programmer
Contact me: deiz@wildfiregames.com
#9
Posted 31 July 2012 - 05:51 PM
Deiz, on 31 July 2012 - 03:56 AM, said:
Does it return boolean if a unit iss within town radius?
Edit: Nvm I seew what it does. Thats good.
Edited by rjs23, 31 July 2012 - 07:42 PM.
#10
Posted 31 July 2012 - 10:07 PM
On the threading issue, the AI system was designed to handle threading very nicely. It will be very easy to thread it without sync issues because of the AIProxy layer which creates a copy of the games state before sending to the AI so the AI will work with a slightly out of date snapshot. What would be less easy would be to not break the profiler which is one of the reasons which this hasn't been done yet. So when writing an AI you can forget about threading completely and sometime later each AI will get a thread.
Jonathan Waller [ aka quantumstate ]
Wildfire Games AI Scripter
Contact me: jonathanmarkwaller at gmail dot com
Support Wildfire Games!
#11
Posted 31 July 2012 - 10:37 PM
It wouldn't be too bad to have an indepedent thread for each AI to use. Would make the game with qBot (yours) and juBot and demoBot more playable during late game.
I'm still exploring around. I'm using common-api-v2, playing around with juBot which my bot is based off. (juBot lags bit too much for me. Modified how it works a bit and works smoother for now.) Right now, I'm trying to determine how to find out if a unit/object is dead/deleted from the game. entity.position() doesn't seem to do the trick since they aren't updated when they die. registerUpdates() might be something that I am looking for.
Baby-step at a time!
Edited by rjs23, 31 July 2012 - 10:41 PM.
#12
Posted 01 August 2012 - 02:07 AM
What is the most correct way for AI to determine that this is a water object and not land? I don't see a class object from it that says its a water object.
I could do it by template name, but I'm afraid that could lead to instability in long run...
Fish has a class called Sea Creature and thats what I'm using in my bot to tell its a water related food.
#13
Posted 01 August 2012 - 05:21 AM
Make sure you're in the credits!
AI Players
JuBot | RootBot | SplitBot | qBot | Marilyn | arBot
#14
Posted 01 August 2012 - 10:36 PM
EntityCollection.prototype.removeEnt
They add/remove entity to/from the entityCollection right? When I try to use removeEnt function from the entityCollection, i will get an error that says ent.id() is undefined. I'm trying ot oragnize an entityCollection and filtering out the useless one and save it later for future reference but base.js() keeps messing up for some reason.
addEnt works fine for me so far but it seems removeEnt may be broke? I don't know, it may be my error.
Edit: I'm using common-api-v2
I'm trying to use removeEnt to keep the alive units only. When they die, removeEnt will be called to remove them.
Edit2: It's not really big of a problem but I'm just curious if those thing usable and stable enough for AI people.
Edited by rjs23, 02 August 2012 - 01:34 AM.
#15
Posted 16 August 2012 - 09:40 PM
Jonathan Waller [ aka quantumstate ]
Wildfire Games AI Scripter
Contact me: jonathanmarkwaller at gmail dot com
Support Wildfire Games!
#16
Posted 16 August 2012 - 11:37 PM
quantumstate, on 16 August 2012 - 09:40 PM, said:
I found out why it wasn't working. It turns out that events (when an unit gets created, destroyed or attacked) are little bit confusing. In Created events, it uses different attribute than what Destroyed events use.
In created events, I was using this script to gets its entity
event.msg.entity
but in destroyed events, its
event.msg.entityObj._entity
but I was using
event.msg.entity instead of event.msg.entityObj._entity for destroyed events. event.msg.entity is not defined in destroyed events type but is defined in created events type. That's what threw me off.
It confused me because I figured
event.msg.entity would work fine with any events but in Destroyed event, it would returns undefined. That is why I was having problem with using removeEnt function because it was actually receiving undefined object. It's working fine now.
Like you said, it must be an Entity object but it was passing as undefined.
Edited by rjs23, 17 August 2012 - 06:15 AM.
#17
Posted 17 August 2012 - 06:06 AM
Geek377, on 30 July 2012 - 10:04 PM, said:
Look like not all AI will be scared of water anymore. Right now, my AI finally is able to build a dock reliably near fishes
#18
Posted 18 August 2012 - 02:15 AM
rjs23, on 17 August 2012 - 06:06 AM, said:
Wildfire Games 3d Artist
Contact me: daniel[at]wildfiregames.com
Vote for 0 A.D. in the 2012 Indie of the Year awards!


Visit Revora Creative Network! : )
#19
Posted 18 August 2012 - 02:39 AM
However, if you train the worker/boats for the AI, then AI will do the rest.
Other than that, lots of debugs warning and sometime other strange warnings.
How do you want me to upload AI's files?
Edited by rjs23, 18 August 2012 - 02:40 AM.
#20
Posted 18 August 2012 - 02:54 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











