Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


viper110110

Member Since 11 Nov 2008
Offline Last Active Nov 20 2014 04:31 PM

Posts I've Made

In Topic: Need a short name to replace a really really long function's name

19 November 2014 - 11:10 AM

I think long function names are generally a good thing as they are more descriptive. As long as you have some sort of autocomplete, you shouldn't have to type it all out, and most nowadays support just typing the initials (SPBOCP). If you are looking to reduce the length of the names, think about what information is implied by the function parameters and return type.

 

If I have a function

public List<Friend> GetListOfFriendsByID (int id)
{
    //Return new list with my friends
}

I can see that it clearly returns a List and I can clearly see that I am passing in an id. I can now shorten the name to

public List<Friend> GetFriends (int id)

In Topic: Choosing a port

08 October 2014 - 07:08 AM

client = new UdpClient();

Well, that was easy. Thanks.


In Topic: Choosing a port

07 October 2014 - 01:36 PM

 What about just trying out ports until you find one?

Do you mean in code or by hand? The problem with doing it by hand is that it sometimes takes a while to show up. I've been using 10123 for a few months now without issue and only today did it become an issue. I tried restarting and everything else that would clear it out if I still had it open. I could do it in code but I won't personally know which port it is, and I'm not sure if that could cause issues.


In Topic: Choosing a port

07 October 2014 - 01:22 PM

Is this TCP or UDP?
For TCP, you should not bind the client explicitly. If the client calls connect(), then let the OS pick a port for you.
So, a server is something that calls bind(), listen(), and accept(). A client is something that calls connect().

 

This is UDP. Server opens itself on 10124 and waits for stuff to come in. Client opens itself on 10123 and then connects to 10124.


In Topic: UDP Multiplayer Movement Jitter.

25 September 2014 - 12:08 PM

I think what you would be looking for is a very simple incrementing ID system. Basically, when the server sends out an updated position, the first time it will have an ID of 1. Then the next time it is 2. 2 is greater than 1, so we can update our client based on the new position. Then the server sends out packet 3, but it never reaches the client. Then the server sends out 4, which reaches the client. 4 is greater than 2, so update the position. Then 3 manages to find its way to the client. 3 is not greater than 4, so ignore it.


PARTNERS