Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0xf754c8fe:0x08 Unknown #150

Open
NoseyNick opened this issue Apr 8, 2018 · 20 comments
Open

0xf754c8fe:0x08 Unknown #150

NoseyNick opened this issue Apr 8, 2018 · 20 comments

Comments

@NoseyNick
Copy link
Collaborator

NoseyNick commented Apr 8, 2018

So c'mon, this one deserves a ticket and deserves some research:
simpleEvent:0x08 has been seen hundreds of thousands of times in our captures.

Looks like:

Packet type 0xf754c8fe = JamCRC("simpleEvent")
Packet Subtype 0x08
Unknown float (usually 50.0, or 100.0, sometimes 0.0?)

The docs say "Has been hypothesized as having some relation to SoundEffectPacket", and indeed DOES often come BEFORE OR AFTER SoundEffectPackets:

SoundEffect(UTF16("dat/shieldsUp.wav"));
Unknown_f754c8fe_08(50);

Unknown_f754c8fe_08(100);
SoundEffect(UTF16("dat/weapon1.wav"));

DamageShake(0,2.99401211738586);
Unknown_f754c8fe_08(100);
SoundEffect(UTF16("dat/shieldHit.wav"));

... yet it seems it's NOT the volume of a sound-effect (or at least doesn't seem to make any difference to sound effect volume when tested on the DISCO server). It also seems to be sent to stations that don't get SoundEffect packets

Frequently comes right before/after DamageShake (as above)

Ideas?

@JordanLongstaff
Copy link
Contributor

JordanLongstaff commented Oct 7, 2018

I'm in no position to try this now, but one idea to figure out what this does may be to write a proxy server that, whenever it receives these packets, changes their values to 0 before forwarding them to the connected client.

I suspect this would be a super easy task using IAN.

@JordanLongstaff
Copy link
Contributor

Is there a particular client console that frequently receives this unknown packet type?

@NoseyNick
Copy link
Collaborator Author

Seems to be sent to ALL client consoles, unfortunately 😕

@JordanLongstaff
Copy link
Contributor

I see. What's the most concrete instruction you can give me to try and detect this packet type?

@NoseyNick
Copy link
Collaborator Author

Choose Weapons. Start the game, you'll see Unknown_f754c8fe_08(0);
Put shields up, you'll get Unknown_f754c8fe_08(50);
Launch a torp, you'll get Unknown_f754c8fe_08(100);
They happen A LOT, they're almost always value 0, 50, or 100, and they're almost always immediately before or immediately after a sound effect packet, IF you get SoundEffectPackets (weapons doesn't, usually, unless they're also a mainscreen?)

@JordanLongstaff
Copy link
Contributor

What is DamageShake?

@JordanLongstaff
Copy link
Contributor

I find it very interesting that one of these packets gets sent when the shields get raised, but not when they are lowered.

@NoseyNick
Copy link
Collaborator Author

DamageShake is the packet 0xf754c8fe:0x05 - which I see the doc calls PlayerShipDamagePacket 🙁

@JordanLongstaff
Copy link
Contributor

So the value 0 is sent (to all clients, apparently) when the game is started. The value 50 is sent when shields are raised. The value 100 is sent when a torpedo is fired or player damage occurs. What do these four events have in common?

@JordanLongstaff
Copy link
Contributor

If multiple ships are present, either ship performing one of these actions will cause this packet to be sent to both ships.

@JordanLongstaff
Copy link
Contributor

This packet is received when player damage occurs. I wonder if this also applies to single-seat craft?

@JordanLongstaff
Copy link
Contributor

No, this packet is not received when single-seat craft take damage.

@JordanLongstaff
Copy link
Contributor

One hypothesis of mine is that this packet somehow affects the client's choice of background music to play. AFAIK the main screen console is the only one that plays background music, but maybe that was intended for all of them at one point. I have noticed before that certain events like raising shields, firing torpedoes and taking damage make the game interrupt its current background music and play something with more urgency.

@rjwut
Copy link
Member

rjwut commented Apr 23, 2020

Writing a proxy to modify these packets using IAN would be pretty easy, yes. I'll see what I can do.

@JordanLongstaff
Copy link
Contributor

It's also worth testing with two ships, one with a proxy and one without, and have both doing the same things, and see if each client receives only the packets triggered by its own actions. As well as artificially sending a high-valued packet to a client to see what happens.

Why the value is implemented as a float, though, is beyond me.

@rjwut
Copy link
Member

rjwut commented Apr 23, 2020

Well, that was a fun lunch break! I had trouble getting a proxy working for some reason, but I was able to successfully test this with my custom server. So far I've only tested with one ship, and only the values 0.0, 50.0, and 100.0. Here is what I would write about this packet based on my observations:

TensionPacket

Type: 0xf754c8fe:0x08 [from server]

Sets the current level of tension in the simulation, which affects the music played by the main screen. The music is grouped into three tiers: low, medium, and high tension. Whenever the client finishes playing a track, it will look at the current tension level and select a new track that corresponds to that level of tension. However, if the client receives a TensionPacket that indicates a higher level of tension than the current track, it will immediately fade out the current track and start playing a new one for the new level of tension.

Payload

Subtype (int)
Always 0x08.

Tension (float)
A value between 0.0 (low tension) and 100.0 (high tension). In practice, the server only sends three values: 0.0, 50.0, and 100.0.

@JordanLongstaff
Copy link
Contributor

Wow...so we're sure that's what this is, huh?

@JordanLongstaff
Copy link
Contributor

There could be a number of reasons why the tension is implemented as a float. I doubt that it's a probability metric of some kind. I think the "scale" of tension for BG musics is indeed discrete rather than gradual. My best guess is that the client is supposed to set its current tension level to that value and gradually lower it as time passes to anticipate the calmer periods in between combat situations. That's why the tension starts at 0 and gets increased when shields are raised or weapons are fired, but doesn't get decreased immediately when shields are lowered or a battle ends.

@rjwut
Copy link
Member

rjwut commented Apr 23, 2020

I think if we could peek under the hood of the server, we'd probably find that the tension score actually is more gradual and justifies the use of a float. It's possible that the client was originally intended to be able to respond in more subtle or sophisticated ways to the tension level, only for that course to be abandoned later. Another possibility is that the server was sending tension updates constantly and Thom wanted to reduce network traffic, so he changed it so that it would only send them when it resulted in a music change on the client. The end result would be that you're using a float to represent something that seems like it ought to be discrete.

What I don't get it why this one appears to be on a scale of 0 to 100 when so many other float values are on a scale of 0 to 1!

@rjwut
Copy link
Member

rjwut commented Apr 23, 2020

We still need to test to see if separate player ships have individual tension levels (I'm guessing yes?), and test what happens when we send other values (25.0, 400.0, -100.0, NaN). It also might be interesting to see if we can zero in on where the cutoff values are that trigger music changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants