Jump to content
Sign in to follow this  
Nescio

How to modify 0 A.D.?

Recommended Posts

23 hours ago, Nescio said:

60. Currently 0 A.D. has “Wonder” and “Capture the Relic” victory conditions. I've been pondering about adding another, similar one, winning by centre count, e.g. control at least 10 centres for 10 minutes. Moving catafalques inside a heavily fortified base or concentrating your forces around a wonder is easier than protecting a number of centres with distances in between.

Unfortunately I have no idea what has to be done to implement it. Any suggestions?

I like the idea! I haven't really dug into it, but the victory conditions itself can be found in: `simulation/data/settings/victory_conditions`, whilst the scripts they refer to are located in `maps/scripts`.

  • Like 1

Share this post


Link to post
Share on other sites

There are many hotkeys already in game, probably more than a normal person can remember.

However, I'd like to have one more: pressing `Home` to cycle through your centres. Any suggestions on how to implement that?

  • Like 2

Share this post


Link to post
Share on other sites
5 hours ago, Nescio said:

There are many hotkeys already in game, probably more than a normal person can remember.

However, I'd like to have one more: pressing `Home` to cycle through your centres. Any suggestions on how to implement that?

I would suggest looking at how hotkey.selection.idleunit is implemented.

First you need to add the hotkey definition to default.cfg.  Then you would implement something like findIdleUnit in binaries/data/mods/public/gui/session/input.js.

Here are a few tickets covering this feature: #1899, #1492. You might be able to reuse some or all of those patches.

  • Like 1

Share this post


Link to post
Share on other sites
On 7/19/2019 at 4:43 PM, historic_bruno said:

First you need to add the hotkey definition to default.cfg.

Yeah, but that file is outside the public/ folder, so I'm not sure how that could be done with a mod?

Share this post


Link to post
Share on other sites
On 7/19/2019 at 11:09 AM, Nescio said:

However, I'd like to have one more: pressing `Home` to cycle through your centres. Any suggestions on how to implement that? 

Probably will add this to my mod in the next version. As historic_bruno said there are already patches with it implemented on trac.

Share this post


Link to post
Share on other sites
7 hours ago, Nescio said:

Yeah, but that file is outside the public/ folder, so I'm not sure how that could be done with a mod?

You have access to the following functions in JS (see JSInterface_ConfigDB.cpp):

bool Engine.ConfigDB_HasChanges(namespace)
bool Engine.ConfigDB_SetChanges(namespace, bool)
string Engine.ConfigDB_GetValue(namespace, key)
bool Engine.ConfigDB_CreateValue(namespace, key, value)
bool Engine.ConfigDB_RemoveValue(namespace, key)
bool Engine.ConfigDB_WriteFile(namespace, path)
bool Engine.ConfigDB_WriteValueToFile(namespace, key, value, path)
bool Engine.ConfigDB_SetFile(namespace, path)
bool Engine.ConfigDB_Reload(namespace)

For namespace, I guess "mod" is most appropriate. I think you could check if your new hotkey(s) are set yet in mod.cfg (mod namespace) and if not, set the defaults. Also check out the options GUI implementation.

Note: this isn't ideal -- each mod should have its own separate config.

  • Like 3

Share this post


Link to post
Share on other sites

62. If I understand correctly, elevation (from terrain, position, and entity's <Attack/Ranged/ElevationBonus>) increases effective maximum range (simulation/components/Attack.js: `Attack.prototype.GetRange`). However, I'd like it to also improve ranged attack damage; e.g. an archer standing on a wall 11.5 above the ground would inflict +23% damage on someone below. I guess it might actually be quite easy to do, but my understanding of JavaScript is rather limited.

Share this post


Link to post
Share on other sites
7 minutes ago, Nescio said:

62. If I understand correctly, elevation (from terrain, position, and entity's <Attack/Ranged/ElevationBonus>) increases effective maximum range (simulation/components/Attack.js: `Attack.prototype.GetRange`). However, I'd like it to also improve ranged attack damage; e.g. an archer standing on a wall 11.5 above the ground would inflict +23% damage on someone below. I guess it might actually be quite easy to do, but my understanding of JavaScript is rather limited.

D781 I plan on revising that next month. (To also include melee attacks.)

  • Like 1

Share this post


Link to post
Share on other sites
10 minutes ago, Freagarach said:

D781 I plan on revising that next month. (To also include melee attacks.)

Great!

Share this post


Link to post
Share on other sites
On 8/9/2019 at 12:40 PM, Nescio said:

62. If I understand correctly, elevation (from terrain, position, and entity's <Attack/Ranged/ElevationBonus>) increases effective maximum range (simulation/components/Attack.js: `Attack.prototype.GetRange`). However, I'd like it to also improve ranged attack damage; e.g. an archer standing on a wall 11.5 above the ground would inflict +23% damage on someone below. I guess it might actually be quite easy to do, but my understanding of JavaScript is rather limited.

Is this because of the trajectory/gravity adding force to the projectile? 

While the height bonus cannot currently be implemented (on hills or elevations), the wall attack bonus can certainly be implemented right now. 

Edited by wowgetoffyourcellphone

Share this post


Link to post
Share on other sites

Another idea I'd like to try out but have no idea how to implement:

63. Instead of a player population setting, have a world population setting; each surviving player is then entitled to a 1/n share. E.g. a four player game with a world population of 600: all players have a maximum population limit of 150 at start; one player is defeated, the others can now have up to 200; then another is defeated, both survivors up to 300. Methinks this would provide an interesting dynamic (do you keep weak players alive to prevent stronger opponents from training more units?) while avoiding performance issues and improving realism.

  • Like 2

Share this post


Link to post
Share on other sites

@Nescio I saw on your feature wish list that the distance limit for buildings applies to all players?

In `BuildRestrictions.js` after line 242 add:

let players = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetAllPlayers();

Then at lines 255 and 267 (the range queries) replace

[cmpPlayer.GetPlayerID()]

with

players

. That should do the job :)

Share this post


Link to post
Share on other sites
28 minutes ago, Freagarach said:

@Nescio I saw on your feature wish list that the distance limit for buildings applies to all players?

In `BuildRestrictions.js` after line 242 add:


let players = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetAllPlayers();

Then at lines 255 and 267 (the range queries) replace


[cmpPlayer.GetPlayerID()]

with


players

. That should do the job :)

Maybe could be translated in a gamemode ?

  • Like 1

Share this post


Link to post
Share on other sites
On 10/21/2019 at 8:50 AM, Freagarach said:

@Nescio I saw on your feature wish list that the distance limit for buildings applies to all players?

In `BuildRestrictions.js` after line 242 add:


let players = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetAllPlayers();

Then at lines 255 and 267 (the range queries) replace


[cmpPlayer.GetPlayerID()]

with


players

. That should do the job :)

Thanks! That was quite easy, the AI isn't complaining either, and it's nice in combination with capturable foundations, so I've incorporated in my 0abc mod.

  • Like 1

Share this post


Link to post
Share on other sites
On 8/22/2019 at 7:40 PM, Nescio said:

Another idea I'd like to try out but have no idea how to implement:

63. Instead of a player population setting, have a world population setting; each surviving player is then entitled to a 1/n share. E.g. a four player game with a world population of 600: all players have a maximum population limit of 150 at start; one player is defeated, the others can now have up to 200; then another is defeated, both survivors up to 300. Methinks this would provide an interesting dynamic (do you keep weak players alive to prevent stronger opponents from training more units?) while avoiding performance issues and improving realism.

D2426.

  • Like 2

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