Page 4 of 8

Re: [WIP] Diplomacy OXP

Posted: Sat Apr 29, 2017 10:22 pm
by Day
The 0.7 version is in the manager. Strategic Map !!! :D
2 evolutions:
- tech: an Alliances Engine is being implemented,
- flavor: added a F4 Strategic Map, showing links between systems nearer than 7. The relation between systems is currently based on their government.

No known bug.
The event system is disabled in this version.

Disclaimer: It is STILL a Work In Progress.
In particular, the savefile format might change in the future; so it wouldn't do to expect a savefile from an old version to work with a newer version code.
If experimenting problems, the easy way is to edit the savefile and remove the lines including "Diplomacy". Then next start, the oxp will begin anew.

In the next version, it might be that
a) the event system is speedily working,
b) an event is implemented.

Changelog

0.7 Improvement, flavor: added a F4 Strategic Map, showing links between systems nearer than 7. The relation between systems is currently based on their government.
0.6 Improvement, flavor: tax amount depends on the time spent since the last taxation.
Improvement, speed: major refactor to remove closures, dereferences, JSON (de)serialization special functions.
0.5 Bugfix manifest.plist for the oxz manager.
0.4 Put into the oxz manager.
0.3 New, oxp dev func: delivered DiplomacyEngineAPI for oxp developers, provided a dedicated readme file.
New, doc: provided a dedicated file DiplomacyRoadmap.txt
Improvement, code consistency: the Systems and Tax js script now use the API rather than the native engine calls.
Improvement, speed: optimized the loops in the engine
Improvement, logic: when starting, the player is docked, so we should process the saved actions.
Bugfix: solved a bug in the Tax script recurrent tax task after a savefile load.
Bugfix: the init action using the api wasn't working after a restore from the savefile.
Cleaning: log cleaning, file cleaning.
0.2 The actions are made progressively, one every 10 frames when docked, so as not to need more execution time than allowed at the same time, and to avoid slowdowns during the game.
0.1 First version of the Diplomacy engine. Systems are introduced as a type of "Actor". "SELFTAX" is introduced as an event for systems. Tax level and treasury are displayed on the F7 screen.

Re: [WIP] Diplomacy OXP

Posted: Fri May 19, 2017 11:59 am
by Day
The 0.8 version is in the manager. Alliances and Snooper news edition !!! :D

-------------------------------------------------------------------------------------

Systems treasury!
Wars require money, and countries are defeated either by battles or by bankruptcy,
sometimes the latter producing the former.
The Treasury and Tax levels are displayed in the F7 system information.
Each system treasury is increased through taxation each player jump,
depending on the time past since the last jump.

Strategic map!
New F4 Interface screen: the Diplomacy Strategic Map!
There, you can see the systems which (dis)like each other...

Systems alliances!
Two systems within 7ly of each other may now form an alliance, if they like each other enough.

News!
Some Snooper news are now displayed when an alliance is formed between two systems,
and the player is within 7ly of one of the allied systems.

-------------------------------------------------------------------------------------

The next version might provide:
- the score given to a system by another depend on who they are allied to.
- Systems may break an alliance if they don't like anymore the other system.
- An Alliance API.
- The score threshold to form an alliance is configurable through the Alliance API.
- Bugfix : currently, only systems within 7 ly of the system with the highest id of the 2 systems in an alliance
are informed of the alliance. It should be systems within 7 ly of any of the 2 systems in the alliance.

-------------------------------------------------------------------------------------

Dependencies : Snoopers OXP

Known bug : currently, only systems within 7 ly of the system with the highest id of the 2 systems in an alliance are informed of the alliance. It should be systems within 7 ly of any of the 2 systems in the alliance.

Disclaimer: It is STILL a Work In Progress.
In particular, the savefile format might change in the future; so it wouldn't do to expect a savefile from an old version to work with a newer version code.
If experimenting problems, the easy way is to edit the savefile and remove the lines including "Diplomacy". Then next start, the oxp will begin anew.

-------------------------------------------------------------------------------------

Changelog

