Networking code testing and development

Development directions, tasks, and features being actively implemented or pursued by the development team.
Post Reply
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Networking code testing and development

Post by ace123 »

To set up the networking:
Go into the folder, data4.x/accounts.

This holds "test1.save" and "test2.save".
Open these up, and change the last three numbers to change the starting position of the two players.

Next, look at vegastrike.config.

If you want each player's cockpit to print out your position and where it thinks the target is:
In the "hud" subsection of "graphics", add:

Code: Select all

<var name="debug_position" value="true" />
In order to be able to log in to the account server:
Now, go to the "player" section:

change the "callsign" variable to "test1" or "test2".
Make the "password" variable the same as callsign.

everything else should be fine as it is.

Compiling the source:
It should all compile nicely from CVS without any extra...
Please tell me if there are any compile errors.

Where things are:
In accountserver.cpp and vegaserver.cpp in the toplevel src directory:
These initialize the time and the classes.
The setNewTime(time()) was to make sure that all clients are on a pretty close time. We need a good algorithm to get clients' time to be really close to the server time, and right now it doesn't transfer any time to the clients, so I did this to get them the synced up.

In the networking folder:
The lowlevel stuff is not too important to modify -- most of it is UDP/TCP packet sending code and other lowlevel netwroking stuff.

In the main networking folder, the files likely of interest are:

Client-Side:
netclient.cpp (Packet handling function)
netclient_clients.cpp (position updates)

Server-Side:
netserver.cpp (Packet handling function)
netserver_clients.cpp (position updates)

Interpolation: This still needs some work.
prediction.cpp (CubicPrediction and LinearPredition)
-- Initialized at top of client.cpp.
-- We want to use MixedPrediction (Linear for turning -- Cubic spline wrongly does no turning interpolation at all, which is definitely wrong!)
-- The LinearPrediction appears to work, but changing this to Mixed causes strange moving around sometimes.
cubicspines.cpp
-- Algorithm (defined in cubicsplines.h): Set to SPLINE_METHOD2.

Now, on to debugging code:
I recomend running two copies at once on one computer (unllss you have a good graphics card, I recommend lowest settings for graphics (and definitely turn off full-screen).

Also, I recommend pre-defining the resolution in the config file rather than resizing which makes things slower the more you resize. I tend to use long horizontally, but skinny vertically, windows so that I can have two windows on the same screen.

To run two copies at once, you have to change the username/password back and forth from test1 to test2 between starting up each instance, because two copies can't run off only one network player. (VS Reads the config file pretty early in the loading cycle, so by the time it opens a wihndow it definitely has read the config.) I just leave the config file open so I can change the username.


Urgent issues:
  • Cubic-spline Interpolation doesn't work all the time
  • Firing guns
  • What happens when someone dies
  • Increase position update time (right now, it updates irregularly)
  • Make it work better or at all on windows.
Please tell me your experiences with using networking version, or if you need help finding your way around the code). I would be glad to help anyone on coding multiplayer.

I might put some of my ideas on multiplayer implementaion-related stuff on a wiki page.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Networking code testng and development

Post by klauss »

ace123 wrote:I might put some of my ideas on multiplayer implementaion-related stuff on a wiki page.
On comments, please.
I do it often, and it worked great on commands.cpp: choose a header to fill up with architectural/implementation comments, usage examples, etc.

If I find the time, I'll test in on Windows. I did quite some network programming on windows, and I tell you, it sucks big time (the sockets don't behave as they were documented - suckers). So, if it's lowlevel networking code where you're having trouble, perhaps I can help. If it's another thing, we'll see.

Oh... and I noticed strange moving in single player at times too, so perhaps it's not a multiplayer issue. Perhaps it's not quite noticeable with linear interpolation, but it's there as well. I'm trying to fix it, but can't find the reason for that odd behavior: things go back and forth, as if the interpolation factor was getting off the [0,1] range and warping around - but it shouldn't do that in any case, as it gets clipped to that range. So it makes no sense. It started happening with the new physics queue.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
hurleybird
Elite
Elite
Posts: 1671
Joined: Fri Jan 03, 2003 12:46 am
Location: Earth, Sol system.
Contact:

Post by hurleybird »

Cool, nice to see progress is being made on the network side.
v29a
Star Pilot
Star Pilot
Posts: 4
Joined: Sat Feb 19, 2005 2:39 pm

Post by v29a »

does that mean we are finally going mp? wohoo :)
keep it up 8)
zbyszanna
Hunter
Hunter
Posts: 83
Joined: Tue Sep 13, 2005 3:49 pm
Location: Poland

Post by zbyszanna »

Few questions.

1. What is vsserver?
2. What is vsacctserver?
3. Which is a mulitplayer game server? Both?
4. How exactly do you run multiplayer? Do you need to launch 1. or 2. and then the game will automatically connect to the server?

5. Can anyone post valid project file for 1. or 2.? I use Code Blocks that can import VStudio projects, but vega-vc7 projects are outdated and have many unexisting dependencies. Guessing which files are missing reading "unresolved external symbol" messages is rather tedious work.

6. vegastrike in Data4x doesn't work well. VS 0.4.3 works fine and Data4x version doesn't like higher than low quality effects (Radeon 9200 - will try newer drivers, but 0.4.3 works fine with the same drivers)
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

I think it's only been tested in linux so far...
you'd need to modify the windows projects to link in all the networking files as I remember--should work once that is done--- I think the VC6 project has some of the networking projects---I'll have to ask ace123
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

What I do when projects are outdated, is to start dropping in the files listed in makefile.am. That works, although it's quite some work. I would go makefile by makefile looking at the list, and if anyone is missing, include it. You only have to do it once, after all.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
zbyszanna
Hunter
Hunter
Posts: 83
Joined: Tue Sep 13, 2005 3:49 pm
Location: Poland

Post by zbyszanna »

Compiling this code under windows outside cygwin needs rather drastical code reorganization (no fork, waitpid, mkstemp, mktemp and so on). Is current version of vsserver going to be final? I mean is there any plan to reorganize it, or will it just be developed as it is?

EDIT: Aaaaargh!
legine
Bounty Hunter
Bounty Hunter
Posts: 139
Joined: Mon Sep 27, 2004 8:40 am
Location: Germany
Contact:

Post by legine »

Uhh, do I understand it right that the networkcode runs on Linux only? :?

Can't we try to, hmm, move to a develop method that basicly runs almost out of the box for all OSes we support? Dont want to blame just suggesting what I think is the only way to develop on a complex game like VS is getting (or is already)
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

Networking support does in fact work in windows. (That last post was back in October 2005)

However I would be very interested if you can compile it on windows with a standard checkout (I always hack at things to get them to compile so I never know if it works out of the box).

I have gotten the game to run on windows, but I don't think anyone else has.

If you want to be the first one to test it except me, look at this wiki page:
http://vegastrike.sourceforge.net/wiki/ ... rk:Testing

I would be glad to hear your step-by-step progress on getting this working. If you run into any sort of error, please post somewhere (in this thread or in a new thread) or Private Message me and I will look at the problem.

It does in fact run on Mac as well, last I tested about a year ago, and so it should still work there since most of the code is cross-platform.

However there is one long-term problem -- the build script for linux depends on OpenGL, and links the server to it, so I will have to look at making it not require GL/SDL. Shouldn't be too hard since Windows doesn't require OpenGL and SDL for the server.
This shouldn't be a problem for most people, but if we intend on getting VS running on an actual Linux server (without a GUI) then this would help.

Anyway I would be really interested in seeing how getting network running works out!
legine
Bounty Hunter
Bounty Hunter
Posts: 139
Joined: Mon Sep 27, 2004 8:40 am
Location: Germany
Contact:

Post by legine »

Hmm will put it on my List for things I want to do.
Ontop of things I want to do is Piarmada for Linux, followed by some research about optimizing compiletimes by only compiling necessary code instead the hole app over and over again. (In an automated fashion).

Afterwards I gladly see if I get the code compiled on Windows, well hope it compiles on wine. Thats the best working Windows I own. :D
wirser
Bounty Hunter
Bounty Hunter
Posts: 201
Joined: Wed Dec 01, 2004 8:06 pm
Location: not where i want to be

Post by wirser »

well I got it working and froze it up when I tried to jump in th astroid feild. I only had one player running at time
there seem to be a bug in radar , the only thing I could get was astroid feild even thoughh radar showed other "bogies"
if current_situation=fact and if current_situation=faith
then current_forcast = excitement
Halleck
Elite
Elite
Posts: 1832
Joined: Sat Jan 15, 2005 10:21 pm
Location: State of Denial
Contact:

Post by Halleck »

Just reporting that I got this working with ace123 and jackS.

Here's what I had to do:
  1. Register an account as described in this thread. (scroll down)
  2. Compile vegaserver.
  3. Edit the "accountsrv" entry in vegaserver.config so it reads:

    Code: Select all

    <var name="accountsrv" value="http://vegastrike.sourceforge.net/cgi-bin/accountserver.py"/>
    (Unless you want to run under a 'mod' by appending ?modname to the URL, in which case you have to register under one as well by doing the same to register.py. Currently, I think 'test' is the only mod.)
  4. Use part or all of the config it generates for you (I used the whole thing with almost no problems.) Make sure that server_ip is set to "127.0.0.1" (localhost) if you want to play on your own vegaserver. If a second player wants to connect to your machine and it is configured as a server (with an external IP, or behind a NAT set up with port forwarding), have them put your IP address in this field.
  5. Start vegaserver on the host machine. It should connect to the accountserver running on sourceforge.net, although it's possible to compile and run your own (I haven't tried this successfully yet.)
  6. Start up your clients like so:

    Code: Select all

    vegastrike --net
If all goes well, that should work!

(Also, I updated units.csv on the accountserver so people using it should be able to play with current units.)

UPDATE: Wikified these instructions at Development:Network:Testing#Playing with the Sourceforge Account Server
Mets
Mercenary
Mercenary
Posts: 115
Joined: Tue Jun 10, 2008 12:52 am

Re: Networking code testing and development

Post by Mets »

Is there any work still happening on this area of the game?
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Re: Networking code testing and development

Post by chuck_starchaser »

Nope.
The original developers moved on to another project (Sirikata), an the few of us trying to keep this project alive have other priorities (graphics, sound, ai and code clean-up/refactoring).
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Networking code testing and development

Post by ezee »

Hi !

I just want to share a link to OpenNetGame lib :
http://www.opennetgame.org/index.php/Getting_Started
What Does OpenNetGame Do?

When a player wants to play a game with other players on the internet or on the local network, they must connect to a remote peer. Be it a server or just another player hosting a game. The availability of a networked game needs to be advertised to all potential players. Once the player has a selected a remote peer to connect to, the game must connect to the host serving the game and additionally, in the case of pee-to-peer communication, other players. NetGameTrack takes care of advertising the availability of servers hosting a game. NetGameConnect takes care of connecting players to the host and to each other.
May be an alternative for future dev ?
I already played with their tutorial , functionnal :
NetGameConnect_Tutorial

online doc :
http://www.opennetgame.org/api/NetGameTrack/
http://www.opennetgame.org/api/NetGameConnect/

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
Post Reply