glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [glob2-devel] Beta 4 Bug Fix


From: Kieran P
Subject: Re: [glob2-devel] Beta 4 Bug Fix
Date: Mon, 29 Dec 2008 18:33:08 +1300

Hey Bradley,

Awesome that there is still progress on this, but after applying the changes you mentioned, and trying to compile, I get:

g++ -o src/NetEngine.o -c -g -DHAVE_CONFIG_H -D_GNU_SOURCE=1 -D_THREAD_SAFE -I/sw/include -Ilibgag/include -I. -I/sw/include/SDL src/NetEngine.cpp
src/NetEngine.cpp: In member function 'void NetEngine::clearTopOrders()':
src/NetEngine.cpp:95: error: expected initializer before '->' token
src/NetEngine.cpp: In member function 'void NetEngine::pushOrder(boost::shared_ptr<Order>, int, bool)':
src/NetEngine.cpp:112: error: 'class std::vector<boost::shared_ptr<Order>, std::allocator<boost::shared_ptr<Order> > >' has no member named 'push'
scons: *** [src/NetEngine.o] Error 1
scons: building terminated because of errors.



Perhaps I applied it wrongly? Diff at http://pastie.org/348145

I noticed at the end of line 9 in the pastie that it was a comma. I tried a semi colon there, but same problem.

Regards
Kieran


On Mon, Dec 29, 2008 at 2:31 PM, Bradley Arsenault <address@hidden> wrote:
I figured out the bug in Beta 4. Unfortunately, just as I was sending the email and committing the patch, the power went off in my house. The desktop where my globulation 2 work is on no longer worked. So I'm on the laptop sending this email.

I figured out that the bug was due to the step-push up. The networking system queues up messages in queues as they are arriving across the network. The front of the queues represent the messages to be executed at each frame and are sychronized across the network. However the back of queues, since messages are arriving at different times, aren't sychronized at all, but the order of the messages is still maintained and sychronized across the network. What was happening is that the network push-up code was pushing a message to the end of the queues. Because the ends of the queues are desychronized across network systems, adding one more message will corrupt the order of the ends of the queues, which must stay schronized across across the network. Because the ends of the queues are in the wrong order and desychronized, eventually after executing several frames the front of the queue, which also must be sychronized, will become desychronized.

The flaw in the desync detection function failed to detect this specific desychronization properly, so the desycnronization detection itself is desychronized across the network systems.

The solution is for the network push-up function to push to the front of the queue rather then back of the queue. Because the front of the queue stays sychronized normally, adding an order would stay sychronized across the network, so nothing bocomes out of order and desychronized across the systems computers.

The fix is to change a push_back to a push_front.

Line src/NetEngine.h:90 revision 8a1d2e4e3e63

std::vector<std::vector<boost::shared_ptr<Order> > > orders;

Starting at line src/NetEngine.cpp:90:

for(int i=0; i<diff; ++i)
{
for(int p=0; p<orders.size(); ++p)
{
                 boost::shared_ptr<Order> order = boost::shared_ptr<Order>(new NullOrder),
order->sender=p;
orders[p].insert(orders[p].begin(), order);

}
}
Line 119 in the original file, which was
         
orders[playerNumber].push(norder)
will become
          orders[playerNumber].push_back(norder);

Line 128 which was
         return orders[playerNumber].front()
will become
         return *orders[playerNumber].begin()

Line 100 in the original file which was
        orders[p].pop();
will become
        orders[p].erase(orders[p].begin());



And I am pretty sure that is all of the changes. What I have done here is first, i had to convert the type of the order queues from std::queue to std::vector because we needed to be able to push to the front of the queue, and std::queue did not allow that semantic. The second thing i needed to to do was change the latency push up function to push to the front of the queue manually, rather then using the NetEngine::pushOrder function.

What i wrote here isn't formatted correctly and i'm not sure its not bug free, like i missed a line that needs change in the conversions.

The result: bug solved. Try it out! Do not work from the patched debug place, i'm 99% sure this will fix the bug.

--
Extra cheese comes at a cost. Bradley Arsenault.

_______________________________________________
glob2-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/glob2-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]