22
Cyanite
7y

I just spent 20minutes "debugging" my game because i was trying to connect to '117.299.38.69'(in-game IP)
When i was supposed to be connecting to '177.299.38.69' and I couldn't figure out why the IF statement was saying it wasn't in the global list of IPs.. I even checked the two IPs side by side and STILL didn't notice they were different..

Comments
  • 14
    .299. ?
    My bits are screaming
  • 4
    @Kimmax It's randomly generated lol
    What should the limit be then? (minimum and maximum)
  • 6
    @Cyanite every ip address's octet (a number between the points) is 8bit long, so the range goes from 0-255.
    But there are reserved ips too, like the network id, but that depends on the subnet. Can be easily calculated by an AND tho.
  • 5
    @Kimmax I did not know that. Thank you, I will edit my code promptly. ^~^

    Anything else I should know about IP generation? (these won't be real IPs obviously, just in-game "systems")
  • 5
    @Kimmax Huh.. '.299' is actually a bug. My current max is 230. I'll need to look into that.
  • 4
    @Kimmax pfft. Nvm. I'm just an idiot. The IP i was debugging had '.229' not '.299' lol
  • 6
    @Cyanite there a few reserved private blocks for private networks that shall not be routed publicly (eg not accessible over the Internet), so use 10.0.0.0/8, 169.0.0.0/8 or 192.168.0.0/8 when representing a private network and don't use one of these addresses when they should be reachable over the Internet.
    Ip addresses are a whole own world in the networking part if today's tech, so you may want to read how they work if you want a realistic game
  • 4
    @Kimmax I tried looking up how they work, but didn't find anything useful.

    Probably just looking in the wrong places.
  • 3
    @Kimmax If you're interested, would you mind helping me build a cheat-sheet?

    A.B.C.D (IP)
    A should never be *this*
    D isn't usually over *this*

    I would really appriciate it, and would happily put your name/user + a link in my source (my game is open-source) above the generation function for everyone to see. ^~^
  • 2
    Just use 192.168.c.d, thats your local network
  • 3
    @Cyanite how 'realistic' do you want it? *.0.0.0 should be a country 'code' if i remember right but its been a long time but for 0.0.0.* it should never be 0,1, or 255
  • 3
    @RazorSh4rk The other "systems" wont be on the same "network"
  • 3
    @jckimble i'm not worried about country codes (yet) just tell me what values each position CANT be, and that'll be good enough for now. If it would be easier for you, I can provide my email.
  • 3
    @jckimble I just want to fool average people who are not expected to know the exact meaning of an IP address. It just need to 'look' legit.
  • 2
    @Cyanite yeah i understand
    https://en.m.wikipedia.org/wiki/...

    This should give you a full list of ips that wouldn't be public. I would block 8.8.8.8 or 8.8.4.4 since its googles dns also but i would make them and 127.0.0.1 easter eggs myself
  • 3
    @jckimble Thanks. What about averages? Like.. How often are values really low/high? For example: The minimum value for an IP section in my game is 30. Is that okay?
  • 2
    @Cyanite as long as its not 0,1,or 255 its fully random.
  • 2
    @Cyanite but yes thats fine
  • 3
    @jckimble Well, thanks alot for your help. Would you like to claim that reward I had mentioned?
  • 4
    @Cyanite naw its fine. Pay in forward. If you see someone that needs help, help them.
  • 4
    @jckimble Thanks again for your help. ^~^
  • 0
    Why not use IPv6 addresses?
  • 0
    @osmarks not all people have ipv6
  • 0
    @c3ypt1c This is for a game, so it doesn't matter.
  • 0
    @osmarks even in a game ipv4 would be better as it is more aesthetically pleasing at least in my opinion.

    Plus, I don't think there is going to be millions and millions of devices so i would say keep ipv4 for the game. c:
  • 0
    How are you doing networking or programming at all and not knowing the upperbounds of an IPv4 address????????????????? Did you do any sort of education
  • 2
    @KeirDavis1 Self tought.
  • 2
    @c3ypt1c You will be typing out thousands of them.
  • 1
    @Cyanite can we have a repo link?
  • 2
    @Kimmax On my profile.
  • 1
    Looks like youre having trouble maybe I will be winning the contest
  • 0
    @itzyzex
    Having trouble? This is an old post for the Python version of my game.

    I'm setting up my game store page on http://itch.io atm.
    ;3
  • 1
    @Cyanite ahh hahhaha alright you using unity?
  • 0
    @itzyzex
    No, i'm not using an engine. Just coding from scratch.
  • 0
    oh shit. took me a couple of minutes to find the error too
Add Comment