• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
robert_j_porter

reliable UDP(I'm going in circles...)

3 posts in this topic

So I'm trying to have 2 players on a LAN find each other so that they can play a LAN game together. So I am broadcasting UDP, but I'm going around in circles trying to make it reliable. Sorry if my logic is a little confusing, let me know if something isn't clear. It's not 100% clear to me, hence the question. I'm sort of new to network programming, so I think I'm just missing something basic.

 

My algorithm that I have come up with is something like:

 

When a network game is started, continuously broadcast a search message at a regular interval. the search message contains the IP address of the sender.

 

At the same time listen for the opponents search broadcast.

 

Also listen for the opponents ACK message.  

 

When a search broadcast is received, send ACK messages until an ACK-ACK is received.

 

When I receive a ACK message, I can stop the search broadcast and send back an ACK-ACK.

 

Now my problem is how do I know when the opponent has received the ACK-ACK? The opponent can't stop sending ACKs until they receive the ACK-ACK, since they don't know if I've gotten the ACK yet. Obviously making a chain of ACK-ACK-ACK-... messages isn't going to work. If I am just on a Lan, everything should be pretty reliable, so should I just send 2 or 3 ACK-ACK messages a little spaced out, sleep for a second before I start the game, and assume that they got them, and just fail when I get a socket error later or something?

 

I think I'm just going to change my code to broadcast a UDP search message and send and listen for a TCP ACK. This way my problem is kind of solved. But really I'm just curious as to why I can't seem to figure out reliable UDP.  

Edited by robert_j_porter
0

Share this post


Link to post
Share on other sites

So I think a reliable UDP implementation is a little bit of overkill here, and developing a new one is pretty hard.  I think the confusion you are having is due to mixing a couple of concepts: finding each other and connecting.  Why don't you setup the broadcast to broadcast a UDP message with the ip address of the sender and it's port that it's listening on for data, which is a different port than what they are broadcasting on.  Then in the other machines, when they get this "beacon" message they know there is somebody out there that they need to send data to and just keep a list of peer applications to send data to, no need to really "connect."  If you want reliable, you could use the UDP broadcast to beacon the server and then use TCP to connect clients to the server on the ip/port that the server put in the beacon message.  

 

My overall advice is to get something working, even if it's TCP and then address it IF it becomes a bottleneck.

 

Again, this all only will work on a LAN because UDP broadcast typically doesn't get past routers.

 

Cheers, 

 

Bob

0

Share this post


Link to post
Share on other sites
You really don't need "ack" and "ack-ack" to be separate packets. At the point where you get an "ack" from the other end, you know that the other end knows about you. Thus, just wait on either end until you get an ack from the other end. Tie the other ends together using a hash table based on IP address and port. If you receive a "solicit" from an IP:PORT that you already have received an ACK from, then just send another ACK.

Also, if "hosting/serving" is separate from "joining," it's usually better to have each new player send a broadcast once a second, and have the servers listen for broadcasts and reply with "I'm a server" messages, than the other way around. That way, a server that's started and stays up, won't use network bandwidth when nobody wants to join it.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0