Arska134 Posted March 25, 2012 Share Posted March 25, 2012 This is not quite Leadwerks question, but i hope there is some clever people who can give me some tips to get my code working right. I asked this already in Blitzmax forum, but i can't get answer so i'll try my luck here. So problem is that code works as expected with 2 players, but when third one joins in... Models starts to flickering, because models position changes constantly. Here is multiplayer part of my code: http://pastebin.com/raw.php?i=TSrmvMSF Here is network variable info: remoteobj 0 = PlayerID (player's unique ID) remoteobj 1 = Nickname (player's nickname) remoteobj 2 = X (player's X coord) remoteobj 3 = Y (player's Y coord) remoteobj 4 = Z (player's Z coord) remoteobj 5 = RX (player's pitch) remoteobj 6 = RY (player's roll) remoteobj 7 = RZ (player's yaw) remoteobj 8 = health (player's health) remoteobj 9 = cash (player's cash) remoteobj 10 = flashlight (player's flaslight status) remoteobj 11 = connected (player's connection status) I'll ask another question too. I need to sync daytime with all players. I'am using this script: http://www.leadwerks...y-night-script/ I really appreciate your help. My project is kinda frozen, because of these problems. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted March 25, 2012 Share Posted March 25, 2012 Have you considered using network interpolation. Its tricky to get right but makes things smooth. Have a read here https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
Arska134 Posted March 26, 2012 Author Share Posted March 26, 2012 I think i know what is wrong, but i can't come up with any solution to fix it. So now program knows who is local object and who is remote, but when there is 2 remote objects it thinks those are same... I really really appreciate any help you can give me. I am so out of ideas in this one. :/ I don't even know is the problem in my dedicated server or client side. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Daimour Posted March 26, 2012 Share Posted March 26, 2012 For remoteObj = EachIn objList For Local p:PLAYERS = EachIn playerList Why two cycles? Quote Link to comment Share on other sites More sharing options...
Arska134 Posted March 26, 2012 Author Share Posted March 26, 2012 For remoteObj = EachIn objList For Local p:PLAYERS = EachIn playerList Why two cycles? Hmm.. i don't even noticed that. But thanks. Problem still exist, help needed. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Daimour Posted March 26, 2012 Share Posted March 26, 2012 Problem still exist, help needed. Did you fix already that two cycles? Quote Link to comment Share on other sites More sharing options...
Arska134 Posted March 26, 2012 Author Share Posted March 26, 2012 Thanks Daimour's help i get some more information about this problem. So problem can be server side too. Here is Dedicated server code: http://paste.servut.us/plain/gu4s Here is some server log: Player Arska134(0) has joined the game! Players on server: 1 Player test(1) has joined the game! Players on server: 2 Player test(0) has disconnected! Players on server: 1 Player test2(2) has joined the game! Players on server: 2 Player Arska134(0) has disconnected! Players on server: 1 Player test2(0) has disconnected! Players on server: 0 As you can see between brackets is player ID and that is different when disconnecting. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Daimour Posted March 27, 2012 Share Posted March 27, 2012 I've learned a little about GNet. And I like it very much. It's the simplest thing for networking I've ever seeing. In your case you don't need all that code on the server side. Because all work is going on the client side. Simplify your code as much as possible for debugging purposes. Try to replace server side code with this: Local port = 80 ' users would normally choose one allowed through their firewall Local servername$ = "Freezing_world_server"+Rand(1000, 9999) Local success success = GNetListen( host, port ) If Not success Then RuntimeError "Cannot create server!" Repeat Delay 10 ' allow other apps some cycles to minimize CPU use PollEvent GNetSync host Until EventID() = EVENT_WINDOWCLOSE So since nothing happens on the server side you can easier debug your client side code. 1 Quote Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted March 27, 2012 Share Posted March 27, 2012 Because all work is going on the client side. if this is true, that's most likley the cause of your problems... i'm of the faith that all the work should be done on the server, and the (lightweight) client should only take user input, send it to the server and receive the synced values that'll determine the "ghosted" positions and orientations mimicking the synched objects as they appear on the server... --Mike Quote Link to comment Share on other sites More sharing options...
Arska134 Posted March 27, 2012 Author Share Posted March 27, 2012 Daimour: Looks like we got some progress. Now all players can see each other, but player models are flickering. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Daimour Posted March 27, 2012 Share Posted March 27, 2012 Yeah. So step by step we will write working code. Now all players can see each other, but player models are flickering. Now you can easily debug client side code. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted March 28, 2012 Author Share Posted March 28, 2012 (edited) I'll start to debuggin as soon as possible when i have time. If i get solution for this, i will post it. If someone solves this problem before me, let me know solution. That would save me lot of time. Edit: It's now fixed. Huge thanks for Daimour. And there is my another question in first post too. To simplify question: How can i output time of the day from script Edited March 28, 2012 by Arska134 Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Daimour Posted March 28, 2012 Share Posted March 28, 2012 How can i output time of the day from script Use SetEntityKey() function to se tup the time. Or GetEntityKey() function to get the time from script. This script (entity) has 3 keys: "hour", "minutes" and "seconds". So use these keys. hour = GetEntityKey(daynight, "hour") SetEntityKey(daynight, "hour", hour) Quote Link to comment Share on other sites More sharing options...
Arska134 Posted March 29, 2012 Author Share Posted March 29, 2012 Okay, so i almost got daytime syncing working, but another strange problem come up. Here is code: http://paste.servut.us/plain/udrk First player gets and sets up time of the day right, but second player get time of the day, but not set it up, so sky is black and looks like there is no sky at all. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Arska134 Posted March 30, 2012 Author Share Posted March 30, 2012 And... it's seems to work right after second compilation O_o Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax 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.