Search the Community
Showing results for tags 'network'.
-
Hey, I had a quick question for @PeterA or @MarkL. I wouldn't bother you if this wasn't something worthwhile, but I have a question about c_connect(). We are trying to connect via our real/public IP address (we are in the same house right now. Also, we haven't changed any port numbers, it's just 10999 like default). I look it up through https://whatismyipaddress.com/ and he types it in. During our testing, we tried to change up the IP address using our phone's hotspots, but the only successful variation of this would be if I (the host) was connected to the home wifi and he was connected to the phone hotspot. Never the other way around or with two phone hotspots. VPNs also would not work if I used one, however he was able to connect if he used one. My question is if there are certain requirements or limits to this c_connect() command. Any description of how it works internally would be useful to know too.
-
I created an action that works by pressing a key. But As you see in the GIF, character teleports back to a point where it actually is in the server, which should have been synchronized. Also, this is a prototype and It'll become a 'skill' that charge to the enemy. So before that, this issue must be solved. Github Page First, Add KeydownHandler to make it KeyPress and send RPC to the server. TheInput:AddKeyDownHandler(_G["KEY_R"], function() if inst == ThePlayer and not inst:HasTag("inskill") and not inst.HUD:IsConsoleScreenOpen() then SendModRPCToServer(MOD_RPC["sendi"]["rapier"]) end end) And the server sets net_var in classified where is attached to the character function rapier(inst) inst.sendi_classified.rapier:set(true) end AddModRPCHandler("sendi", "rapier", rapier) In sendi_classified.lua, netvar definition and Regeistering NetListeners. inst.rapier = net_bool(inst.GUID, "onrapier", "onrapierdirty") inst.rapier:set(false) local function RegisterNetListeners(inst) if TheWorld.ismastersim then inst._parent = inst.entity:GetParent() else end inst:ListenForEvent("onrapierdirty", Rapier) end When net_var changes, this event will be called. local function Rapier(inst) local shouldtrigger = inst.rapier:value() if shouldtrigger then if TheWorld ~= nil and TheWorld.ismastersim then inst._parent.components.playercontroller:DoAction(BufferedAction(inst, nil, ACTIONS.RAPIER)) end elseif inst._parent.components.playercontroller ~= nil then inst._parent.components.playercontroller:Enable(true) end end I pushed BufferedAction via DoAction which will push action in both the client and the server. (Maybe function this could cause the issue) Here's the Action StateGraph to be performed in the server. local rapier_server = State { name = "rapier", tags = { "busy", "doing", "attack", "skill", "pausepredict"}, onenter = function(inst) inst:AddTag("inskill") inst.components.locomotor:Stop() inst.components.locomotor:Clear() inst:ClearBufferedAction() ForceStopHeavyLifting(inst) if inst.components.playercontroller ~= nil then inst.components.playercontroller:RemotePausePrediction() inst.components.playercontroller:Enable(false) end inst.AnimState:PlayAnimation("whip_pre") inst.AnimState:PushAnimation("whip", false) inst.sg:SetTimeout(1) inst.components.sendiskill:OnStartRapier() inst:PerformBufferedAction() end, timeline = { TimeEvent(4 * FRAMES, function(inst) inst.sg:RemoveStateTag("busy") end), TimeEvent(9 * FRAMES, function(inst) end), TimeEvent(18 * FRAMES, function(inst) --inst.Physics:Stop() end), }, events = { EventHandler("animqueueover", function(inst) if inst.AnimState:AnimDone() then inst.sg:GoToState("idle") end end), }, onupdate = function(inst) end, ontimeout = function(inst) inst:RemoveTag("inskill") inst.sg:GoToState("idle", inst.entity:FlattenMovementPrediction() and "noanim" or nil) inst.sendi_classified.rapier:set(false) if inst.components.playercontroller ~= nil then inst.components.playercontroller:Enable(true) end end, onexit = function(inst) inst:RemoveTag("inskill") inst.sendi_classified.rapier:set(false) end, } in onenter, prevent the player to move because this will become a 'charge skill'(and non-cancelable). then re-set the classified to make the players move again. And the client version. local rapier_client = State { name = "rapier", tags = { "doing", "attack", "skill" }, onenter = function(inst) inst.components.locomotor:Stop() inst.components.locomotor:Clear() inst.entity:SetIsPredictingMovement(false) inst.entity:FlattenMovementPrediction() inst.AnimState:PlayAnimation("whip_pre") inst.AnimState:PushAnimation("whip", false) inst:PerformPreviewBufferedAction() inst.sg:SetTimeout(1) end, onupdate = function(inst) if inst.bufferedaction == nil then inst.sg:GoToState("idle", true) end end, ontimeout = function(inst) inst:ClearBufferedAction() inst.sg:GoToState("idle", inst.entity:FlattenMovementPrediction() and "noanim" or nil) end, onexit = function(inst) inst.entity:SetIsPredictingMovement(true) end, } The codes I messed up in onenter, onexit, FlatternMovementPrediction thingies are what I have tried to prevent the issue, but none of these works... And I don't know what SetIsPredictingMovement() actually do, maybe it's related to TheNet. I think the point at which the character can control is a little faster than... the server's entity is ready to locomote. How can I sync the player's position in right time? Or did I missed something?
-
I'd like to make this mod. Main idea is that people can join separate groups in a separate server. They can share various information, use clan effects etc. I'd like to add a limit of how much people can join in a single clan. My question is about server with caves. How can I send information about how much people are in some clan? I think all information about clan should be ob the main server. Other shards (at least caves server) should get this info from main server, also they should have possibility to change this info without collisions. Does anybody have an idea how to do that? Thanks in advance.
-
EDIT: Solved I am a total noob when it comes to networking. To be fair, I know that data needs to be send by the host for the client to recieve it, but that's about it. I tried porting Vasa Mundus to DST (available on Steam Workshop), and whilst the host part works perfectly fine, the client... lacks. I couldn't test everything because client testing takes two people, but here are two important issues: 1. crash when opening a chest prefab. The client side never sets the container widget's data to the standard "treasurechest". I didn't get to try an explicit data set so far, though I doubt it would be any different. 2. Talker component does not talk. This isn't critical, but highly annoying, and even worse, I have no idea why it happens (or doesn't, rather). The prefab is meant to talk when hit, and it properly shows for the host only. Thank you for letting me complain about things I don't grasp. I am probably just being stupid or ignorant or overthinking or all three of those. Don't be harsh, just honest. Thanks again!
-
Ok so, I made a character with custom items, however, once I tested it through a server, I realized that people becomes unable to connect or gets into a never ending loading screen. HOWEVER this started once I added the inst.entity:AddNetwork()and if not TheWorld.ismastersim then return inst end inst.entity:SetPristine()of course before the first line there the items would never appear, so, that explains why the connection problem was not happening, but still. Does anyone has any idea of what is happening? and anyone could give a hand?
- 6 replies
-
- Dont starve together
- custom item
-
(and 5 more)
Tagged with: