MegaGlest Forum

Archives (read only) => Glest Advanced Engine => General discussion => Topic started by: loveheaven on 11 January 2009, 19:28:21

Title: Can Glest support there players: one human, one cpu, one network?
Post by: loveheaven on 11 January 2009, 19:28:21
Can Glest support such there players like this way: one human, one cpu, one network at the same time?
Why don't AI commands call the function pushNetworkCommand? How will the clients sync with the server to know what AI are doing if AI commands don't call the function pushNetworkCommand?

Belowing is the current code:

void Ai::returnBase(int unitIndex){
    Vec2i pos;
    CommandResult r;
    int fi;

    fi= aiInterface->getFactionIndex();
    pos= Vec2i(
      random.randRange(-villageRadius, villageRadius), random.randRange(-villageRadius, villageRadius)) +
      getRandomHomePosition();
    r= aiInterface->giveCommand(unitIndex, ccMove, pos); // why don't call the function pushNetworkCommand?
    //aiInterface->printLog(1, "Order return to base pos:" + intToStr(pos.x)+", "+intToStr(pos.y)+": "+rrToStr(r)+"\n");
}
Title: Re: Can Glest support there players: one human, one cpu, one network?
Post by: titi on 11 January 2009, 19:35:09
Server and client are playing the same game, so the ai on server and client behaves the same way.
If server and client are in sync, there is no need to publish AI commands, because they are generated by client for itself!
And the decisions on every client will be the same.
Title: Re: Can Glest support there players: one human, one cpu, one network?
Post by: loveheaven on 11 January 2009, 20:37:54
Server and client are playing the same game, so the ai on server and client behaves the same way.
If server and client are in sync, there is no need to publish AI commands, because they are generated by client for itself!
And the decisions on every client will be the same.
oh! yes, it is. you are right! Thank you very much. I know it!
I saw the thing megapack_v3 you made. It's wonderful. Would you please post an example to tell us how to use blender to make a 3d model?
Title: Re: Can Glest support there players: one human, one cpu, one network?
Post by: titi on 12 January 2009, 10:23:06
Blender is not so easy to learn.
Look here:
https://forum.megaglest.org/index.php?topic=4074.0
Title: Re: Can Glest support there players: one human, one cpu, one network?
Post by: loveheaven on 12 January 2009, 13:14:40
Thank you very much! You are very nice.
Title: Re: Can Glest support there players: one human, one cpu, one network?
Post by: daniel.santos on 12 January 2009, 20:33:27
loveheaven, have a look at the class Shared::Util::Random.  This is a psudo-random number generator that creates the same set of random numbers each time, when seeded with the same value.  This is the mechanism that Glest uses to try to keep client & server AI (as well as other randomness) in sync.  There are flaws with the approach, but they apparently don't surface much on low latency networks and when both machines are able to run at 40 world updates per second.  But once something gets out of sync in one place, it can potentially trigger a chain reaction of synchronization issues -- something I attempt to address in GAE, but as I mentioned in another thread, GAE has yet to accomplish stable network play.