[BUG] Multiplayer ship purchase -> boom

Find any bugs in Vega Strike? See if someone has already found it, or report them here!

[BUG] Multiplayer ship purchase -> boom

Postby pheonixstorm » Sat Nov 26, 2011 10:26 pm

See tracker articles:
https://sourceforge.net/tracker/index.p ... tid=119507
https://sourceforge.net/tracker/index.p ... tid=119507

ace123 wrote:Buying ships is kinda a hack as it is. It has to do with the assumption
throughout vega Strike that 1 User = 1 Player/cockpit = 1 Unit. Changing
stats of an existing unit is not easy, so a new Unit is created to replace
the old one.

In single player mode, this is relatively transparent--you stay docked to
the base, and your Cockpit's "parent" unit starts pointing to the new

However, in multiplayer mode, this is made more complicated by the fact
that units have ID numbers (serial in VS terminology). When the units are
swapped, the server could choose to use the same logic as before--assigning
it even the same ID number, but then you'll get into serious trouble since
the Client will be out-of-sync.

The way we overcome this is to kill the ship on the client, and then
respawn, which loads a saved game--hopefully in the new ship. If you're
wondering why we don't just make a specialized message called "SWITCHSHIP"
or something, you're right--that could theoretically be added; however, it
would require duplicating some of the respawn/load logic anyway.

It does save before killing you, so you shouldn't lose anything, but when
you respawn, you *should* be in the newly bought ship.

I'm thinking when the ship is bought both ends need to know to update, w/o destroying the ship though.. maybe something along this line...
Code: Select all
if (purchaseship) {
get new id
send new id to client
while (noACK) {
resend new id to client

Code: Select all
get new id
updateID(new id)
send ACK

A crude rendition, but I hope everyone gets the point. I think VS suffers from a lot of these hacks. Could be why I keep hearing about the npc ships in multi.. the server doesn't know if needs to report the position of EVERYTHING that happens that relates to the client.
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
User avatar
Posts: 1567
Topics: 113
Joined: Mon Jan 25, 2010 7:03 pm

Share On:

Share on Facebook Facebook Share on Twitter Twitter Share on Digg Digg

Re: Multiplayer ship purchase -> boom

Postby pheonixstorm » Fri Mar 23, 2012 10:39 pm

I have been digging around on this one but have not created a solution. You can check out the current information we have on it on the forums

I updated the tracker page with a new comment:
found (I think) part of the offending code section. netserver.cpp 876. Best
guess is the client is doing the save and not the server. This hack has got
to be replaced...
Still looking into a design change here. As an afterthought to my post I'm not sure if its the client doing the save or if the server just fails to save, hence you fail to load back into your nice new shiny ship.

I'm thinking since the buy option is selected from the client then sent to the server the client should be updated locally after the server confirms you actually have the credits to buy the ship. Or something like this

client -> buy ship
server -> bought or not enough credits
client -> apply or discard new unit serial
client -> send unit serial to server with ACK request
server -> apply new unit serial and send ACK
client -> confirm ACK synch new unit serial before launch can proceed

Since its the client that has to update the graphics for the new ship I don't see why the server is handling more of the information such as allowing the purchase then sending the client all the details.

Well, just another idea
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
User avatar
Posts: 1567
Topics: 113
Joined: Mon Jan 25, 2010 7:03 pm

Return to Bug Triage

Who is online

Users browsing this forum: No registered users and 2 guests