Discuss, please: Delayed GoTo and Real Turn-Based Game

Various topics about the game, the website, or anything else Freeciv related that doesn't fit elsewhere.
User avatar
Corbeau
Elite
Posts: 1052
Joined: Mon Jan 13, 2014 11:13 pm

Discuss, please: Delayed GoTo and Real Turn-Based Game

Postby Corbeau » Sun Sep 08, 2019 11:48 am

There has been a discussion ongoing for years about how to reduce the real-time strategy effect when playing Freeciv in multiplayer. I believe there is a consensus that the feature which would enable this is making it possible to make your orders about moving units and then ALL units move at Turn Change. In other words, there is no movement during turn, all of it happens at its end, automatically and simultaneously. if you played Master of Orion, then that is basically how it should work.

Naturally, this is a technical problem because Civ games have been designed around a completely different mechanic so a non-basic amount of (re)coding would be necessary. Naturally, not being a programmer and relying on someone else to do the job, the whole thing seems easy to me so I better refrain from technical part of the discussion (at least for now). I'd just like to outline the basics, and someone with more expertise will hopefully straighten me out: most of the problem is applying "delayed GoTo": creating the mechanic to set the target for a unit to move somewhere and then making it move not immediately, but at TC.

The next problem - which would probably be technically easier, but may cause a lot of disagreement around the community - would be how to handle conflicts: which units should move first and what happens when units meet, that is, arrive at the same spot at the same time.

But there is another thing that may become a problem here and it should be dealt with before any technical details are worked on: apparently some players are not fans of the idea in itself because of how it would affect gameplay: games (especially Longturn) would become "too slow" and, I assume, this would make them "less attractive".

My reply to this is that the military part of the game would become different and that players would definitely have to develop new behaviour and new tactics (NOT strategies) to get on top. The military aspect of the game would definitely become different, but the thing is, it would still be the same game.

However, I discussed this with a small number of people so I'd like to take this to the community. How do people here generally feel about this idea?

I would love to set up a poll here, but neither this forum nor the Lnogturn forum don't allow it, so instead, I'm setting a provisional poll on the Longturn Discord server:

https://discord.gg/xxDAmnq

If you have an opinion and/or a preference, please share it.
Last edited by Corbeau on Sun Sep 08, 2019 10:20 pm, edited 1 time in total.

Ignatus
Hardened
Posts: 241
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Discuss, please: Delayed GoTo and Real Turn-Based Game

Postby Ignatus » Sun Sep 08, 2019 1:22 pm

There are too many things we do betqeen moving units. E.g. I have an army ready to attack a city. First I send an explorer, if the city has built walls, I wait for reinforcements or go to attack something else. If it has no walls, I send a catapult and count how many units are inside (the counter is not logged now, you note) and how well can I damage them. Then I continue sending catapults until the health of the defenders falls low enough. If I have run away of bombarders but the enemy is still fresh, I protect the catapults and retreat; otherwise, I attack with melee units and still keep an eye on the battle.

Do you expect I'll write some script (or issue orders in some visual manner) that will do all the things? It will take three evenings, and it will work still bad.

We can play by renting pre-coded AI generals and give them generalized goals, I think this idea is not 100% worthless, but the game has a big chance to mostly turn from Freeciv into Godville.

Well, if the city owner appears on the server and notices the attack, he or she can make an unexpected RTS episode but so can do I to them another time. Maybe some players don't like it but I don't think it's a fatal fault.

Lachu
Elite
Posts: 392
Joined: Sat May 04, 2013 2:19 pm

Re: Discuss, please: Delayed GoTo and Real Turn-Based Game

Postby Lachu » Sun Sep 08, 2019 2:00 pm

Corbeau wrote:There has been a discussion ongoing for years about how to reduce the real-time strategy effect when playing Freeciv in multiplayer. I believe there is a consensus that the feature which would enable this is making it possible to make your orders about moving units and then ALL units move at Turn Change. In other words, there is no movement during turn, all of it happens at its end, automatically and simultaneously. if you played Master of Orion, then that is basically how it should work.

