• 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
Tereth

A "What's Next" Networking Question

8 posts in this topic

I'd like to preface this with that statement that I am not a Computer Science wizz. I'm a biochemist. So, please forgive my layman understanding of programming. Despite not being in a programming profession (I only write easy bioinformatics programs for work) , when I'm not in the lab I program in all of my free time! In particular, I love to program games. This summer I went a little crazy with the game making and made just a ton of different games. Some classics and some originals. I quickly realized that the next step would be to learn how to program a multi-player game.

I contacted one of my friends, an electrical engineer, about how to program a multi-player game and he told me to look into sockets. So, I found a few tutorials on socket programming (using java.net.* and java.io.*) and within forty five minutes I had a server and a client program. The server parsed input streams regarding character movement and reported them to the other clients. I could open up a few local clients and they would all show the main character from each of the clients running around. After a solid few seconds of fist pumping I sat back down and looked over the code to try and figure out what was really going on.

I realized, hey there's no place in this code where the client connects to the server on a non-local connection!

connection = new Socket(InetAddress.getByName("localhost").getHostName() , port #);...is not going to find a server on another computer over Al Gore's greatest invention!

It occurred to me that maybe I could just hard code the TCP/IP address into the client, but I know for a fact that my internet connection has a dynamic IP address, so no way that would work. This is not my area or expertise and I'm sure I'm just a google search away from a solid tutorial or explanation, however, I haven't been successful in finding a good answer. It reminds me of a student asks me what the pI of a certain protein is, after they have failed to figure it out for hours. My gut reaction is, "are you kidding me? It takes 5 minutes to figure that out." But then I remember that they don't have the tools and experience to even begin solving the problem.

So, my question is, what's next? What is the recommended way to get a client to connect to a non-local server using java.net.*?

By the way, I read through the article "Get Answers to Your Questions!"->Forum FAQ, Q0 is the best! I laughed so hard!
0

Share this post


Link to post
Share on other sites
There's no way to connect if your address is dynamic. You need something static. The only thing that comes to my mind, use free website host or file host that allows direct linking (Dropbox for example), store .txt file that contains your current IP address. Client program could automatically load the page, copy address and connect to it. But you'd have to change it manually everytime your IP changes (unless you make another tool which would do that automatically).
1

Share this post


Link to post
Share on other sites
There are services that provide dynamic dns lookup. This means that you install a little program that informs a server of your current ip address. It then routes the registered "domain" to that address. So basically, even though your actual IP changes there is a static hostname that will be updated whenever your IP changes.

There are several free providers for this kind of thing. One of the first ones (I think) was dyndns which I used for quite a while. There you registered a name (e.g. DontReferenceMyPointer.dyndns.com) and that one always pointed to your current IP address. However, looking at their website they don't offer a free service anymore. But I found a list of free provider: [url="http://dnslookup.me/dynamic-dns/"]http://dnslookup.me/dynamic-dns/[/url]
1

Share this post


Link to post
Share on other sites
You should look for a dynamic ip service (I use no-ip - www.no-ip.com - for teamspeak / hobby games, it is free for non-commercial use).

If you are using a router, you can connect to it (moslty 192.168.0.1) and check if it provides a dynamic ip option. If it does, you can easily config it (mostly it will show a list of services it can interface with) by entering your username/password in the given provider.
If it does not you will need to download a program and install it, your pc will then inform the server of your current ip and it will redirect your domain to your new ip.

Also, if you are using a router, you will need to create a mac binding (so your pc will always have the same ip inside your local network) and then create a virtual server that will map the requests for your router to your pc.

Those are the very basic steps you need to follow, you can find very detailed tutorials on your chosen dynamic ip provider's site.
1

Share this post


Link to post
Share on other sites
Wow this is definitely another one of those situations, where I ask a question and I realize I may not even have the tools to understand and implement the answers!

But here's what I got from the answers (-) and my response and/or follow up question (+):

-(Ripiz) I need something to anchor my server or for my server to publish an IP calling card so that the clients can find it.
+It seems like writing to a *.txt file in a dropbox every loop through the server and having the client constantly check the dropbox to see if the server has changed may be suboptimal and error prone. (I know how to write to the dropbox, but I would have no idea how to make a client read from a dropbox on another computer.)
+Is it possible to have a server listen and create sockets through something constant like a web address? Or, is that totally unreasonable?

-(brx) I can register with a website that will report to my client the server operating machine's IP address.
+This sounds pretty promising, however, are there any security issues with this (the site says "secure" but I'd rather know an outsider's opinion) and can this be implemented into java (I don't understand how the new IP is reported to the client without writing code to do so in the client)?

-(KnolanCross) I need to expand my knowledge of IP and routers (which I am learning is even more limited than I thought.)
+I'll read through some dynamic IP tutorials and see if this helps solve my puzzle.

Thank you for all the replies! Please let me know if you find a serious error in my understanding or if you think I would benefit from reading some other materials!
0

Share this post


Link to post
Share on other sites
This is also answered in the FAQ, which says you need a name to look up through DNS, and suggests using dyndns.org or similar to establish and update a name for your dynamic IP.
If you're new to network programming, I suggest you skim the FAQ, because it contains both help for newbies, as well as help for more advanced programmers, and when you get to a particular problem, you may then remember some question from the FAQ, and can go back and look it up there!
2

Share this post


Link to post
Share on other sites
[quote name='hplus0603' timestamp='1350583109' post='4991499']
This is also answered in the FAQ, which says you need a name to look up through DNS, and suggests using dyndns.org or similar to establish and update a name for your dynamic IP.
If you're new to network programming, I suggest you skim the FAQ, because it contains both help for newbies, as well as help for more advanced programmers, and when you get to a particular problem, you may then remember some question from the FAQ, and can go back and look it up there!
[/quote]

I do remember reading that, however, I don't think i understood what I was reading, so I didn't make the connection. I'll go back through the FAQ again now that I have better understanding of what I am looking for. Thank you!
0

Share this post


Link to post
Share on other sites
Not wanting to overlook Occam's Razor, if you just need a way to specific the IP address your server is running on, you can add a paramter to the client that accepts the IP address and port of your server, or, provide a method for the user to enter the IP address once the client has started.

Although, I think you're looking for the dynamic DNS solutions, I just wanted to make sure.
1

Share this post


Link to post
Share on other sites
There is an easy way, you can post your server IP in BBS or your blog, users can access the website and get server IP for login.
No need to change your codes except inputting the server IP in client login UI. Edited by Eric Wu
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