0.8 Improvement, flavor: Two systems within 7ly of each other may now form an alliance, depending
on their relation quality. Currently, each must have a score for the other of at least +0.5.
Improvement, flavor: some Snooper news are now displayed when an alliance is formed between two systems,
and the player is within 7ly of one of the allied systems.
New, oxp dev func: introduced a functional Event system.
0.7 Improvement, flavor: added a F4 Strategic Map, showing links between systems nearer than 7. The relation between systems is currently based on their government.
0.6 Improvement, flavor: tax amount depends on the time spent since the last taxation.
Improvement, speed: major refactor to remove closures, dereferences, JSON (de)serialization special functions.
0.5 Bugfix manifest.plist for the oxz manager.
0.4 Put into the oxz manager.
0.3 New, oxp dev func: delivered DiplomacyEngineAPI for oxp developers, provided a dedicated readme file.
New, doc: provided a dedicated file DiplomacyRoadmap.txt
Improvement, code consistency: the Systems and Tax js script now use the API rather than the native engine calls.
Improvement, speed: optimized the loops in the engine
Improvement, logic: when starting, the player is docked, so we should process the saved actions.
Bugfix: solved a bug in the Tax script recurrent tax task after a savefile load.
Bugfix: the init action using the api wasn't working after a restore from the savefile.
Cleaning: log cleaning, file cleaning.
0.2 The actions are made progressively, one every 10 frames when docked, so as not to need more execution time than allowed at the same time, and to avoid slowdowns during the game.
0.1 First version of the Diplomacy engine. Systems are introduced as a type of "Actor". "SELFTAX" is introduced as an event for systems. Tax level and treasury are displayed on the F7 screen.

Re: [WIP] Diplomacy OXP

Posted: Sat Jun 03, 2017 7:04 am
by Day
The 0.9 version is in the manager. Alliances may be broken!!! Other dev can introduce alliances rules through the Alliance API :D

-------------------------------------------------------------------------------------

Systems treasury!
Wars require money, and countries are defeated either by battles or by bankruptcy,
sometimes the latter producing the former.
The Treasury and Tax levels are displayed in the F7 system information.
Each system treasury is increased through taxation each player jump,
depending on the time past since the last jump.

Strategic map!
New F4 Interface screen: the Diplomacy Strategic Map!
There, you can see the systems which (dis)like each other...

Systems alliances!
Two systems within 7ly of each other may now form or break an alliance, if they like each other enough.

News!
Some Snooper news are now displayed when an alliance is formed between two systems,
and the player is within 7ly of one of the allied systems.

-------------------------------------------------------------------------------------

The next version might provide:
- the History
- a more complete alliance API

-------------------------------------------------------------------------------------

Dependencies : Snoopers OXP

No known bug.

Disclaimer: It is STILL a Work In Progress.
In particular, the savefile format might change in the future; so it wouldn't do to expect a savefile from an old version to work with a newer version code.
If experimenting problems, the easy way is to edit the savefile and remove the lines including "Diplomacy". Then next start, the oxp will begin anew.

-------------------------------------------------------------------------------------

Effects on game performance

This oxp works only when the player is docked, so there is no impact during the flight time.
During the docking, it works once every ten frames, the effect on player experience should be negligible.
If it isn't negligible, tell me and I'll put in the ability to choose the number of frames.
Even if the effect is negligible on the player, it uses lots of cpu, so it might not be negligible on the battery.

-------------------------------------------------------------------------------------

Changelog

