Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
Arkantos

Avatar / Picture

Registered:
Posts: 481
Reply with quote  #1 
I have produced a single document that contains everything we know about the Artemis network protocol, which is now hosted at GitHub under the Artemis Nerds organization. This will be useful to people who are writing software that can communicate with the stock Artemis server or clients. If you discover new information about the protocol, find an error, or have other suggestions for improving the documentation, please submit an issue.
ivansanchez

Avatar / Picture

Registered:
Posts: 113
Reply with quote  #2 
I need to have a proper look at it, but it looks great so far :-)
__________________
Need more bling for your bridge? Try out Artemis-Glitter today!
Arkantos

Avatar / Picture

Registered:
Posts: 481
Reply with quote  #3 
In the change you made to the documentation, you mention that in object updating packets (type 0x80803df9), it is possible to have different object types in the same packet. While the packet structure theoretically allows this, I don't believe that the Artemis server ever actually does it. In fact, ArtClientLib has been designed to not allow this specifically because it appears that the server never does. Have you ever tested whether the stock Artemis clients actually accept and properly handle mixed-type update packets?
ivansanchez

Avatar / Picture

Registered:
Posts: 113
Reply with quote  #4 
Quote:
Originally Posted by Arkantos
you mention that(..) it is possible to have different object types in the same packet. While the packet structure theoretically allows this, I don't believe that the Artemis server ever actually does it.


Oh yes it does. Specially when pushing a bunch of nebulae, asteroids, or mines.

Some time back in the past, a lot of my tests showed only 1 out of every 20 (or so) mines/asteroids/nebulae. If I recall correctly, space stations are also chained together (I had quite a bit of trouble with this in particular when refactoring node-asbs-lib).

__________________
Need more bling for your bridge? Try out Artemis-Glitter today!
Arkantos

Avatar / Picture

Registered:
Posts: 481
Reply with quote  #5 
Let me make sure I'm clear: you're saying not only that a single packet can contain multiple object updates, but that it can contain updates for multiple types of objects (e.g., a single packet might contain 4 nebulae, 20 asteroids and a space monster). Is that accurate? I've seen the former happen all the time, but not the latter. ArtClientLib would definitely barf if that occurred, and it hasn't (not for that reason, anyway). Granted, I haven't updated ArtClientLib for 2.1.5 yet; maybe it only happens in that version?

Now, even if Artemis doesn't do this, I think it should. The practice of segregating packets by type results in some packets being rather sparse. Allowing mixed-type update packets would pack them more efficiently and reduce overall network traffic. This would require me to refactor ArtClientLib so that all the various object update packets are consolidated into a single update packet with different parsers for the various object types. I'm totally willing to do that, but I'm not going to go through that effort unless it can be demonstrated that Artemis actually does produce mixed-type object update packets.
ivansanchez

Avatar / Picture

Registered:
Posts: 113
Reply with quote  #6 
Quote:
Originally Posted by Arkantos
you're saying that a single packet (...) can contain updates for multiple types of objects (e.g., a single packet might contain 4 nebulae, 20 asteroids and a space monster)?


Hmmmm. I'm not sure if I've ever encountered such a packet, but I certainly coded asbs-lib assuming that the server might mix subtypes. And, to say the truth, right now I'm not in the mood to run benchmarks against 2.1.5 to see if the server really does that.

__________________
Need more bling for your bridge? Try out Artemis-Glitter today!
Dave Thaler

Registered:
Posts: 563
Reply with quote  #7 

MainPlayerUpdatePacket says: "The payload consists of an array of ship entries. Parsing continues in a loop until the end of the packet is reached, or the object type byte is 0x00."

The same is true for EngPlayerUpdatePacket and WeapPlayerUpdatePacket.

User McUser

Registered:
Posts: 125
Reply with quote  #8 
Looks like 2.2.0 dropped. I am curious as to what changed...

Biggest changes from the changes.txt are new monsters, anomalies are now upgrades, and a new type of torpedo.

http://artemis.forumchitchat.com/post/artemis-2-2-0-crash-bug-7463120?pid=1287572854
http://www.artemis.eochu.com/Artemis_Upgrade_v2_2_0.exe
Arkantos

Avatar / Picture