Naturally, this is a technical problem because Civ games have been designed around a completely different mechanic so a non-basic amount of (re)coding would be necessary. Naturally, not being a programmer and relying on someone else to do the job, the whole thing seems easy to me so I better refrain from technical part of the discussion (at least for now). I'd just like to outline the basics, and someone with more expertise will hopefully straighten me out: most of the problem is applying "delayed GoTo": creating the mechanic to set the target for a unit to move somewhere and then making it move not immediately, but at TC.

The next problem - which would probably be technically easier, but may cause a lot of disagreement around the community - would be how to handle conflicts: which units should move first and what happens when units meet, that is, arrive at the same spot at the same time.

But there is another thing that may become a problem here and it should be dealt with before any technical details are worked on: apparently some players are not fans of the idea in tisekf because of how it would affect gameplay: games (especially Longturn) would become "too slow" and, I assume, this would make them "less attractive".

My reply to this is that the military part of the game would become different and that players would definitely have to develop new behaviour and new tactics (NOT strategies) to get on top. The military aspect of the game would definitely become different, but the thing is, it would still be the same game.

However, I discussed this with a small number of people so I'd like to take this to the community. How do people here generally feel about this idea?

I would love to set up a poll here, but neither this forum nor the Lnogturn forum don't allow it, so instead, I'm setting a provisional poll on the Longturn Discord server:

https://discord.gg/xxDAmnq

If you have an opinion and/or a preference, please share it.

I have similar idea and partially implemented it in progress. You could open thread about progress in this subforum. I never played master of orion and never played Frozen Synapse (I bought license, but never had a time), but the idea was inspired by Frozen Synapse. I think:
1. You could use move point as weight of moving order, so when unit move, you decrease move points and test another unit have more move point. In this case, when we have two horseman, we move first and in next step we move next
2. Add a new unit field, managing order of moving

In my opinion, when units standing on the same tile, there's some percent of chance to stop moving of both. In progress units of two different players can be placed on the same tile.

User avatar
Caedo
Elite
Posts: 476
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Re: Discuss, please: Delayed GoTo and Real Turn-Based Game

Postby Caedo » Sun Sep 08, 2019 3:10 pm

I don't really think this is workable for a game like Freeciv. Let's take a closer look.

Problem A, regarding the order things happen in at the TC: This is already a problem. Firstly, when there are effects with "Player"- or "World"-range requirements, the order in which a player's cities get ticked (and the order in which players are ticked) might make a difference. This could, however, be fixed by first checking all requirements and tallying up all resource gain, then applying changes. Secondly, and more importantly, however, this matters when multiple players build the same Great Wonder and finish it at the same time. I honestly have no idea how the game decides who gets it. Thirdly, and more relevant to the issue at hand, there's goto orders. At the beginning of a turn, all units with goto orders move; again, I don't know how the game decides on the order. This is essentially the baby sibling of what we're talking about here.

The thing is, for some of these things, there is no sensible way to handle them when players have their turns concurrently. For players in the exact same situation (such as at the very beginning of the game), I don't see how to decide this in a fair way that isn't random and doesn't again encourage the exact behavior we want to avoid. Doing it randomly will end up screwing people over for literally no reason but pure chance, and doing it based on who gave the order first will, once again, lead to a scramble at TC to do your moves as quickly as possible.
The only way I see to solve this would be by explicitly making "things can happen simultaneously" part of the game (for phasemode 'ALL' games at least), including units attacking each other (rather than having a designated attacker and defender), the same wonder existing in two places at the same time (with a weaker effect maybe?), and similar complications that, while maybe making the game more realistic, don't necessarily make it more fun for everyone.

