rlabrecque / Steamworks.NET

Steamworks wrapper for Unity / C#
http://steamworks.github.io
MIT License
2.81k stars 368 forks source link

Steam Timeline event parameters needed in wrong order #639

Open JimmyWoodhouse opened 2 months ago

JimmyWoodhouse commented 2 months ago

It looks like AddTimelineEvent() in SteamTimeline needs the parameters to be passed in in a different order than expected to work.

This would result in an incorrect ordering of parameters, leading to event icons not working and information of events in Steam Timeline in game being in the wrong places: SteamTimeline.AddTimelineEvent(eventKey, title, description, frontToBackPriority, startOffsetSeconds, durationSeconds, possibleClipPriority);

The ordering that is actually required for events to work correctly: SteamTimeline.AddTimelineEvent(description, eventKey, title, frontToBackPriority, startOffsetSeconds, durationSeconds, possibleClipPriority);

I've attached some images with examples showcasing this. Note how the event icon key, title and description are in the wrong places when using the expected ordering

It looks to be correct in Steamworks.NET's isteamtimeline.cs, so I'm not too sure where the problem lies. Thanks!

image

image

image

rlabrecque commented 2 months ago

Hmm it's passed as such in SpaceWar; I don't see any place that it could have gotten swizzled.

    // add a highlight marker every time the player wins
    if ( eNewState == k_EClientGameWinner && SpaceWarClient()->BLocalPlayerWonLastGame() )
    {
        SteamTimeline()->AddTimelineEvent( "steam_attack", "Winner!", "You won a round!", 10, 0, 0, k_ETimelineEventClipPriority_Standard );
    }
    else if ( eNewState == k_EClientGameDraw )
    {
        SteamTimeline()->AddTimelineEvent( "steam_defend", "Draw", "This round was a draw.", 5, 0, 0, k_ETimelineEventClipPriority_None );
    }

isteamtimeline.h: virtual void AddTimelineEvent( const char *pchIcon, const char *pchTitle, const char *pchDescription, uint32 unPriority, float flStartOffsetSeconds, float flDurationSeconds, ETimelineEventClipPriority ePossibleClip ) = 0; NativeMethods.cs: public static extern void ISteamTimeline_AddTimelineEvent(IntPtr instancePtr, InteropHelp.UTF8StringHandle pchIcon, InteropHelp.UTF8StringHandle pchTitle, InteropHelp.UTF8StringHandle pchDescription, uint unPriority, float flStartOffsetSeconds, float flDurationSeconds, ETimelineEventClipPriority ePossibleClip); isteamtimeline.cs:

public static void AddTimelineEvent(string pchIcon, string pchTitle, string pchDescription, uint unPriority, float flStartOffsetSeconds, float flDurationSeconds, ETimelineEventClipPriority ePossibleClip) {
            InteropHelp.TestIfAvailableClient();
            using (var pchIcon2 = new InteropHelp.UTF8StringHandle(pchIcon))
            using (var pchTitle2 = new InteropHelp.UTF8StringHandle(pchTitle))
            using (var pchDescription2 = new InteropHelp.UTF8StringHandle(pchDescription)) {
                NativeMethods.ISteamTimeline_AddTimelineEvent(CSteamAPIContext.GetSteamTimeline(), pchIcon2, pchTitle2, pchDescription2, unPriority, flStartOffsetSeconds, flDurationSeconds, ePossibleClip);
            }
        }
JimmyWoodhouse commented 2 months ago

Yeah it all looks good, which is confusing. I assume running the Test project with a valid steam game would lead to the clips showing the data correctly?

I'd assume I have messed up somewhere, but you can see in the images I sent how I am calling SteamTimeline.AddTimelineEvent() and how it works with the ordering I've shown, rather than what you'd expect the order of parameters to be.

The in-game image is when using SteamTimeline.AddTimelineEvent(eventKey, title, description, frontToBackPriority, startOffsetSeconds, durationSeconds, possibleClipPriority);, which is what it should need, but clearly it results in issues.

I wonder if there is a mistake here on Valve's end?

rlabrecque commented 2 months ago

If you'd have any time to try out SpaceWar from the SDK that would be interesting

JimmyWoodhouse commented 2 months ago

I took a look at building the Test project, built it and added steam_appid.txt with 480. It connects to Steamworks, but I'm not sure how to actually get steam overlay open to see the timeline. Using the buttons on the SteamFriends page of Test just brings up the steam client, not the steam overlay, and the normal shortcut for opening the overlay isn't working either.

Do you have suggestions for what I need to do to be able to open steam overlay when running the Test project built .exe? I'm sure it's worked when running builds of my game that aren't pushed to Steam, but doesn't seem to work in this case.

JimmyWoodhouse commented 2 months ago

Alright, I got it to work by adding it as a non-steam game and enabling recording for it. The timeline doesn't show if you open the overlay and says it isn't recording, but it is, since you can find the recordings in steam by going to: View -> Recordings and Screenshots.

Looks like it's broken here too! This is the Steamworks.NET-Test project, out of the box, built. image

Edit: sorry, just realised you asked if I could look at Spacewar. Looking into it

JimmyWoodhouse commented 2 months ago

I'm unable to install what I need to be able to build the project annoyingly, but it does look to be ordered the way you'd expect in the code image

chrwald commented 2 months ago

This might have something to do with the way the steam client caches the custom icons for the timeline. I just tested this on two machines with the same build. The first is the machine which is used for the development of the game. On this machine, I encounter the same thing (and also the custom icons get ignored). On another machine however, if I install the game via steam, the icons appear (and the title and description appear in the right order). I have no idea how this could be connected. But maybe someone else can make some sense of it.

rlabrecque commented 2 months ago

Same Steam client build running on both?

JimmyWoodhouse commented 2 months ago

I'm on Steam Beta Update, maybe it's different for the Steam Families Beta client version? Also just a side note - I'm currently using Valve icons only, no custom icons

chrwald commented 2 months ago

Same Steam client build running on both?

Bullseye! Updating to the same client version 1724453533 (Aug 24) fixed it on the other machine. Thanks for pointing this out.

JimmyWoodhouse commented 2 months ago

Just tested it on 1724453533 and you're right. Looks like it was a Valve issue and they've resolved it!