Custom LuaUI network messaging - Page 3

Custom LuaUI network messaging

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

Could I write a game-nuker widget that hoses people's bandwidth, then?
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

Something like sending out a flood of unit commands?
(my point is that that can already be done)

I have new per-player bandwidth tracking code in my local
source code . You can access the information using LuaUI.
A bandwidth monitoring widget should be very easy to write.

Spring.GetPlayerTraffic(playerID, packetType)
playerID can be -1 for system messages like NETMSG_NEWFRAME
packetType can be -1 for the sum of all packet types

Here are the current limitations:

Code: Select all

  // only allow viewing stats for specific packet types
  if ((playerID != -1) &&              // all system counts can be read
      (playerID != gu->myPlayerNum) && // all  self  counts can be read
      (packetID != -1) &&
      (packetID != NETMSG_CHAT)   &&
      (packetID != NETMSG_PAUSE)  &&
      (packetID != NETMSG_LUAMSG) &&
      (packetID != NETMSG_USER_SPEED)) {
    // Return -1 as the count
    lua_pushnumber(L, -1);
    return 1;
  }
Post Reply

Return to “Lua Scripts”