Jump to content

SendMessage timing


Rick
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...