Another 39dll Lib
#21
Posted 17 October 2009 - 11:02 PM
#22
Posted 17 October 2009 - 11:04 PM
#23
Posted 19 October 2009 - 01:21 AM
#24
Posted 20 October 2009 - 04:07 AM
In your example, the rate at which the players position takes a third of a second (Alarm is set to 10, room speed is 30, thus 10/30 is 1/3). I want to make it so that when the player moves, the position is updated to the server, but it isn't updated when the player is not moving. I tried things like "if speed !=0" and "if obj_player.x != obj_player.xprevious" but none of it works, the server person just stays in the upper left corner.
A bit of help please?
#25
Posted 20 October 2009 - 06:50 AM
Save your variables into temporary and check them against your current:Very nice! I understand it and makes it very easy for me to focus on the game itself otherwise.
In your example, the rate at which the players position takes a third of a second (Alarm is set to 10, room speed is 30, thus 10/30 is 1/3). I want to make it so that when the player moves, the position is updated to the server, but it isn't updated when the player is not moving. I tried things like "if speed !=0" and "if obj_player.x != obj_player.xprevious" but none of it works, the server person just stays in the upper left corner.
A bit of help please?
tspeed = speed
tdirection = direction
Then after you do your movement code (step event), something like:
if (tspeed != speed) || (tdirection != direction)
/\
tspeed = speed
tdirection = direction
send 'your speed/direction update message ID'
send x
send y
send speed
send direction
\/
I do suggest using an alarm to update just the x/y location while you are moving.
#26
Posted 20 October 2009 - 02:52 PM
Thanks for that. I'll be sure to try it out.Save your variables into temporary and check them against your current:Very nice! I understand it and makes it very easy for me to focus on the game itself otherwise.
In your example, the rate at which the players position takes a third of a second (Alarm is set to 10, room speed is 30, thus 10/30 is 1/3). I want to make it so that when the player moves, the position is updated to the server, but it isn't updated when the player is not moving. I tried things like "if speed !=0" and "if obj_player.x != obj_player.xprevious" but none of it works, the server person just stays in the upper left corner.
A bit of help please?
tspeed = speed
tdirection = direction
Then after you do your movement code (step event), something like:
if (tspeed != speed) || (tdirection != direction)
/\
tspeed = speed
tdirection = direction
send 'your speed/direction update message ID'
send x
send y
send speed
send direction
\/
I do suggest using an alarm to update just the x/y location while you are moving.
For the alarm, it updates even when the player is not moving, thus wasting messages sent and recieved - right? And lowering the timer even more would send it faster but use up even more messages. I just thought that you should update player if he is moving...but I may be wrong
Thanks again
EDIT: Nope, I tried what you did, didn't work... any other suggestions? Maybe I did something wrong...
Edited by qwertyuil390, 20 October 2009 - 03:04 PM.
#27
Posted 20 October 2009 - 07:45 PM
Yes, if you are not moving, the alarm wastes messages, I only built it as an example. Although you should send SOMETHING at least once every 5-10 seconds, just to keep the connection alive. Did you change the server to accept the variables? Delete the alarm code and try this:Thanks for that. I'll be sure to try it out.
For the alarm, it updates even when the player is not moving, thus wasting messages sent and recieved - right? And lowering the timer even more would send it faster but use up even more messages. I just thought that you should update player if he is moving...but I may be wrong
Thanks again
EDIT: Nope, I tried what you did, didn't work... any other suggestions? Maybe I did something wrong...
for server obj_player step event...
Update
Check for ID:33 (4 arg(s))
/\
Receive into x
Receive into y
Receive into speed
Receive into direction
Write 37
Write self.id
Write x
Write y
Write speed
Write direction
Send to Group Movement 0
\/
Clean up Messages
for the client obj_startup create event 'Execute a piece of code' add this...
td = -1; ts = -1;
for the client obj_startup step event before the "Clean up Messages"....
Check for ID:37 (5 arg(s))
/\
Receive into nid
Receive into otx
Receive into oty
Receive into ots
Receive into otd
Execute a piece of code
var z;
if (nid != myid)
{
if ds_map_exists(pids, nid)
{
z = ds_map_find_value(pids, nid);
z.x = otx;
z.y = oty;
z.speed = ots;
z.direction = otd;
} else
ds_map_add(pids, nid, instance_create(tx, ty, obj_others));
}\/AFTER Clean up Messages, put...
If an expression is true (ts!=obj_player.speed)||(td!=obj_player.direction)
/\
Set variable ts to obj_player.speed
Set variable td to obj_player.direction
Send 33
Send obj_player.x
Send obj_player.y
Send obj_player.speed
Send obj_player.direction
\/
Edited by sabriath, 21 October 2009 - 05:10 AM.
#28
Posted 20 October 2009 - 11:19 PM
Also, when I did that, like before, the player was always in the top left corner on anybody's screen...They were there, but their position didn't update...
#29
Posted 21 October 2009 - 05:09 AM
Sorry, I forgot that I moved the object directly with x/y changes rather than with speed and direction. Update the player object in the client to move using speed and direction instead, something like:Uh, wow it still didn't work and I did EXACTLY as you said... send me a copy of a client and server that successfully completes this so I can see if it works on my computer...
Also, when I did that, like before, the player was always in the top left corner on anybody's screen...They were there, but their position didn't update...
if down key pressed
vspeed = 1
else
if up key pressed
vspeed = -1
else
vspeed = 0
if left key pressed
hspeed = -1
else
if right key pressed
hspeed = 1
else
hspeed = 0
I also see an error with my previous post, I will highlight the parts with bold text, it's near the bottom. It should work. I no longer will be helping with this project because I am trying to finish my scripts. I will come back to this at a later time to fix it for easier use.
#30
Posted 21 October 2009 - 03:08 PM
Umm, can anyone tell me what the difference between the "Write Message" and "Send Message" actions are? I changed some send actions to write actions and I the player went in the upper left corner, but with send messages, the player would still go to its starting position on the server but it wouldn't move when I moved the player...
#31
Posted 21 October 2009 - 07:28 PM
"Write Message" is located in the Server Player area, which means you should only put it on the server side before a "Send to Group". "Send Message" sends directly to the other connection, used primarily by the client.Lol still hasn't worked but thanks anyways.
Umm, can anyone tell me what the difference between the "Write Message" and "Send Message" actions are? I changed some send actions to write actions and I the player went in the upper left corner, but with send messages, the player would still go to its starting position on the server but it wouldn't move when I moved the player...
I had a few errors before, not sure why you couldn't fix them, but here are the files. The code is almost the exact same (other than a couple errors like I said).
http://willhostforfo...servclient2.zip
#32
Posted 26 October 2009 - 08:39 PM
___________________________________________
ERROR in
action number 1
of Step Event
for object obj_player:
Error in code at line 12:
if float=true
at position 5: Unknown variable float
#33
Posted 27 October 2009 - 09:46 AM
*looks blankly at you*I get this error:
___________________________________________
ERROR in
action number 1
of Step Event
for object obj_player:
Error in code at line 12:
if float=true
at position 5: Unknown variable float
That's not my code, so I'm not sure where you got that error from.
#34
Posted 20 November 2009 - 05:45 PM
#36
Posted 23 November 2009 - 10:33 AM
#37
Posted 26 November 2009 - 07:39 AM
#38
Posted 13 December 2009 - 02:54 AM
I mostly use GML but I'd like to give this a try as 39dll has been a bit complicated so far, so I'll try it out and see how it feels. =P I'm guessing it's at least better than getting laughed at when I use mplay lol.
#39
Posted 17 April 2010 - 06:44 PM
#40
Posted 03 October 2010 - 06:38 PM
Actions i need help with:
In short i dont get the messages thing
PS This is my second try at creating a GM MMORPG in the meantime ill mess around with the LIB until someone replies...
PS 2 Im using GM8
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











