Ghost Units

Discussion in 'Modding' started by Ftoomsh, Sep 20, 2018.

  1. Ftoomsh

    Ftoomsh Well-Known Member

    Does anyone know why the ghost units problem occurs and what, if anything, could be done at the modding level to correct this problem?

    First, I have to define the term "ghost units". Ghost units are units which keep marching forward into or through a battle or situation when they actually died earlier. There are a number of giveaway signs which taken together show they are ghost units:

    (a) The client sees them marching through a battle situation whereas the host does not see them.
    (b) They do not fight in the normal way.
    (c) They march past all possible opponents without fighting.
    (d) They fire at seemingly invisible targets.
    (e) They stand and "wait to die".
    (f) They eventually die for seemingly no direct reason.

    I see ghost units in big battles (populations of 6,000 to 12,000 per player in 1v1. This no doubt has something to do with me playing as client and having slow internet. But why does the game engine permit the client's sprites to get out of synch like this and then correct it later after death of the units? What might be the causes of this problem?
  2. Original-Cossacks-Player

    Original-Cossacks-Player Active Member

    The code just needs to be optimized. I remember having a discussion with Mat Pritchard who was the lead programmer for the Age of Empires 2 game, when the bulk of coding on the engine was complete he spent considerable time optimizing the game code, this can take a lot of time, but is well worth the effort, time is money and because Age Of Empires 2 was published by Microsoft and had a decent sized team working on it at Ensemble Studios they could spend the time optimizing code, GSC are only a small team and would struggle to have the resources doing this.
    Consider how far Cossacks 3 has come since its release, if you were one of the first to buy the game you know what I am talking about with the various bugs and performance issues, a lot of that has been fixed, yes there are still some present which hopefully GSC can put some work into.
  3. Ftoomsh

    Ftoomsh Well-Known Member

    I was one of the first to buy C3. I do remember the early days and all the bugs. One of the bugs even early on was "ghost units". They happened earlier in the game even with lower unit counts. There seemed to be some improvement until early this year. Then a release seemed to bring back the problem with a vengeance. Also, the game was never able to drive the high unit numbers originally promised. Go to the Cossacks 3 website and you will see the first claim is still there:

    "Cossacks 3
    Game features:
    • Grandiose battles of up to 32,000 soldiers on the battlefield."

    Well, it was never able to drive those sort of numbers. Instead, if you push the game above about 8,000 units (soldiers and peasants) for all players combined you get slowdowns, ghost soldiers and disconnects... and different behaviors on host and client screens.

    There is a lack of optimization but there is also a lack of proper synchronization. Optimization or lack thereof is probably buried in the engine. There are possibly aspects of synchronization which can be enhanced by modding. I'm just wondering if any modders have looked at this and know of anything that can be done from the modding end?
  4. Original-Cossacks-Player

    Original-Cossacks-Player Active Member

    It's also how the game is handled by host/client, for example the host needs a quick PC and internet to host without lag, games like Battlefield 1 use a central server to actually host games, the games multiplayer data is handled by a server not by a "host" that relies on a good internet connection, the server itself is where all the data is sent/received, the Cossacks 3 server only acts as the intermediate to arrange the setup of the game.
    Daddio likes this.
  5. Ftoomsh

    Ftoomsh Well-Known Member

    I've found comments which indicate TODO action items for correct client synching. At least that's what I think they are.

    // TODO : FAUST : move to write/readmove states to work on client side

    There's one in the player script and one in the unit.script.

    Of course, I don't know if these actions were done or not done, done well or not done well. But it does indicate issues existed with states (state machine states I guess) not working on the client side. Also, it's true some people can have poor computers (host and/or client) and data can be slow or lost over the internet. It's a matter of the protocols for handling slow processing and slow and lost data.

    I suspect, but don't know, that lost data means the state machine on one PC is now in a different state than on the other. On the next "pass" of synchronisation, if that is the right way to put it, the host might no longer show a unit (it's dead) but the client will still show that unit alive and walking. The state machines need to be resynched (I guess) so some form of error processing exists to catch and remove the discrepancies. This error processing does not seem to be working well enough or fast enough.

    These are all guesses on my part. I admit I am not knowledgeable about this.

    I do wonder if the developers test the game under conditions of bad lag and lost data. It's kind of like stress-testing the game under real and potentially poor internet conditions. When a game is sold all over the world for multiplayer use and only minimum PC requirements are specified, then the game needs to perform in a wide array of global internet conditions, IMHO.
    Loner likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice