开发者

A newbie question I have to ask, beginning network programming for games?

I'm an absolute newbie in this field and I'm kind of frightened of heading down the wrong path of network programming. I'm trying to build a strong network library for my game engine.

I've looked online and have seen there is a network library with 开发者_高级运维boost, I'd love to use that as I'm really keen on further integrating it with my codebase. But I'm wondering, how would I code and debug such a thing? If I only want to develop on one PC how can I emulate a network environment with a dedicated/peer server and x number of players connected to it?


You can simply start many processes on a single PC.. You can use networking locally (127.0.0.1). Or you can use Virtual Machines.


You'd have to run the server on your machine and run x copies of the player code.

You can then either debug the server or one of the players.

This won't simulate things like network lag and dropped packets, it will allow you to test the interactions and to a certain extent how your system behaves under load.

There are tools you can get that will simulate network lag etc., but that will usually cost you money (as this one does), but there will be some free alternatives out there.


I think the approach which brings you the closest to real conditions is to set up virtual machines which connect to your server, which runs on your actual machine.


If you just need to confirm that your game is successfully connecting, I would go with installing multiple virtual machines and having them all in NAT-mode, so that each one receives a unique IP from your DHCP server. If you actually have control over your router, you could even go the extra step of setting up a dedicated IPs for each Vmachine's MAC address, so that you can log which IP address is giving you a problem and correlate it to which machine. With a little bit of effort (and some Hackintoshing), you could even extend this set up to do OS-based testing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