Registered:
Posts: 481
Reply with quote  #9 
So we've documented a lot of the protocol changes in 2.2.0 here, but one thing that still eludes us is the format of the upgrades packet (0x80803df9 subtype 0x04). So I'm calling on the Artemis geeks to see if we can figure out the format of this packet. Here's what we know:

We know that this packet tells the client what upgrades the ship currently has. We know it has a bit field that is 11 bytes long, which is enough room for 88 properties (although the last four bits of the field appear unused), but even with all of the bits turned on, the packet only contains 29 properties, all 4 bytes long (probably int values corresponding to upgrade counts). Of those properties, 28 would correspond to upgrades (since there are 30 upgrade types in total, but two are used on pickup, so you can't carry any), leaving one unknown property.

Of the upgrades themselves, we know the list, as it's displayed in the Upgrades screen in the client. Adding the two upgrades that are used on pickup to the top of the list, they are:
  • HiDens Power Cell (on pickup)
  • Vigoranium Nodule (on pickup)
  • Infusion P-Coils
  • Hydrogen Ram
  • Tauron Focusers
  • Carpaction Coils
  • Polyphasic Capacitors
  • Coolant Reserves
  • Lateral Array
  • ECM Starpulse
  • Double Agent
  • Wartime Production
  • Infusion P-Coils PERM
  • Protonic Verniers
  • Tauron Focusers PERM
  • Regenerative Pau-Grids
  • Veteran DamCon Teams
  • Cetrocite Heatsinks
  • Tachyon Scanners
  • Gridscan Overload
  • Override Authorization
  • Resupply Imperatives
  • Patrol Group
  • Fast Supply
  • Vanguard Refit
  • Vanguard Refit
  • Vanguard Refit
  • Vanguard Refit
  • Vanguard Refit
  • Vanguard Refit

Of these, we know the enumeration values for eight of them, which are the only ones available from anomalies in the game (and thus the only ones where we actually know what they do:

0 HiDens Power Cell (on pickup)
1 Vigoranium Nodule (on pickup)
2 Cetrocite Heatsinks
3 Lateral Array
4 Tauron Focusers
5 Infusion P-Coils
6 Carpaction Coils
7 Double Agent


As the order of these items doesn't match the order in which they appear in the game client, we can't assume what the enumeration values are for any of the others.

We could reasonably guess that either the very first value after the bit field is the unknown property, or that it corresponds to the number of Cetrocite Heatsinks on board. And that's pretty much all we know at this point.

What we need to know:
  • Why do we have such a wide bit field for so few properties?
  • What is the unknown property? Does it come at the beginning or the end?
  • What are the enumeration values for the remaining upgrades?
Arkantos

Avatar / Picture

Registered:
Posts: 481
Reply with quote  #10 
Okay, so I've learned a few things. The bits for the six known upgrade types that aren't used immediately on pickup are all found in bytes 4 and 5 of the bit field:

Byte 4
  1. ?
  2. ?
  3. ?
  4. ?
  5. Infusion P-Coil
  6. ?
  7. Tauron Focuser
  8. Carpaction Coil
Byte 5
  1. ?
  2. Cetrocite Crystal
  3. Lateral Array
  4. ?
  5. Double Agent / Secret Code Case
  6. ?
  7. ?
  8. ?
The server periodically sends the values of all 84 fields. If you hold one of each of the six upgrade types listed above, you get an update that looks like this:

ff ff ff ff ff ff ff ff ff ff 0f
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 01 00 01 01
00 01 01 00 01 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00


So at least up until bit 5.5, every property is a single byte long. However, the bit field is 11 bytes long, yet there are enough bytes in the rest of the payload to require a 15-byte bit field if every property was a single byte. There are 32 bytes unaccounted-for in the payload.

Also, there are extra bytes when the ship picks up an upgrade. For example, this is what you get when you pick up a Tauron Focuser:

00 00 00 40 00 00 00 00 00 00 00
01 00 00 00 00


Four extra bytes at the end. Why? This packet doesn't seem to make much sense.

Anyway, the information above was enough for me to code changes to ArtClientLib that can successfully determine how many of each of these six upgrade types the ship has in storage. I suppose that's enough for the moment, as the rest doesn't appear to ever be used. ArtClientLib will assume for now that every property is one byte long, and any remaining bytes are ignored.
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.