View topic - Copy some synced gadget callins to unsynced



All times are UTC + 1 hour


Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: 16 Nov 2011, 13:45 
User avatar

Joined: 28 Jul 2008, 05:51
Location: Australia
I'm writing a LuaAI that uses Tobi's framework (from C.R.A.I.G) to run unsynced. A large portion of the "framework" code is dedicated to serialising and forwarding some synced callins to unsynced.

I'm thinking though that most, if not all, of these callins would also make sense as unsynced versions done engine-side and this would alleviate a lot of messy serialisation. The unit callins would require allyTeam and/or LOS filtering.

The forwarded callins are:

Code:
-- These callins happen on the synced side but must be forwarded to unsynced
local syncedCallInList = {
   "GamePreload",
   "GameStart",
   "GameFrame",
   "TeamDied",
   "UnitCreated",
   "UnitFinished",
   "UnitDestroyed",
   "UnitTaken",
   "UnitGiven",
   "UnitIdle",
}


NOTE: The C.R.A.I.G code is kinda old, maybe some of these are already available unsynced?


Top
 Offline Profile  
 
PostPosted: 16 Nov 2011, 19:45 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
Might even be the case that CRAIG purposefully forwards them to avoid ally / los filtering? (I don't know, can't remember if I even ever did know)


Top
 Offline Profile  
 
PostPosted: 16 Nov 2011, 20:28 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
FLOZi wrote:
Might even be the case that CRAIG purposefully forwards them to avoid ally / los filtering? (I don't know, can't remember if I even ever did know)

^this. It is easy enough to hack spring, please be careful about how much you open up spring to exploits. None of our games will ever be competive as it is due to the ability to easily alter spring(open source code after all)


Top
 Offline Profile  
 
PostPosted: 16 Nov 2011, 21:15 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
FLOZi wrote:
Might even be the case that CRAIG purposefully forwards them to avoid ally / los filtering? (I don't know, can't remember if I even ever did know)

No, there is no way to get those events in unsynced without forwarding them.

However, CRAIG purposefully does not do any ally / los filtering, as it has been moved into unsynced Lua code mostly to prevent having to deal with running synced.
(And not to make it behave like a human with scouts and stuff.)


Top
 Offline Profile  
 
PostPosted: 17 Nov 2011, 01:42 
User avatar

Joined: 28 Jul 2008, 05:51
Location: Australia
This discussion is not relevant to cheating because we're talking about unsynced gadgets here, not widgets. The first 4 callins have no potential for cheating at all (how does knowing when the game started or a team died give you an advantage)? To open up cheating you'd need a gadget in your game forwarding data to widgets.

My proposal for the unit callins is simply that the data be made available to an unsynced gadget, preferably with an option to filter it by team and or LOS. The primary application for this would be non-cheating Lua AIs (which run synced and can cheat their hearts out anyway if they wanted to).

Tobi's code forwards data for unseen/enemy units via serialisation to string -> sendToUnsynced -> RecvFromSynced -> deserialisation which is expensive enough but then that data alsos need to be team/los filtered in Lua for a non-cheating AI. Given all this overhead a case exists for doing it in C++.


Top
 Offline Profile  
 
PostPosted: 17 Nov 2011, 01:58 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
ah, I misunderstood, I thought you were talking about unsynced in general, sorry for the that.


Top
 Offline Profile  
 
PostPosted: 17 Nov 2011, 12:23 
User avatar

Joined: 23 Feb 2009, 16:29
Location: Finland
The best way to prevent cheating btw is not by code, but by educating the playerbase that it's unsportsmanlike. There will always be ways to cheat, but that doesn't mean people will do it. Who wants to win that way anyway?


Top
 Offline Profile  
 
PostPosted: 17 Nov 2011, 12:45 
Moderator
User avatar

Joined: 23 Nov 2005, 06:16
Location: Dunedin, New Zealand
No, there will always be trolls.


Top
 Offline Profile  
 
PostPosted: 17 Nov 2011, 14:37 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
SpliFF wrote:
Tobi's code forwards data for unseen/enemy units via serialisation to string -> sendToUnsynced -> RecvFromSynced -> deserialisation which is expensive enough but then that data alsos need to be team/los filtered in Lua for a non-cheating AI. Given all this overhead a case exists for doing it in C++.


Wrong, no serialisation / deserialisation happens.

SendToUnsynced isn't more than a call-out in synced which synchronously calls the RecvFromSynced call-in in unsynced, only after checking that all the arguments are simple types (no tables, threads, functions).

So the overhead is a few extra function calls only: Spring, calls synced gadgetHandler, calls synced gadget, calls SendToUnsynced, calls unsynced gadgetHandler, calls unsynced gadget.

https://github.com/tvo/craig/blob/maste ... k.lua#L135
https://github.com/spring/spring/blob/d ... e.cpp#L252
https://github.com/spring/spring/blob/d ... e.cpp#L302

The serialisation you have seen in CRAIG is for the other way round: to send information from unsynced to synced. This needs to be serialised, because to send anything from unsynced to synced it must travel over the network so that all clients get the same message from unsynced at the same time.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.