Create sitrep message when receiving diplomatic offer

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Create sitrep message when receiving diplomatic offer

#1 Post by The Silent One »

I'm trying to implement a sitrep message that shows up if a player receives a diplomatic offer, e. g. a peace treaty. The message should look like "%empire% is offering a peace treaty." or "%empire% is proposing an alliance." etc..
I'm pretty clueless about the FOCS part. What would be the scope, the clients empire? Put it in customsitreps.txt?
Also, I will probably need to implement an activation condition, maybe something like HasDiplomaticOffer type = DIPLO_PEACE?

If anyone with insight would give a me some clues, that'd be great.

Code: Select all

EffectsGroup
    // scope = ???
    activation = ReceivedDiploMessage type = DIPLO_PEACE
    priority = [[END_CLEANUP_PRIORITY]]
    effects =
        GenerateSitRepMessage
            message = "SITREP_DIPLO_PEACE"
            label = "SITREP_DIPLO_PEACE_LABEL"
            icon = "icons/peace.png"
            parameters = [
                tag = "empire"  data = // Target.ID  ???
            ]
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Create sitrep message when receiving diplomatic offer

#2 Post by Geoff the Medio »

An issue with this is that diplomacy is (at least presently) not synchronized with turn cycling. So, a player can send a diplomatic message at any time, and could react to any receive messages at any time, with or without a server turn cycle happening between any of the steps...

So how / when exactly do you want / expect notifications to appear?

o01eg
Programmer
Posts: 1998
Joined: Sat Dec 10, 2011 5:46 am

Re: Create sitrep message when receiving diplomatic offer

#3 Post by o01eg »

Geoff the Medio wrote: Fri May 31, 2019 3:25 pm An issue with this is that diplomacy is (at least presently) not synchronized with turn cycling. So, a player can send a diplomatic message at any time, and could react to any receive messages at any time, with or without a server turn cycle happening between any of the steps...
What if make diplomacy actions into turn orders?
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-01-30.0dd6806.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Re: Create sitrep message when receiving diplomatic offer

#4 Post by The Silent One »

Geoff the Medio wrote: Fri May 31, 2019 3:25 pmSo how / when exactly do you want / expect notifications to appear?
I had imagined just a regular sitrep. Alternatively, the player list wnd icon (crown) could change into something else (mail icon) when a diplomatic offer is present, which should be easy enough to do.
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Create sitrep message when receiving diplomatic offer

#5 Post by Geoff the Medio »

o01eg wrote: Fri May 31, 2019 3:41 pmWhat if make diplomacy actions into turn orders?
Then there would be situations where players agree between eachother by chatting or external communication that they want to make peace, or some other diplomatic agreement on the current turn, but can't get the diplomacy system to consider them agreed until a turn later. For peace or ceasefire type agreement, this would result in their forces fighting battles anywhere their fleets/planets can see eachother on the next turn cycle, until an offer of ceasefire / peace sent by one on the current turn can be processed by the server during turn cycling and sent to the receipient to be responded to.

One might suggest that two players offering peace or ceasefire to eachother on the same turn should be considered as mutually accepting. But ceasefires agreements, and diplomatic messages in general, might have additional conditions that would need to be seen to be agreed to, so auto-accepting in all cases isn't possible. Accepting some agreements sent mutually, but not others, when sent on the same turn, would probably be confusing or problematic as well... eg. one can't know if an offer of ceasefire will possibly take effect on the current turn or on the next turn, so planning accordingly is difficult and understanding the mechanics is hindered.
The Silent One wrote: Fri May 31, 2019 5:45 pm...the player list wnd icon (crown) could change into something else (mail icon) when a diplomatic offer is present, which should be easy enough to do.
Should be reasonably easy to do. I think this has been suggested before, and there could be a github issue already.

Post Reply