0.9 Improvement, flavor: the score given to a system by another depend on who they are allied to.
Improvement, flavor: systems may now break their alliances.
Bugfix: systems within 7 ly of any of both systems in the alliance are now informed of the alliance.
Improvement, dev func: introduced an Alliance API.
0.8 Improvement, flavor: Two systems within 7ly of each other may now form an alliance, depending
on their relation quality. Currently, each must have a score for the other of at least +0.5.
Improvement, flavor: some Snooper news are now displayed when an alliance is formed between two systems,
and the player is within 7ly of one of the allied systems.
New, oxp dev func: introduced a functional Event system.
0.7 Improvement, flavor: added a F4 Strategic Map, showing links between systems nearer than 7. The relation between systems is currently based on their government.
0.6 Improvement, flavor: tax amount depends on the time spent since the last taxation.
Improvement, speed: major refactor to remove closures, dereferences, JSON (de)serialization special functions.
0.5 Bugfix manifest.plist for the oxz manager.
0.4 Put into the oxz manager.
0.3 New, oxp dev func: delivered DiplomacyEngineAPI for oxp developers, provided a dedicated readme file.
New, doc: provided a dedicated file DiplomacyRoadmap.txt
Improvement, code consistency: the Systems and Tax js script now use the API rather than the native engine calls.
Improvement, speed: optimized the loops in the engine
Improvement, logic: when starting, the player is docked, so we should process the saved actions.
Bugfix: solved a bug in the Tax script recurrent tax task after a savefile load.
Bugfix: the init action using the api wasn't working after a restore from the savefile.
Cleaning: log cleaning, file cleaning.
0.2 The actions are made progressively, one every 10 frames when docked, so as not to need more execution time than allowed at the same time, and to avoid slowdowns during the game.
0.1 First version of the Diplomacy engine. Systems are introduced as a type of "Actor". "SELFTAX" is introduced as an event for systems. Tax level and treasury are displayed on the F7 screen.

Re: [WIP] Diplomacy OXP

Posted: Fri Jun 23, 2017 9:30 am
by Day
The 0.10 version is in the manager. New "System history" F4 interface, showing the F7-selected system events history, currently including alliances and alliance breaks.

==============================

The next version might provide: WARS!!!

==============================


Systems treasury!
Wars require money, and countries are defeated either by battles or by bankruptcy,
sometimes the latter producing the former.
The Treasury and Tax levels are displayed in the F7 system information.
Each system treasury is increased through taxation each player jump,
depending on the time past since the last jump.

Strategic map!
New F4 Interface screen: the Diplomacy Strategic Map!
There, you can see the systems which (dis)like each other...

Systems alliances!
Two systems within 7ly of each other may now form an alliance, if they like each other enough.
They may break their alliance, too =-o !
New F4 Interface screen: the Systems History!

News!
Some Snooper news are now displayed when an alliance is formed or broken between two systems,
and the player is within 7ly of one of those systems.

==============================
What's currently implemented technically?

The oxp contains Engines which may be accessed through APIs: EngineAPI, AlliancesEngineAPI, HistoryAPI, SystemsAPI.

The APIs are designed to be easy to use by developers to implement interesting galaxy-spanning events.

High-level behaviors are currently implemented using these APIs in the aptly named following scripts:
Systems, Tax, Alliances, History.

==============================
Effects on game difficulty

None yet.

==============================
Effects on game performance

This oxp works only when the player is docked, so there is no impact during the flight time.
During the docking, it works once every ten frames, the effect on player experience should be negligible.
If it isn't negligible, tell me and I'll put in the ability to choose the number of frames.
Even if the effect is negligible on the player, it uses lots of cpu, so it might not be negligible on the battery.

==============================
Compatibility

==============================
Dependencies

- Snoopers OXP

==============================
Instructions

Do not unzip the .oxz file, just move into the AddOns folder of your Oolite installation.

==============================
License

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License version 4.0.
If you are re-using any piece of this OXP, please let me know by sending an e-mail to david at pradier dot info

==============================
Known bugs

None.

==============================
Changelog

