Esempio n. 1
0
        public void ServerAdvance()
        {
            for (int d = 0; d < NentDatas.Length; d++)
            {
                ReArrayIdPool <SnapHistory <TSnap, TStatic> > data = NentDatas[d];
                for (int i = 0; i < data.Count; i++)
                {
                    SnapHistory <TSnap, TStatic> h = data.Values[i];

                    if (h.PrevFlag != SnapHistory <TSnap, TStatic> .FlagGold)
                    {
                        continue; // if the prevflag is not gold,
                    }
                    // the entity does not exist at this timestamp
                    // so we don't bother simulating it yet

                    // now we advance the snapshot forward to the current point in
                    // time, and then save it
                    h.Shots[h.CurrentIndex] = h.Shots[h.PrevIndex];
                    Advancer.AdvanceLogic(AdvancerConfig, h, ref h.Shots[h.CurrentIndex], NetSnapper.TickMSTarget);

                    Nents.ServerSaveSimIntoCurrent(h);
                }
            }
        }
Esempio n. 2
0
        public void ServerAdvance()
        {
            for (int d = 0; d < NentDatas.Length; d++)
            {
                ReArrayIdPool<SnapHistory<TSnap, TStatic>> data = NentDatas[d];
                for (int i = 0; i < data.Count; i++)
                {
                    SnapHistory<TSnap, TStatic> h = data.Values[i];

                    if (h.PrevFlag != SnapHistory<TSnap, TStatic>.FlagGold)
                        continue; // if the prevflag is not gold,
                                  // the entity does not exist at this timestamp
                                  // so we don't bother simulating it yet

                    // now we advance the snapshot forward to the current point in
                    // time, and then save it
                    byte ownerPid = Advancer.GetInputPlayer(h.Shots[h.CurrentIndex], h.StaticData);
                    if (ownerPid != 0)
                    {
                        // if we have no inputs, do regular advancement
                        h.Shots[h.CurrentIndex] = h.Shots[h.PrevIndex];
                        if (!InputChecker(h, ref h.Shots[h.CurrentIndex], ownerPid, NetSnapper.TickMSTarget))
                        {
                            Advancer.AdvanceLogic(AdvancerConfig, h, ref h.Shots[h.CurrentIndex], NetSnapper.TickMSTarget);
                        }
                    }
                    else
                    {
                        // if this were client, we'd check the flag of the next.
                        // as it is, just create the next from the current
                        h.Shots[h.CurrentIndex] = h.Shots[h.PrevIndex];
                        Advancer.AdvanceLogic(AdvancerConfig, h, ref h.Shots[h.CurrentIndex], NetSnapper.TickMSTarget);
                    }

                    Nents.ServerSaveSimIntoCurrent(h);
                }
            }
        }