Author Topic: Performance improvement for Glest multiplayer... 4 player is now practical  (Read 47203 times)

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Tom: I don't see the ESC problem you are talking about in my version of Glest (does anyone else see it?)

Titi: Is the network code working well? I suppose we'll need some testing for at least a couple days?

Silnarm / Titi: Thanks for the info about the slowdown and speed up, I did not know what they were there for.

P.S. I'm making good progress in building a CodeBlocks project to cross compile mega glest in ubuntu to produce a Win32 binary.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,228
    • View Profile
    • http://www.titusgames.de
1. No, I donn't know what Tom is talking about

2. Yes I think we should test a couple of days. The current state should be the next release( after testing of course ). So no new features yet, just focussing on making it stable.
 ( I didn't test yet, I'm still at work, but I its nearly weekend !)
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,228
    • View Profile
    • http://www.titusgames.de
Current linux binary with ( hopefully ) all libs. See included readme.txt too .
https://sourceforge.net/projects/megaglest/files/megaglest3.2.4-3-beta1_i386_linux_bin.tar.bz2

Please tell me if any libs are missing for you!
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,228
    • View Profile
    • http://www.titusgames.de
more crashs :(
( megaglest3.2.4-3-beta1 )

logs are here:
http://www.titusgames.de/crash_logs.tar.bz2

This was a 4 player game with 2 crashs....

client 3 was an online player
client 1 and 2 and server are from local LAN
What happened?

first crash:
Client 3 crashed shortly after the game starts ( but not a full crash, glest window disappears and ther was a glest.bin running in the process list )

second crash:
The other players played to the end. When the end was reached, one clients decided to quit, but the other one was still in the game ( with message "You lost" ). This crashed the client which was still in the game.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,228
    • View Profile
    • http://www.titusgames.de
verified the problems( first crash ) again:
Last words of a client ( which not complelty crashes but has no more window:
Code: [Select]
....
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 1402
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 1402
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 498
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 498
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] socket->getDataToRead() returned 498
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 1808
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 1808
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 1808
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 1808
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 904
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 904
In [shared_lib/sources/platform/posix/socket.cpp::send] sock = 18, bytesSent = 904
In [shared_lib/sources/platform/posix/socket.cpp::disconnectSocket] START closing socket = 18...
In [shared_lib/sources/platform/posix/socket.cpp::disconnectSocket] END closing socket = -1...
[shared_lib/sources/platform/posix/socket.cpp::isConnected] DISCONNECTED SOCKET error while peeking isconnected socket data, err = -1, errno = 104 [Connection reset by peer]
Exception: Disconnected
Game
World
Minimap
Tech tree
Tileset
Cells
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Ok, the logs helped and I see what the problem is, I'll look into the solution shortly.

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Hello, softcoder! I am very sorry, making a problem with video card driver!

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Greetings,

  I've been looking at the bandwidth usage and have modified ours to only send actual commands, it is currently sending 64 commands (at 14 bytes each) with every keyframe, obviously this is rather wasteful.

  I added some compiler directives to ensure correct packing, but these don't actually appear to be necessary, real world keyframe updates are 902 bytes, which is 6 bytes (for the message type, command count and frame number) + 64 * 14 == 902. So it appears to be packing them correctly anyway... still, I'd recommend adding them,

Code: [Select]
// in network_types.h
#pragma pack(push, 2)
class NetworkCommand {
// unchanged
};
#pragma pack(pop)

and,
Code: [Select]
// in network_message.h
#pragma pack(push, 1)
class NetworkMessageCommandList: public NetworkMessage{
// unchanged
};
#pragma pack(pop)

I didn't actually change the NetworkMessageCommandList struct's data at all, it can still hold 64 commands, but it only sends or receives as many as there are...

Code: [Select]
void NetworkMessageCommandList::send(Socket* socket) const {
assert(data.messageType == NetworkMessageType::COMMAND_LIST);
NetworkMessage::send(socket, &data, 6 + sizeof(NetworkCommand) * data.commandCount);
}

bool NetworkMessageCommandList::receive(Socket* socket) {
// read type, commandCount & frame num first.
if (!NetworkMessage::receive(socket, &data, 6)) {
return false;
}
// read data.commandCount commands.
if (data.commandCount) {
return NetworkMessage::receive(socket, &data.commands, sizeof(NetworkCommand) * data.commandCount);
}
return true;
}

The end result is of course a significant reduction in the typical size of a Command-list over the network (from 902 down to 6 bytes if no commands are sent, a not uncommon situation).

Ps: I ran a brief experiment with lowering the 'networkExtraLatency' ... It didn't go well ;)
Glest Advanced Engine - Code Monkey

Timeline | Downloads

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Updates at:

mega glest - http://soft-haus.com/glest/code/megaglest-source-3.2.4-4-beta1.7z
regular glest patch - http://soft-haus.com/glest/code/glest_patch_2010_jan_30.diff

This update (hopefully) fixes the disconnect issue found by Titi and also adds Silnarms contribution to cut down on network cholesterol :)

