Easysock - Version 1.0 Beta!
#41
Posted 30 August 2006 - 10:49 PM
#42
Posted 30 August 2006 - 11:01 PM
#43
Posted 30 August 2006 - 11:11 PM
#44
Posted 30 August 2006 - 11:18 PM
#45
Posted 31 August 2006 - 10:33 PM
That could be a good thing to also explain how to create an object wich could interact with the 2 players...
For exemple a ball in a pong game
(If you do it, do not delete or replace this exemple, juste add it to the zip )
Really good work...
(But need to be more develop to be really interesting
Edited by CyberTwister, 31 August 2006 - 10:35 PM.
#46
Posted 01 September 2006 - 02:15 AM
i send only x and y and it has no lag and i have freeze unchecked. but it doesn't send the x and y right....i just tried to send the x and y of a bullet, and it didn't send it, it didn't show up on the other screen...so something is going wrong here.
#47
Posted 01 September 2006 - 03:02 AM
Let's say you send the x,y for every bullet object you create. Now lets say you put a machine gun in the game which shoots 1 bullet every step. The game runs at 60 fps.
If you had 4 players fighting each other, each with a machine gun in hand, and they shot at each other for 1 second straight, you'd have:
(4 players) x (60 bullets) x (3 variables to send [index of bullet, x, and y, all as short (2 byte) values]) = 4320 bytes of data to send each step. That's 259k of data to send every second of play!
Now, lets say you had the same setup, but you're only sending the x, y, and direction of the bullets... but this is only the start point of the bullet, and only needs to be sent once for each bullet. Now you're looking at athe same equation, but it only need to be sent once a step, as the bullets can take care of themselves once they are created.
Using this method, you'd only be sending 96 bytes a step, which translates to 576 bytes a second. Now you've got plenty of bandwidth to use for the player movements, etc.
Of course, under normal circumstances, you wouldn't really want to send information around every step, but this is just an example. The bandwidth used would be the same if you waited every 6 steps to send the data, and it would not be very laggy at all.
In any case, multiplayer games require a fair amount of planning, so before you just start sending all kinds of packets back and forth, start working out what would be the best way to work things out.
Sorry about that long-winded and slightly OT post, Fox... Just had to clear that up.
#48
Posted 01 September 2006 - 04:10 AM
#49
Posted 01 September 2006 - 11:27 AM
#50
Posted 01 September 2006 - 11:54 AM
Could someone explain us/me how to create an instance with a motion pleaze ?
(That means for exemple a bullet wich will be seen by the 2 players...)
Thanx a lot for any help...
#51
Posted 02 September 2006 - 11:26 PM
#52
Posted 03 September 2006 - 12:39 AM
You should be able to open your game in two windows (save it and open a second gamemaker window with your program) and test it that way.
#53
Posted 03 September 2006 - 01:51 PM
Can't someone explain us how to shoot pleaze ?
(that means create a bullet wich will be seen by the 2 players)
Thanx a lot for any help...
Edited by YopYop, 03 September 2006 - 01:51 PM.
#54
Posted 03 September 2006 - 03:53 PM
So my problem is movement of players works but I cannot see the bullet I shoot on both screens only one. Yet I send the x and y of the bullet to the other player.
If anyone is really trustworthy I will let you take a look at the gm6
okay heres my topic with my problem:
problem with easysock
Edited by Dinsdale, 03 September 2006 - 04:09 PM.
#55
Posted 03 September 2006 - 04:16 PM
About the bullet thing, try using the following codes:
Send a message when a bullet gets launched
i = instance_create(x,y,obj_bullet);
i.direction = direction;
packetstart();
packetwrite(2); //2 = bullet message id
packetwrite(i.x); //bullet x
packetwrite(i.y); //bullet y
packetwrite(i.direction); //bullet direction
packetsend(false);Then receive the message like how the location packets are received (obj_controller, step event)
m_id = packetread();
if(m_id == 1) {
obj_player_client.x = packetread();
obj_player_client.y = packetread();
} else if(m_id == 2) {
i = instance_create(0,0,obj_bullet);
i.x = packetread();
i.y = packetread();
i.direction = packetread();
}
#56
Posted 03 September 2006 - 04:39 PM
#57
Posted 03 September 2006 - 05:20 PM
Can u (or someone) put a gm6 file pleaze ?
That would be so nice....
Thanx a lot for this work
Edited by YopYop, 03 September 2006 - 05:27 PM.
#58
Posted 03 September 2006 - 11:25 PM
keep working i'd like to use it some day
#59
Posted 04 September 2006 - 03:03 AM
#60
Posted 04 September 2006 - 04:50 AM
This would require a map system that holds the sockets. This uses something along 1 socket in a global variable. Making 2 player games are easy to do. But more then 2 can get hard.
Using another client for EasySock example will not work, once it accepts the player it closes the listening socket. And even if you did connect to the server. The sending and receiving only goes to the other socket.
Meh I confused myself on explaining but I have a engine called PK_Engine that supports more the one player that is like EasySock except different. Comparing my scripts with his are very different. Mine has a lot more coding to handle the other players.
Hope you understand.
- Toon-Master
EDIT: Ok I relised you didn't read the scripts, sorry about that.
Edited by Toon-Master, 04 September 2006 - 05:24 AM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users



This topic is locked







