Rick Posted December 17, 2009 Share Posted December 17, 2009 I know you can have a delay for SendMessage() but let's say you put a 0 in there meaning you don't want a delay. Does SendMessage() instantly call the GetMessage() of the entity you are sending or does this happen at a certain point in the main loop? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 17, 2009 Share Posted December 17, 2009 In the switch.lua is comment: --Just set the key and everything will get updated automatically So my guesses are that it updates instantly Quote Link to comment Share on other sites More sharing options...
Rick Posted December 17, 2009 Author Share Posted December 17, 2009 See my concern is that automatically and instantly are 2 different things. The reason I ask this is since a message can have a delay to it and I think that delay is non blocking to the rest of the code (I'm assuming it is), then the message must get stored and a timer later sends messages that have reached their delay time limit, and I assume this is done at a specific spot in the updating of the engine. So for messages that don't have a time limit one of 2 things could happen. They could be sent instantly from SendMessage(), or the message is stored, but they get sent instantly when that update portion of the engine happens. So it would depend on how Josh implemented this message system behind the scenes. The reason I ask is because I would want the message sent instantly from the SendMessage() instead of possibly stored and send from some engine update. I fear that might give a slightly laggy feeling in some situations where some entity slows down the cycle from hitting that engine update part. Quote Link to comment Share on other sites More sharing options...
TylerH Posted December 18, 2009 Share Posted December 18, 2009 You can code your own system in Lua that works instantly. If I can assume that if I grab an instance of ANOTHER script in a given entity's script, can I access the members defined in the OTHER script? Or does this multi-state setup prevent that currently? The single-state would clearly let you setup a global message system simply in Lua using an Input/Output structure like in Hammer. function entity:FireOutput(output,value) for k,v in pairs(self.targets) do v:FireInput(output,value) end end The above would be instantaneous, because you are directly calling a function of the receiver from the sender's script. Hammer/Source engine does this EXACTLY in this way, except via C++ functors/callbacks, not Lua. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Josh Posted December 18, 2009 Share Posted December 18, 2009 Messages with zero delay are sent immediately. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted December 18, 2009 Author Share Posted December 18, 2009 That's perfect. So really it's not that much overhead from doing that than calling a method of that entity directly. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 18, 2009 Share Posted December 18, 2009 Right. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.