0.10 Improvement, flavor: added a F4 System history, showing the F7-selected system events history. The displayed text depends on a formatting function definable through API per event.
Improvement, flavor: the alliance and alliance break events are now displayed in the history.
Improvement, dev func: the EngineAPI provides the events, and the events by actor.
Improvement, dev func: the EngineAPI allows now to store a variable in the saved state with the other saved variables of the oxp.
Improvement, dev func: introduced a Systems API and a History API. The systems API provides the system actors indexed by galaxyID and systemID.
0.9 Improvement, flavor: the score given to a system by another depend on who they are allied to.
Improvement, flavor: systems may now break their alliances.
Bugfix: systems within 7 ly of any of both systems in the alliance are now informed of the alliance.
Improvement, dev func: introduced an Alliance API.
0.8 Improvement, flavor: Two systems within 7ly of each other may now form an alliance, depending
on their relation quality. Currently, each must have a score for the other of at least +0.5.
Improvement, flavor: some Snooper news are now displayed when an alliance is formed between two systems,
and the player is within 7ly of one of the allied systems.
New, oxp dev func: introduced a functional Event system.
0.7 Improvement, flavor: added a F4 Strategic Map, showing links between systems nearer than 7. The relation between systems is currently based on their government.
0.6 Improvement, flavor: tax amount depends on the time spent since the last taxation.
Improvement, speed: major refactor to remove closures, dereferences, JSON (de)serialization special functions.
0.5 Bugfix manifest.plist for the oxz manager.
0.4 Put into the oxz manager.
0.3 New, oxp dev func: delivered DiplomacyEngineAPI for oxp developers, provided a dedicated readme file.
New, doc: provided a dedicated file DiplomacyRoadmap.txt
Improvement, code consistency: the Systems and Tax js script now use the API rather than the native engine calls.
Improvement, speed: optimized the loops in the engine
Improvement, logic: when starting, the player is docked, so we should process the saved actions.
Bugfix: solved a bug in the Tax script recurrent tax task after a savefile load.
Bugfix: the init action using the api wasn't working after a restore from the savefile.
Cleaning: log cleaning, file cleaning.
0.2 The actions are made progressively, one every 10 frames when docked, so as not to need more execution time than allowed at the same time, and to avoid slowdowns during the game.
0.1 First version of the Diplomacy engine. Systems are introduced as a type of "Actor". "SELFTAX" is introduced as an event for systems. Tax level and treasury are displayed on the F7 screen.

Re: [WIP] Diplomacy OXP

Posted: Sun Jul 16, 2017 4:08 am
by phkb
Day, I'm noticing something strange going on. After I jump into a system and dock at a station, shortly afterwards I start getting a whole pile of Snooper's news items telling me about a dozen or so new allegiances that have just taken place. But they all seem to have happened at once, because I have to sit there pressing space to the same message over and over. Plus part of the message appears to be missing a text replacement, as it reads "As XXX said,". Unless that's just a reminder to look up the original author of that quote?

Re: [WIP] Diplomacy OXP

Posted: Sun Jul 16, 2017 8:36 am
by Day
phkb wrote: Sun Jul 16, 2017 4:08 am
Day, I'm noticing something strange going on. After I jump into a system and dock at a station, shortly afterwards I start getting a whole pile of Snooper's news items telling me about a dozen or so new allegiances that have just taken place.
Well yes, they're the initial alliances. It's what's expected. 12 news means 6 alliances. You should only see the alliances concerning systems nearer than 7 ly from you.

But really, although that was useful to debug, I understand that seeing all the initial alliances may be too much.
Would you have an idea?
phkb wrote: Sun Jul 16, 2017 4:08 am
But they all seem to have happened at once, because I have to sit there pressing space to the same message over and over.
Well, you see them all at once, when docked in.
phkb wrote: Sun Jul 16, 2017 4:08 am
Plus part of the message appears to be missing a text replacement, as it reads "As XXX said,". Unless that's just a reminder to look up the original author of that quote?
Ah... You're right, I've forgotten to put in the original author.

Re: [WIP] Diplomacy OXP

Posted: Sun Jul 16, 2017 8:57 am
by phkb
I think a single message saying "Allegiances have changed" and then creating an F4 screen that lists all of them that are relevant to the current system (like a short range screen version of the galactic map you currently have) would be helpful.

Re: [WIP] Diplomacy OXP

Posted: Mon Jul 17, 2017 8:10 am
by Day
phkb wrote: Sun Jul 16, 2017 8:57 am
I think a single message saying "Allegiances have changed" and then creating an F4 screen that lists all of them that are relevant to the current system (like a short range screen version of the galactic map you currently have) would be helpful.
Alternate proposition:
- instead of some news for each system nearer than 7 ly from the player, I would display news only for the system in which the player is,
- I would add a F4 screen map showing the current alliances.

What do you think?

Re: [WIP] Diplomacy OXP

Posted: Mon Jul 17, 2017 8:23 am
by phkb
Sounds good! Have to see how it plays when you're done.