Problem B, regarding conflicting actions: Even when we've decided on the order of actions, and how to handle simultaneity, there's the problem of earlier actions invalidating later ones. Currently, this is only the issue for goto – ZOC, enemies outright blocking the path, terrain changes etc. are all handled by the unit dropping everything and asking for input – which is fine, I guess (so long as the enemy doesn't respond to the unit now standing around like a bloody idiot), since gotos are executed at the beginning of the turn, giving the player the chance to use the remaining movement. If all moves are supposed to happen at once though, this is completely unworkable.

The only way I see to fix that is, as Ignatus said, to either let AI handle it – which is not necessarily bad, you're telling your troops the general plan, they execute the details – in which case the AI would probably need some serious maintenance; or to let players give their troops detailed orders (i.e. write code in some scripting language), which severely unlevels the playing field between the people that can strategize, and the ones that can put that strategy into code.

TL;DR: Basically, this would be a lot of changes that are only really relevant in phasemode 'ALL', to the point where I think it would be more sensible to make that a separate gamemode.

Alternative approach – and I'm just spitballing here: a phasemode where different players have their TC at different times.
~S.C. L.

Wahazar
Hardened
Posts: 275
Joined: Mon Jul 02, 2018 1:49 pm

Re: Discuss, please: Delayed GoTo and Real Turn-Based Game

Postby Wahazar » Sun Sep 08, 2019 7:23 pm

Thank you for initiation of such important topic, which was groving in my mind since I returned to back freeciv multiplayer games.
While singleplayer is turn based game, multiplayer have elements of RTS and makes turn change timing important.
It is not a huge issue in case of short-turn game, but is ruining immersion of longturn games. Longturn style of playing was discovered to allow player causally join whenever he want, and result should not be correlated to connection time.

My proposals are as follows:
    • all* units movements are pre-programmed on client side and executed by server with following rule:
    • on each turn, random queue of player/alliances is generated
    • pre-programmed movements are executed at TC for each player/alliance place in line, using movement sequences recorded by the server
    • in case of interactive movements (for example diplomat), if target is visible for client before TC, interactive menu appears, but chosen action is performed at TC (in case of investigating city, result should be displayed on the permanent tab after connection, similar to diplomatic prompts)
  • diplomatic agreements can be debated on-line, but will be executed, if mutually agreed, at the TC
  • all town-related stuff can be executed on-line
*) one exception for units within 1 tile from the city, which can perform on-line movement: to make favor for the defenders and also allow to tide up things, for example check martial law, upgrade units etc.


Once unit is pre-programmed to be moved, information is sent to the server and 'ghost' icon of displaced unit appear on client side of the owner and other players with shared vision. Henceforth player or his ally can perform other pre-movements, which are (theoretically) related to previous movement - load, unload, use control zones etc.
Pre-programmed movement can be cancelled before TC, if other movements doesn't rely on it (it is added value - no more misclicks).

Currently there are following movement types: keyboard controlled movement, goto movement, auto-patrol and auto-explore.
    Each type of movement should provide different behavior in case of spotting enemy unit:
  • keyboard controlled movement - always attack, if it is possible
  • goto movement - stop movement, if attack chance is less than defined by client (by default 50%), otherwise attack
  • auto-patrol - reverse direction of patrol path and sent message about spotted unit
  • auto-explore - stop movement or continue mission if possible

Lets consider following examples:
playerA is pre-moving his cavalry unit into unknown land. Enemy playerB also give orders to his unit to enter same tile.
Each player see his virtual ghost unit moved, but terrain and enemy units are not revealed to them until TC.
On the TC, server executes orders from randomized player queue, maybe playerA will be first on the new position (if revealed terrain allow this), maybe player B. If playerA is using arrow keys as orders, his cavalry will attack any enemy unit or city which appear on revealed land.
Next example:
player want to push cavalry into enemy territory, but doesn't know if there
player1 is pre-moving boat with allied player2 infantry unit on board, so (assuming they have shared vision) both player1 and player2 see new positions of real or virtual units, but he can move only unit from virtual position.
If he want to unload his infantry instead of continuing ride, he need to move his unit before boat movement (or ask player1 to cancel boat movement).


Of course, such approach would make game different than usual, for example you cant go forward, look what is here and retreat - but lets consider real world - you give orders to the unit, and (except of modern warfare with on-line cameras and satellite tracking) don't see instantaneously results of such order - there is fog of war, delayed reporting etc.
Augmented2 ruleset/modpack for freeciv2.6: viewtopic.php?f=11&t=91047

Ignatus
Hardened
Posts: 241
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Discuss, please: Delayed GoTo and Real Turn-Based Game

Postby Ignatus » Sun Sep 08, 2019 8:55 pm

Wahazar wrote:Of course, such approach would make game different than usual, for example you cant go forward, look what is here and retreat - but lets consider real world - you give orders to the unit, and (except of modern warfare with on-line cameras and satellite tracking) don't see instantaneously results of such order - there is fog of war, delayed reporting etc.