Thanks

P.S. Its time we got mega-glest in svn somewhere to make this a little easier.
« Last Edit: 30 January 2010, 19:52:32 by softcoder »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,228
    • View Profile
    • http://www.titusgames.de
its already in svn
http://sourceforge.net/projects/megaglest/

Do you want access?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Yes please I'd like to have access.

P.S. I made a new resource type (which will be included in the next update) called:

static_no_recoup_cost

It is EXACTLY like static except when a Unit dies that requires a static_no_recoup_cost resource as its cost, it WILL NOT recoup the cost of the resource as it does with static.

This allows my son to create fish and coin resources for his tech's and when the unit dies associated with the resource then it doesn't add the resource back.

Let me know if the new network changes work well now?

Thanks

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Hello, softcoder!

I hope this version can be very stable, thank you, please continue to work!

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,228
    • View Profile
    • http://www.titusgames.de
@softcoder:
I didn't test the new version yet ( no time ) but I will do!
For the new resource type: I didn't really get whats it good for, please describe it a bit more.
From what I understand now, its simply a ressource that is not consumed by a unit and if the unit dies its given back to the stock. Right?

You have got a new message about SVN access!

update:
Here is the current beta binary release for linux:
https://sourceforge.net/projects/megaglest/files/megaglest3.2.4-4-beta1_i386_linux_bin.tar.bz2/download
« Last Edit: 31 January 2010, 02:14:41 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Hi.titi! What is your version of this test are issued (glest3.2.4-4-beta1) whether it has been stable?

It passed the rigorous testing of your, thank you!
« Last Edit: 31 January 2010, 04:22:03 by tom123 »

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Ok the new resource type works like this:

Resource = fish (this is setup to use the new static_no_recoup_cost)
Unit = Fishing Hole
Unit = Penguin
Unit = Fish (hidden unit with height and width of 0)

A penguin costs: 75 gold and 1 fish

#1 A penguin builds a Fishing Hole which costs: 100 gold and 100 wood
#2 The Fishing Hole can produce Fish Units which costs: 100 gold and -7 fish (which adds fish resources to the fish resource count once production of the hidden fish unit is done)

With normal static resources, once the unit (penguin) dies than the resources used to produce it (if the resource is static) are placed back into your resource count. In our case we don't want the resources back but there is no way to stop that otherwise so I created a new type of static resource that will not give back the static resources used to build a Unit when the Unit dies.

Does that make sense?
« Last Edit: 31 January 2010, 04:35:28 by softcoder »

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Just my 2 cents worth...

Why not just leave the type as static, and give an option as a sub-element of type, as is done with all the other resource types,

Code: [Select]
<resource>
<image path="images/fish.bmp"/>
<type value="static">
<recoup_cost value="false"/>
</type>
</resource>