Re: [WIP] Diplomacy OXP

Posted: Thu Jul 27, 2017 3:14 pm
by Day
The 0.11 version is in the manager.

Improvement, flavor: added a F4 Alliances Map, showing alliances between systems.
Improvement, flavor: having only news for the player current system.
Improvement, flavor: fixed Diziet Sma citation
Improvement, code consistency: the tax script becomes the economy script.
Improvement, code consistency: removed the TechnicalPrinciples.txt file, as its content is now mainly in the new OXP Performance thread.
Improvement, dev func: added a beginning of Economy Engine API.
Improvement, dev func: added a _debug flag in the Engine to start as if you just spent a turn and entered the station; ie, events are processing.

==============================

The next versions might provide:
0.12 War declaration! (at_war with a system if score < warThreshold)
0.12 Wars map! (merged with the allies map)
0.13 War declaration generates an immediate gdp growth increase!

==============================


What's currently implemented functionality-wise?

Systems treasury!
Wars require money, and countries are defeated either by battles or by bankruptcy,
sometimes the latter producing the former.
The Treasury and Tax levels are displayed in the F7 system information.
Each system treasury is increased through taxation each player jump,
depending on the time past since the last jump.

Strategic maps!
New F4 Interface screens: the Diplomacy Strategic Map! The Alliances Map!
There, you can see the systems which (dis)like each other...

Systems alliances!
Two systems within 7ly of each other may now form an alliance, if they like each other enough.
They may break their alliance, too =-o !
New F4 Interface screen: the Systems History!

News!
Some Snooper news are now displayed when an alliance is formed or broken between two systems,
and the player is within 7ly of one of those systems.

==============================
What's currently implemented technically?

The oxp contains Engines which may be accessed through APIs: EngineAPI, AlliancesEngineAPI, HistoryAPI, SystemsAPI.

The APIs are designed to be easy to use by developers to implement interesting galaxy-spanning events.

High-level behaviors are currently implemented using these APIs in the aptly named following scripts:
Systems, Tax, Alliances, History.

==============================
Effects on game difficulty

None yet.

==============================
Effects on game performance

This oxp works only when the player is docked, so there is no impact during the flight time.
During the docking, it works once every ten frames, the effect on player experience should be negligible.
If it isn't negligible, tell me and I'll put in the ability to choose the number of frames.
Even if the effect is negligible on the player, it uses lots of cpu, so it might not be negligible on the battery.

==============================
Compatibility

==============================
Dependencies

- Snoopers OXP

==============================
Instructions

Do not unzip the .oxz file, just move into the AddOns folder of your Oolite installation.

==============================
License

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License version 4.0.
If you are re-using any piece of this OXP, please let me know by sending an e-mail to david at pradier dot info

==============================
Known bugs

None.

==============================
Changelog

