| We hope you enjoy your visit. You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you are already a member please log in to your account to access all of our features: |
| 39dll problem | |
|---|---|
| Tweet Topic Started: Nov 19 2010, 08:45 AM (650 Views) | |
| DJ-Habana | Nov 19 2010, 08:45 AM Post #1 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Ok the problem's I had are fixed but now new ones arrived ![]() when 2 players plays a while the server give's an error array out of bounds in obj_client step event but if it is only me playing and I play for a while and exit then the server doesn't pickup that I left so I dunno what the problem is i tried to think that globel.myid changes but I was wrong about that one it stays 0, but If I leave and enter again it becomes 1 and my previous character doesn't get destroyed |
|
| |
![]() |
|
| Reikyrr | Nov 20 2010, 12:30 AM Post #2 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Its about an array, what do you do with it? |
|
~Inspirational quote~ | |
![]() |
|
| DJ-Habana | Nov 20 2010, 04:26 AM Post #3 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
server object create event
and step event
|
|
| |
![]() |
|
| DJ-Habana | Nov 20 2010, 04:28 AM Post #4 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Im starting to give up on this, I tried now two ways to make a server 1 using the 39ster's example on his website 2 the one found here on 1 the problem is players sometimes randomly dissapears on 2 the problem is that array error and also when you play a few sec then you get disconnected or something ill upload both of them After I recreated the server and online stuff the 5th time it works now smoothly and so far no errors my brain is overpowerd now Edited by DJ-Habana, Nov 20 2010, 08:29 AM.
|
|
| |
![]() |
|
| DJ-Habana | Nov 20 2010, 10:33 AM Post #5 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
ok guess it is not fixed ___________________________________________ ERROR in action number 1 of Step Event for object obj_39DllControl: Error in code at line 26: player = players[readbyte()]; //get id of player from playerlist ^ at position 17: Unknown variable players or array index out of bounds and also ___________________________________________ ERROR in action number 1 of Step Event for object u_Character: In script sendDirection: Error in code at line 6: sendmessage(obj_39DllControl.socket); ^ at position 31: Unknown variable socket they ussually come when a player leaves |
|
| |
![]() |
|
| DJ-Habana | Nov 20 2010, 10:33 PM Post #6 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Anyone willing to look at my game. when there is 2 players everything works fine but when a 3rd player joins and we play for a while then thats when things go wrong and the one disconnecting randomly get's one of those 2 errors |
|
| |
![]() |
|
| DJ-Habana | Nov 22 2010, 07:39 PM Post #7 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
damn I hate 39dll As soon AS one thing is fixed another arives |
|
| |
![]() |
|
| DJ-Habana | Nov 22 2010, 07:43 PM Post #8 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I am thinking of giving up... |
|
| |
![]() |
|
| Despellanion | Nov 22 2010, 08:12 PM Post #9 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Your problems are actually not that difficult. I think you are making it harder than it is. Like this one:
Try instead:
That might clear up the variable error. Remember that Game Maker is not always very reliable with the way it throws out errors. |
![]() |
|
| DJ-Habana | Nov 22 2010, 08:45 PM Post #10 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I have deleted that server and game, created a new one so far it is running good, no errors well not tested with more than 2 players I followed what you said there but Ill check if I can get someone to help me test. just one question, in one example I saw they used for(i=0; i < global.players; i+=1) { if (global.players==-1) break; } I am using it like for(i=0; i < global.maxplayers; i+=1) { if (global.players==-1) break; } ok I tested, this is what happens now, play for about 2 min then the server starts to lag both game speeds are = 60 Edited by DJ-Habana, Nov 22 2010, 08:47 PM.
|
|
| |
![]() |
|
| Despellanion | Nov 22 2010, 09:07 PM Post #11 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Then you are probably doing an endless loop on the server. Make sure you break the for-loop correctly so it doesn't fill the entire array with the same player id. |
![]() |
|
| DJ-Habana | Nov 22 2010, 09:18 PM Post #12 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Ok this is my code for the server: var clientsocket, player; numofp = instance_number(objPlayer); clientsocket = tcpaccept(servertcp,1); if (clientsocket <=0) exit; setsync(clientsocket,0);//Set sync to false receivemessage(clientsocket); name = readstring(); //Go through the array to check for an empty space for(k=0; k < global.maxplayers; k+=1) { if (global.players[k]==-1) break; } clearbuffer(); writebyte(myid);//Send the player who joined his player id writebyte(k); sendmessage(clientsocket); player = instance_create(0,0,objPlayer); player.pid = i;//Set Player's ID player.tcp = clientsocket;//Set Socket where to send data player.username = name;//Set players username global.players[k] = player;//add player to the array clearbuffer(); writebyte(joined); writebyte(k); writestring(name,true);//send all players that a new player joined with(objPlayer) { if (id!=player) {sendmessage(tcp);} } //send the player, the other players who joined with(objPlayer) { if (id!=player) {clearbuffer(); writebyte(joined); writebyte(pid); writestring(username,true); sendmessage(clientsocket);} } //Set sync to true setsync(clientsocket,1); //Write on server the player name that joined chat_addline(name + " has joined.",c_black); There is still a bit lagg, but if I change the room speed of the server to 70 the lag is gone but I am not sure if that is effecient Edited by DJ-Habana, Nov 22 2010, 09:28 PM.
|
|
| |
![]() |
|
| DJ-Habana | Nov 22 2010, 10:19 PM Post #13 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
after a while me and my friend played he got this error ERROR in action number 1 of Step Event for object obj_39DllControl: Error in code at line 64: player = global.players[value]; ^ at position 34: Unknown variable players or array index out of bounds |
|
| |
![]() |
|
| DJ-Habana | Nov 22 2010, 10:37 PM Post #14 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Found my mistake lol case playerleave: value = readbyte(); >>>>> if value != global.Pid;{ <<<<< there is the mistake player = global.players[value]; chat_addline(player.username + " has left the game.",c_black); with(player) {instance_destroy();} global.players[value] = -1;} FIXED code: case playerleave: value = readbyte(); if value != global.Pid{ player = global.players[value]; chat_addline(player.username + " has left the game.",c_black); with(player) {instance_destroy();} global.players[value] = -1;} |
|
| |
![]() |
|
| DJ-Habana | Nov 24 2010, 09:27 PM Post #15 |
|
C# King
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
OK somehow I get no errors but if 2 or more players play for like 5 min then the server crash with this error ___________________________________________ ERROR in action number 1 of Step Event for object obj_39DllControl: Error in code at line 26: player = players[readbyte()]; //get id of player from playerlist ^ at position 17: Unknown variable players or array index out of bounds My game's roomspeed = 60 and the server is 70 if the server is also 60 there is a lag in the talking between them like I move and several seconds after that the player in the server moves Edited by DJ-Habana, Nov 24 2010, 09:44 PM.
|
|
| |
![]() |
|
| « Previous Topic · Off-topic · Next Topic » |





![]](http://z1.ifrm.com/static/1/pip_r.png)




10:48 AM Jul 11