• Programming - WAYWO - March 2013
    1,001 replies, posted
[QUOTE=Felheart;39737186]Well the typical resolution is 1920x1080 = 207360 pixels.[/QUOTE]You mean 2,073,600 pixels.
[QUOTE=Richy19;39739357]Do any of you have any good resources on developing multiplayer for games? Like structure, architecture, writing the server, classes...[/QUOTE] Well, it depends on the kind of game you're going for. Most multiplayer games use a client/server architecture. That is, all the communication between the clients is delegated by the server. I'd look into documentation on how to send/receive UDP packets on your platform, then go from there. It's not terribly complicated honestly, you just need to think about what the server needs from the client and vice-versa. The way you go about sending and receiving the data, and how the data is packaged is pretty straight forward. So for example a packet from client to server to notify the server of the a player's apparent position could be packed like so: [code] 4 byte Protocol Identifier, magic number so you can easily identify that this packet is indeed for your game. 1 byte Packet Type, essentially the purpose of the packet and what it contains. 3 byte Player's position. [/code] That's the general idea.
[t]https://dl.dropbox.com/u/41041550/Coding/C%23/OGLFV/yebetter.PNG[/t] Going to have a go at geometry shaders soon to displace the event horizon.
[QUOTE=Bladezor;39740286]Well, it depends on the kind of game you're going for. Most multiplayer games use a client/server architecture. That is, all the communication between the clients is delegated by the server. I'd look into documentation on how to send/receive UDP packets on your platform, then go from there. It's not terribly complicated honestly, you just need to think about what the server needs from the client and vice-versa. The way you go about sending and receiving the data, and how the data is packaged is pretty straight forward. So for example a packet from client to server to notify the server of the a player's apparent position could be packed like so: [code] 4 byte Protocol Identifier, magic number so you can easily identify that this packet is indeed for your game. 1 byte Packet Type, essentially the purpose of the packet and what it contains. 3 byte Player's position. [/code] That's the general idea.[/QUOTE] You forgot to mention dealing with reliability. Make sure you check on UDP reliability too.
This is a fun little idea: [t]http://i1217.photobucket.com/albums/dd382/CatmanJohn/angl.jpg[/t] But the effect would be much better if the wallpaper was really changed when you switched from a full-screen (or near full-screen) window to desktop. So I took 15 minutes and made it happen I learned that the designated "desktop window" rarely gets on the foreground, even when you'd expect it to. More often, it's actually the start button that's on your foreground. Or an invisible worker object that's responsible for catching hotkeys such as win-d or alt-tab. Sometimes it's the shell ("progman") who is involved in various ways in drawing the desktop icons and some other shit. There's lots of cool stuff in WinAPI but sometimes it's just awful. And holy shit do I hate GDI
got my EntityFactory/EntityManager classes working as intended [img_thumb]http://i.imgur.com/tU7bSJl.png[/img_thumb]
[QUOTE=Bladezor;39738639]Nah, I also noticed that your source and header pch's are in different places than the rest of your stuff so that might be why. VS kept giving me errors about not including the header even though it was, so I dunno.. I'll take a look again today.[/QUOTE] VS is a fucking crybaby when it comes to the precompiled header, there's probably good reason why I have it setup that way even though I don't remember the specifics. It also had to do with keeping the same code for gcc and VS (I used to have an "if" for the pchheader).
[QUOTE=redx475;39741224]You forgot to mention dealing with reliability. Make sure you check on UDP reliability too.[/QUOTE] You're correct, UDP packets are not guaranteed to arrive at their destination, and if they do they can arrive out of order. With that said, the reason I said UDP is because it's usually a little easier to setup and get going than TCP. It's connection-less, you just send a packet on it's way. Oh, it's also generally better for games as it doesn't carry the overhead TCP does. In reality, UDP is decently reliable, otherwise it wouldn't be used. But yes, for a good implementation these problems need to be addressed properly. [QUOTE=gparent;39742287]VS is a fucking crybaby when it comes to the precompiled header, there's probably good reason why I have it setup that way even though I don't remember the specifics. It also had to do with keeping the same code for gcc and VS (I used to have an "if" for the pchheader).[/QUOTE] I spent 3-4 hours on it last night before I gave up on precompiled headers. I've decided since my project is so tiny right now it's not really a necessity. If compile times start getting bad I'll look into it again.
[QUOTE=Richy19;39739357]Do any of you have any good resources on developing multiplayer for games? Like structure, architecture, writting the server, classes...[/QUOTE] Valve has a great article on networking. [URL="https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking"]https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking[/URL] [QUOTE=Bladezor;39740286]Well, it depends on the kind of game you're going for. Most multiplayer games use a client/server architecture. That is, all the communication between the clients is delegated by the server. I'd look into documentation on how to send/receive UDP packets on your platform, then go from there. It's not terribly complicated honestly, you just need to think about what the server needs from the client and vice-versa. The way you go about sending and receiving the data, and how the data is packaged is pretty straight forward. So for example a packet from client to server to notify the server of the a player's apparent position could be packed like so: [code] 4 byte Protocol Identifier, magic number so you can easily identify that this packet is indeed for your game. 1 byte Packet Type, essentially the purpose of the packet and what it contains. 3 byte Player's position. [/code] That's the general idea.[/QUOTE] I do pretty much the exact same thing. Except instead of sending packets for every entity I just shove all the entity data into a packet and throw it at the client hoping it hits them. :v: I need to implement TCP for entity creation and removal as I said before though. Right now when the client receives a game update from the server it checks all of the entity ids in the packet to see if they exist, and if not it creates them. For removal the server checks to see if an entity needs to be removed and if so adds to the packet a indication for an entity id to be removed. This works well until a packet containing data for entity removal doesn't arrive to a client and a client side an entity isn't removed. So the entity is stuck there. With TCP for just entity creation and removal I won't have to worry about that though, since TCP is guaranteed to arrive, you get the idea of course.
[IMG]http://d.ezhik.me/public/facepunch/waywo/game/1.png[/IMG] So this is a game thingy I've been making with Love. So far it has some amazing features: You can create rectangles: [t]http://d.ezhik.me/public/facepunch/waywo/game/2.png[/t][t]http://d.ezhik.me/public/facepunch/waywo/game/3.png[/t] And bouncy balls: [t]http://d.ezhik.me/public/facepunch/waywo/game/4.png[/t][t]http://d.ezhik.me/public/facepunch/waywo/game/5.png[/t] And it has a charming main character, who can jump (though I really don't like the way he moves right now - is applying forces the right way for that?): [t]http://d.ezhik.me/public/facepunch/waywo/game/6.png[/t]
[QUOTE=Rayboy1995;39742637]Valve has a great article on networking. [URL="https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking"]https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking[/URL] I do pretty much the exact same thing. Except instead of sending packets for every entity I just shove all the entity data into a packet and throw it at the client hoping it hits them. :v: I need to implement TCP for entity creation and removal as I said before though. Right now when the client receives a game update from the server it checks all of the entity ids in the packet to see if they exist, and if not it creates them. For removal the server checks to see if an entity needs to be removed and if so adds to the packet a indication for an entity id to be removed. This works well until a packet containing data for entity removal doesn't arrive to a client and a client side an entity isn't removed. So the entity is stuck there. With TCP for just entity creation and removal I won't have to worry about that though, since TCP is guaranteed to arrive, you get the idea of course.[/QUOTE] I wouldn't mix TCP and UDP. What you need to do is implement packet acknowledgement and re-transmission. E.g. The client needs to send the server back "Yeah I got the packet" and if the server doesn't receive an acknowledgement, re-transmit that packet.
Just so you people know, TCP actually causes UDP to drop a lot of packets when they are used at the same time [url=http://www.isoc.org/INET97/proceedings/F3/F3_1.HTM]link here[/url]
[QUOTE=Bladezor;39742934]I wouldn't mix TCP and UDP. What you need to do is implement packet acknowledgement and re-transmission. E.g. The client needs to send the server back "Yeah I got the packet" and if the server doesn't receive an acknowledgement, re-transmit that packet.[/QUOTE] Yea I know how to implement it, and I figure it would be pretty easy. But I was worried I wouldn't do it as well and wanted to use something I know that works.
Am I doing it wrong if I use socket.io for a canvas game? It makes networking so much easier than other libs make it out to be.
More progress on my graphics coursework. [img]http://i.imgur.com/na3Xor8.jpg[/img]
Anyone remember the guy who posted a few months ago where he had implemented Awesomium in to HL2?
[QUOTE=Hypershadsy;39743639]Am I doing it wrong if I use socket.io for a canvas game? It makes networking so much easier than other libs make it out to be.[/QUOTE] That's perfectly fine.
[QUOTE=Bladezor;39740286]So for example a packet from client to server to notify the server of the a player's apparent position could be packed like so: [code] 4 byte Protocol Identifier, magic number so you can easily identify that this packet is indeed for your game. 1 byte Packet Type, essentially the purpose of the packet and what it contains. 3 byte Player's position. [/code] That's the general idea.[/QUOTE] Your header should be magic number, packet size, and perhaps a packet id. Determining packet size based on packet id (or reading it field by field) is a real hassle and just sending the packet size makes it so much easier to implement. For the actual packet content I would recommend protobufs if size isn't a big problem. Serialized protobufs are usually quite small, but you can get smaller by other means.
[QUOTE=ECrownofFire;39743149]Just so you people know, TCP actually causes UDP to drop a lot of packets when they are used at the same time [url=http://www.isoc.org/INET97/proceedings/F3/F3_1.HTM]link here[/url][/QUOTE] First of all, this paper is incredibly old and I think you misinterpreted it. They're not saying 1 TCP connection causes 1 UDP connection to drop a lot of packets. They did an analysis of the effect TCP has on UDP on the internet as a WHOLE (back in 1997 :dance:), so several orders of magnitude larger. Congestion is a very important issue to take into account, especially with TCP synchronization. If you think about a routing node, all the TCP packets are "guaranteed" to be delivered, so if the node's buffer starts to get full, packets begin to drop. In the case of TCP those packets will simply get re-transmitted, but UDP doesn't do this. [editline]28th February 2013[/editline] [QUOTE=dajoh;39745220]Your header should be magic number, packet size, and perhaps a packet id. Determining packet size based on packet id (or reading it field by field) is a real hassle and just sending the packet size makes it so much easier to implement.[/QUOTE] I didn't include it in that example simply because as long as the server knows the packet type, they know the size, with the exception of variable length packets. That packet isn't variable length.
Whoa I never knew about this, [url=http://vimeo.com/40595782]Visual Studio 11 Beta - Graphics Debugging[/url] The article [url=http://blogs.msdn.com/b/vcblog/archive/2011/11/08/10235150.aspx]here[/url] has some information on how to enable the graphics debugging, however, I don't see that option anywhere in VS2012. Do I need a special project type?
[QUOTE=Bladezor;39745960]Whoa I never knew about this, [url=http://vimeo.com/40595782]Visual Studio 11 Beta - Graphics Debugging[/url] The article [url=http://blogs.msdn.com/b/vcblog/archive/2011/11/08/10235150.aspx]here[/url] has some information on how to enable the graphics debugging, however, I don't see that option anywhere in VS2012. Do I need a special project type?[/QUOTE] Should be in Debug -> Graphics -> Start Diagnostics. It's great for debugging DirectX applications.
[img]http://puu.sh/29HMD[/img] I've been working on a weird tamagotchi thing with a pig called Piggu. One Game A Month has been quite difficult as a postgrad.
thats a clean pig
´ ▽ ` )ノ datta cleanu piggu*
[QUOTE=Mr_Razzums;39748466]thats a clean pig[/QUOTE] Pigs actually are very clean animals
[QUOTE=DrLuckyLuke;39749468]Pigs actually are very clean animals[/QUOTE] A misconception many people have because pigs are often seen to chill in mud and such
A lot of programmers took a course in pigology.
Been delaying for weeks because it seemed so daunting... but I finally sat my ass down and learned how to do matrix stuff. I want glTranslatef back :( [T]http://i.imgur.com/t8nr8di.png[/T]
[QUOTE=DarkCybo7;39749787]A lot of programmers took a course in pigology.[/QUOTE] and here I am taking biology. I'm so sad.
Adding fake-3D effects to Open Hexagon [img]http://sphotos-a.ak.fbcdn.net/hphotos-ak-prn1/884959_160990017388379_213144867_o.png[/img]
Sorry, you need to Log In to post a reply to this thread.