0.11 Improvement, flavor: added a F4 Alliances Map, showing alliances between systems.
Improvement, flavor: having only news for the player current system.
Improvement, flavor: fixed Diziet Sma citation
Improvement, code consistency: the tax script becomes the economy script.
Improvement, code consistency: removed the TechnicalPrinciples.txt file, as its content is now mainly in the new OXP Performance thread.
Improvement, dev func: added a beginning of Economy Engine API.
Improvement, dev func: added a _debug flag in the Engine to start as if you just spent a turn and entered the station; ie, events are processing.
0.10 Improvement, flavor: added a F4 System history, showing the F7-selected system events history. The displayed text depends on a formatting function definable through API per event.
Improvement, flavor: the alliance and alliance break events are now displayed in the history.
Improvement, dev func: the EngineAPI provides the events, and the events by actor.
Improvement, dev func: the EngineAPI allows now to store a variable in the saved state with the other saved variables of the oxp.
Improvement, dev func: introduced a Systems API and a History API. The systems API provides the system actors indexed by galaxyID and systemID.
0.9 Improvement, flavor: the score given to a system by another depend on who they are allied to.
Improvement, flavor: systems may now break their alliances.
Bugfix: systems within 7 ly of any of both systems in the alliance are now informed of the alliance.
Improvement, dev func: introduced an Alliance API.
0.8 Improvement, flavor: Two systems within 7ly of each other may now form an alliance, depending
on their relation quality. Currently, each must have a score for the other of at least +0.5.
Improvement, flavor: some Snooper news are now displayed when an alliance is formed between two systems,
and the player is within 7ly of one of the allied systems.
New, oxp dev func: introduced a functional Event system.
0.7 Improvement, flavor: added a F4 Strategic Map, showing links between systems nearer than 7. The relation between systems is currently based on their government.
0.6 Improvement, flavor: tax amount depends on the time spent since the last taxation.
Improvement, speed: major refactor to remove closures, dereferences, JSON (de)serialization special functions.
0.5 Bugfix manifest.plist for the oxz manager.
0.4 Put into the oxz manager.
0.3 New, oxp dev func: delivered DiplomacyEngineAPI for oxp developers, provided a dedicated readme file.
New, doc: provided a dedicated file DiplomacyRoadmap.txt
Improvement, code consistency: the Systems and Tax js script now use the API rather than the native engine calls.
Improvement, speed: optimized the loops in the engine
Improvement, logic: when starting, the player is docked, so we should process the saved actions.
Bugfix: solved a bug in the Tax script recurrent tax task after a savefile load.
Bugfix: the init action using the api wasn't working after a restore from the savefile.
Cleaning: log cleaning, file cleaning.
0.2 The actions are made progressively, one every 10 frames when docked, so as not to need more execution time than allowed at the same time, and to avoid slowdowns during the game.
0.1 First version of the Diplomacy engine. Systems are introduced as a type of "Actor". "SELFTAX" is introduced as an event for systems. Tax level and treasury are displayed on the F7 screen.

Re: [WIP] Diplomacy OXP

Posted: Tue Nov 13, 2018 10:53 am
by Day
Oxp code uploaded to sourceforge: https://sourceforge.net/p/oolitediplomacy/

Re: [WIP] Diplomacy OXP

Posted: Tue Nov 13, 2018 1:33 pm
by montana05
I finally need to give it a test try, I guess there are plenty of opportunities to implement the System Guard Navy.

Re: [WIP] Diplomacy OXP

Posted: Tue Nov 13, 2018 1:54 pm
by Day
montana05 wrote: Tue Nov 13, 2018 1:33 pm
I finally need to give it a test try, I guess there are plenty of opportunities to implement the System Guard Navy.
Totally :D

That was one of my goals, to have system flotillas warring :mrgreen:

You might want to check the doc in the oxz, in particular the roadmap, which is admittedly dense, but exposes what I want to do with this pack.

And the most I work with other oxps, the less I have to do :mrgreen:

Re: [WIP] Diplomacy OXP

Posted: Tue Nov 13, 2018 2:54 pm
by montana05
Day wrote: Tue Nov 13, 2018 1:54 pm
Totally :D

That was one of my goals, to have system flotillas warring :mrgreen:

You might want to check the doc in the oxz, in particular the roadmap, which is admittedly dense, but exposes what I want to do with this pack.

And the most I work with other oxps, the less I have to do :mrgreen:
I will have another look at your documentation and code again, last time is a while ago :oops: Currently I already have external dependencies for Feudal, Communists and Dictators so it could be interesting to pass them over to your OXP ;)

Re: [WIP] Diplomacy OXP

Posted: Tue Nov 13, 2018 3:27 pm
by Day
The oxz is available again into the game package manager.
It's currently the same as the 0.11 version from july 2017.

It's now hosted on sourceforge, so hopefully it won't stop again to be available because of my own servers.
montana05 wrote: Tue Nov 13, 2018 2:54 pm
I will have another look at your documentation and code again, last time is a while ago :oops: Currently I already have external dependencies for Feudal, Communists and Dictators so it could be interesting to pass them over to your OXP ;)
Well yes, I took a 1.5 year Oolite pause to advance IRL projects. I don't regret it, but I would regret not finishing this oxp :-/

Can't say I see how this oxp could depend on Feudal, Communists and Dictators. Yet I'm sure these oxp could, depending on Diplomacy, declare wars to neighbouring systems.
I guess the work would be yours :mrgreen: ->[]