I don't think Freeciv is any a game with real fog of war. It has some similarity to real war strategy but not in the point of having incomplete control and knowledge of whatever any part of your civilization currently sees and controls.
Wahazar wrote:
My proposals are as follows:
  • all* units movements are pre-programmed on client side and executed by server with following rule:
    on each turn, random queue of player/alliances is generated
  • pre-programmed movements are executed at TC for each player/alliance place in line, using movement sequences recorded by the server
  • in case of interactive movements (for example diplomat), if target is visible for client before TC, interactive menu appears, but chosen action is performed at TC (in case of investigating city, result should be displayed on the permanent tab after connection, similar to diplomatic prompts)
  • diplomatic agreements can be debated on-line, but will be executed, if mutually agreed, at the TC
  • all town-related stuff can be executed on-line

Well, I don't like the idea of player/alliance outer shuffle (which AFAIK is active even now for goto orders) since being always behind your enemy can sometimes give a sudden great advantage. Better to take the alliance queues and combine them into a super-queue with random switching between sub-queues but the same order within them; this could be done even for single moves though requires a bit more resources. This does not remove the problem of that units are STUPID and don't understand what to do and what to stop doing if the situation has changed even in their own sight area. Maybe we can develop rules that we would eventually get accustomed to, but this will be very another game.

In fact, I thought about AI generals as a potential cure for using well-playing bots as well as players that win by just investing much time into the game: players will be limited in the number of any management actions per turn, after their empire grows a bit, they will rely on AI agents in tactical tasks and win by seeing the strategical picture that common-affordable bots mostly fail. Also, the server already supports detailed (though mostly non-interactive from the unit to the environment) tasks like "irrigate, go 10 tiles north and 5 morth-west, wait full mp, go 3 tiles north, mine, road"; I am coding some tools to issue such orders from a client, at least from Lua console.
Caedo wrote:Alternative approach – and I'm just spitballing here: a phasemode where different players have their TC at different times.

Sorry, don't get the idea.

User avatar
Corbeau
Elite
Posts: 1052
Joined: Mon Jan 13, 2014 11:13 pm

Re: Discuss, please: Delayed GoTo and Real Turn-Based Game

Postby Corbeau » Sun Sep 08, 2019 8:58 pm

Actually, the point of this thread was not so much (if at all) to discuss the technicalities of how this would be achieved, but primarily to check if people really want that kind of gameplay at all.

In other words, there are two separate questions:
1. Do you think if such a mechanic would be interesting at all and if it would make the game better
2. How it would be implemented

Most negative answers to the fist question are explained by technical difficulties when discussing the second. And of course, they are not completely independent, but a perfectly decent and valid answer would be "Maybe it is a good idea, but it is very difficult or even impossible to implement it".

I actually have a feeling that people have simply gotten used to the semi-RTS they are playing - or that they actually prefer it to the Pure Turn Based. Because RTS is more dynamic, less boring, faster etc. And it is a perfectly valid attitude. This is the main reason why I set up this poll anyway.

As ofr how it could be implemented, the possibilities are endless. Maybe simply remove the possibility to move units normally and base everything on GoTo movement with a few tweaks:

1. When TC happens, move units as ordered
2. Set all units' status to "moved"/"all MP spent" so that they can't be moved anymore

As for what happens when units meet, the possibilities are endless. For example, one idea is that movement priority is based on:
- type of unit (defensive/offensive/tech level)
- how many MPs were used up the previous turn
- ordered priority (a unit can be ordered to move at its pace or to slow down if you want to assess the situation first)

But, anyway, changing paradigms is always difficult, especially in small communities ;)

However, I do agree that moving units in random order would be bad because way, way too much would depend on luck.

Or, who knows, maybe players would adjust their strategies? Some testing could yield surprises. Or not.

Wahazar
Hardened
Posts: 275
Joined: Mon Jul 02, 2018 1:49 pm

Re: Discuss, please: Delayed GoTo and Real Turn-Based Game

Postby Wahazar » Sun Sep 08, 2019 11:16 pm

Ignatus wrote:I don't think Freeciv is any a game with real fog of war. It has some similarity to real war strategy but not in the point of having incomplete control and knowledge of whatever any part of your civilization currently sees and controls.
Such statement is valid in case of singleplayer, where all is deterministic, but in case of multiplayer your movement plan can be spoiled by parallel movement of your opponent.
BTW, shuffling players order of movement would be also welcome in case of singleplayer - it is boring, that whenever I run into enemy with no spare movements, I always can set goto to safe position and it will be executed first.