Make it optional, defaulting to 'true' and therefore giving the correct behaviour for any existing static resources.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Will do, I am still learning glest, thanks for the pointers.

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
titi, When are you going online?? We need your help!

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Hi, guys! The following information is game testing information:
root@tom:/usr/local/games/glest# ./glest.bin
In [glest_game/main/program.cpp::setState] START
In [glest_game/main/program.cpp::setState] A
In [glest_game/main/program.cpp::setState] B
In [glest_game/main/program.cpp::setState] C
In [glest_game/main/program.cpp::setState] END
In [glest_game/main/program.cpp::setState] START
In [glest_game/main/program.cpp::setState] A
In [glest_game/main/program.cpp::setState] B
In [glest_game/main/program.cpp::setState] C
In [glest_game/main/program.cpp::setState] END
Restarting audio source because of buffer underrun.
In [glest_game/menu/menu_state_join_game.cpp::mouseClick] START
In [glest_game/menu/menu_state_join_game.cpp::connectToServer] START
In [glest_game/network/client_interface.cpp::connect] START
In [shared_lib/sources/platform/posix/socket.cpp::connect] #2 Error connecting socket for IP: 192.168.1.9 for Port: 61357 err = -1 errno = 115 [Operation now in progress]
In [shared_lib/sources/platform/posix/socket.cpp::connect] EINPROGRESS in connect() - selecting
In [shared_lib/sources/platform/posix/socket.cpp::connect] Error in delayed connection() 113 - [No route to host]
In [shared_lib/sources/platform/posix/socket.cpp::connect] Valid recovery for connection sock = 9, err = 1, errno = 115
In [glest_game/network/client_interface.cpp::connect] END - socket = 9
In [glest_game/menu/menu_state_join_game.cpp::connectToServer] server - [192.168.1.9]
In [glest_game/menu/menu_state_join_game.cpp::connectToServer] END
In [glest_game/menu/menu_state_join_game.cpp::mouseClick] END
[shared_lib/sources/platform/posix/socket.cpp::isWritable] TIMEOUT while selecting socket data, err = 0, errno = 11 [Resource temporarily unavailable]
In [shared_lib/sources/platform/posix/socket.cpp::disconnectSocket] START closing socket = 9...
In [shared_lib/sources/platform/posix/socket.cpp::disconnectSocket] calling shutdown and close for socket = 9...
In [shared_lib/sources/platform/posix/socket.cpp::disconnectSocket] END closing socket = -1...
[shared_lib/sources/platform/posix/socket.cpp::peek] DISCONNECTED SOCKET error while peeking socket data, err = 0, errno = 11 [Resource temporarily unavailable]

By the way: This is the latest test version (glest3.2.4-4-beta1) Test Information:
« Last Edit: 31 January 2010, 11:33:16 by tom123 »

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,228
    • View Profile
    • http://www.titusgames.de
We got another crash, but I think this is simply a timeout due to a very bad connection

(the crashed player played glest with a Asus EEPC and a very unstable internet connection)

Client log:
Code: [Select]
...
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 24
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 24
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 6
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 18
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 18
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 6
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 12
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 12
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 6
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 6
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() dataSize = 6
In [glest_game/network/network_interface.cpp::getNextMessageType] socket->getDataToRead() iPeek = 1, messageType = 5
In [glest_game/network/network_interface.cpp::receiveMessage]
In [glest_game/network/network_message.cpp::receive] dataSize = 6
Exception: Timeout waiting for message
Game
World
Minimap
Tech tree
Tileset
Cells

server log is here:
http://www.titusgames.de/glest.log.7z
« Last Edit: 31 January 2010, 13:25:04 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Yes, for that error to occur means the client got nothing on their network connection for > 10 seconds. ANY client that has a connection that awful would have no chance to play Glest in its current state. I noticed no problems on the server, which confirms that this client's connection must have been the likely cause. I think our latest changes with Silnarm's packet fix should make things a lot more stable than ever. We need people to continue testing and posting any logs if issues arise.

Thanks

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Tom, your error:

In [shared_lib/sources/platform/posix/socket.cpp::connect] Error in delayed connection() 113 - [No route to host]

tells me that you have a network problem. Either you entered the wrong server IP Address for where the glest server is running or your network had routing problems. To test, try issuing the following command from the client computer from a command prompt:

telnet 192.168.1.9 61357

BEFORE running this command from a command prompt, setup your glest server so that it is ready to receive client connections. Does this telnet command successfully connect to the glest server?

Thanks

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Use the command can be connected to the glest server: telnet 192.168.1.9 61357

But still this error prompt: In [shared_lib / sources / platform / posix / socket.cpp:: connect] # 2 Error connecting socket for IP: 192.168.1.9 for Port: 61357 err = -1 errno = 115 [Operation now in progress]

I was inside the firewall to open port 61357. Later, I put the system completely shut down the firewall!

Please help me, thanks!

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Please help me!

Super Tom

  • Draco Rider
  • *****
  • Posts: 311
    • View Profile
Please help me!