What is missing?

For AI and campaign script related discussions and questions
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: What is missing?

Post by aubergine »

Could weapon objects be given a .type = WEAPON_DATA ?

And the recently added template object (despite being experimental) a .type = TEMPLATE_DATA ?

@NoQ: Why not just have an eventSensorLock(sensor[, target]):

* Triggers when a sensor droid locks on to a target (which means it also fires when a new target is selected)
* Triggers when sensor droid no longer has a target, 'target' = not defined in this scenario

Code: Select all

eventSensorLock(sensor, target) {
   if (!target) // sensor is inactive
}
And, instead of obj.sensorIsActive, I would much prefer an obj.target property:

* null -- the droid is not currently targeting any game object or position
* the target a sensor is locked on to
* the structure a truck is building
* the object a weapon is attacking
* the repair/rearm pad a droid is going to or at
* the POSITION on the map a droid is moving to, circling, etc.
* the patrol points, expressed as an AREA object (droid patrols between x1,y1 and x2,y2)
* etc...

So .target could be an object of types: DROID, STRUCTURE, FEATURE, POSITION

It could that sensor targets are split out in to a .sensorTarget property instead?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: What is missing?

Post by NoQ »

Why not just
Sure, whatever (:
obj.target property
as far as i remember, Nexus AI uses something like that to figure out how many trucks were ordered to capture an oil (:
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: What is missing?

Post by aubergine »

On further pondering...

As .target could be a large object (eg. a droid object) maybe it would be better to ditch the .target property and just have getDroidTarget(droidObj) return the target. This way we're not creating double the objects just for a simple enumDroid().
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: What is missing?

Post by aubergine »

For .weapons, could the .name be changed to .id? And then use getWeaponInfo(id) to get the weapon data object.

In the weapon data object, rename .name to .id, and then .fullname to name.

While this might deviate from stats a little, it would just make much more sense in JS API. Generally all objects use .name for the human-readable-ish name for something, and .id as a unique ID.

eg. droid.id and droid.name

I often wonder if the same should be done with research objects -- .id = unique id of research, .name = human readable name

IIRC, all the human readable names come from names.txt (which I believe will be merged in to other ini files as name properties) so it seems logical to always have .name = human readable.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: What is missing?

Post by aubergine »

Could we get an enumWeapons(researched) -- returns list of weapon ids.

* if researched == true, only researched weapons are returned
* if researched == false, weapons not yet researched are returned
* defaults to true

We can then getWeaponInfo(<elementValue>) to get data about the weapon.

Would getWeaponInfo() be better named as getWeaponData() ?

On weapon data objects, a .requiredResearch property could indicate the research goal (id of the research) required to get that weapon. If already researched, .requiredResearch = null.

We can use findResearch() to get full list of technologies that are required to reach that goal.

Code: Select all

if (someWeapon.requiredResearch) {
  var researchRequired = findResearch(someWeapon.requiredResearch);
}
...or just pursueResearch(someWeapon.requiredResearch) at a lab.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Post Reply