Well, I don't like the idea of player/alliance outer shuffle (which AFAIK is active even now for goto orders) since being always behind your enemy can sometimes give a sudden great advantage. Better to take the alliance queues and combine them into a super-queue with random switching between sub-queues but the same order within them
Not sure what is a difference between above mentioned methods?
Let me clarify my idea:
server is executing all orders from one player/alliance (from oldest to newest), from another player/alliance etc,
where player/alliance order is randomly chosen during each turn.
Augmented2 ruleset/modpack for freeciv2.6: viewtopic.php?f=11&t=91047

User avatar
Caedo
Elite
Posts: 476
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Re: Discuss, please: Delayed GoTo and Real Turn-Based Game

Postby Caedo » Mon Sep 09, 2019 9:03 am

Ignatus wrote:
Caedo wrote:Alternative approach – and I'm just spitballing here: a phasemode where different players have their TC at different times.

Sorry, don't get the idea.

How do I explain this... time zones. Imagine different players are in different time zones, and turn change always happens at midnight. There would still be one "canonical" refernce point (cf. UTC or GMT), but different players get their turn change at different times relative to this reference point.
Now we implement the whole idea of giving orders first, and then executing them at turn change, with the difference that we don't have to worry about the order different players' units go in, since different players' turn changes aren't at the same time. This would also solve the problem of simultaneous Great Wonder completion.
Note that we'd need some solution for when global turn change events (e.g. global warming and Historian Publishes) happen.

I don't think this would really be useful for games with only a few players, since everyone's actions would depend on the other players' actions, so it would drastically reduce the window of time to react to enemies' movements compared to the fully-simultaneous option; it'd basically be alternating turns, so not really all that useful.
However, for the web/MMO games with hundreds of players, it would drastically spread out the amount of work the server has to do, since there's now one small turn change every few minutes, instead of a huge one every day. Also, most of those turn changes wouldn't affect you, since it's for faraway players. It does mean that, the bigger your empire is (and the more players you have contact with), the more often you'll have to check the game, but then again, that's how it is right now as well.

Corbeau wrote:Actually, the point of this thread was not so much (if at all) to discuss the technicalities of how this would be achieved, but primarily to check if people really want that kind of gameplay at all.

I can't really comment much on this, since I haven't been an active player in any game for a long time, but like I said before, with all the changes needed to do this, it might as well be a different game, so I dunno. I imagine the people that want to play Freeciv, mostly the way it is, wouldn't want the new version to be the only option.

Wahazar wrote:
Ignatus wrote:BTW, shuffling players order of movement would be also welcome in case of singleplayer - it is boring, that whenever I run into enemy with no spare movements, I always can set goto to safe position and it will be executed first.

Have you tried changing the 'phasemode' setting to 'PLAYER' or 'TEAM'? That's how the game was originally, with each player having their own turn, and only after they're finished, the next player has their turn. It doesn't work well for multiplayer, since every player has to wait for all other players to finish their turns, but phasemode 'ALL' doesn't work that well with AI, since all AI players make their moves at the beginning of the turn.
~S.C. L.

Lachu
Elite
Posts: 392
Joined: Sat May 04, 2013 2:19 pm

Re: Discuss, please: Delayed GoTo and Real Turn-Based Game

Postby Lachu » Mon Sep 09, 2019 11:59 am

I think this idea is good, even for single player game, because it make a game more fairly. Why? Because you cannot send explorer to remove fog of war and move your drops. Explorers and military units will move at the same moment. There's no effect of who will built wonder first question, because player turn is ordered in random way.

What about solutions of problems?
I think, that after reaches an enemy unit, both units should cancel move and try to defend themselves, but I think there's opportunity to allow player to choose unit behavior, like scout, ride, explore (fly when find enemy unit), protect another unit, etc.
I don't think programming unit on client side is good solution. If you try to enforce adding programming possibility, you should add this lua-based scripts to ruleset and teach AI how to use these programs. I don't think it's currently available to create simple programming language, so even "monkey" could understood it, is it? If it's, then we could allow to program units by graphical symbols or like in blender game engine. First suggestion: don't use if then else, but if then else don't known statement (similar to way of Freeciv handle requirements).