BlitzSteamWorks

Started by GrindalfGames, November 02, 2023, 18:36:33

Previous topic - Next topic

GrindalfGames

First off here is the folder with everything you will need
https://1drv.ms/u/s!ArFiop2t8ukwhSnsSCZQX3eyR70o?e=d63WYS

First off add the BlitzSteamWorks.decls to your blitz3D Userlibs folder
Second add the BlitzSteamWorks.dll to your programs root folder
Third add the steam_api.dll to your programs root folder
Forth open up steam_appid.txt and enter in the App Id number of your game on steam

when your program starts you want to use Steam_Init() this connects you to the steam system

Global SteamResultCode% = Steam_Init()

I should point out that if steam connects Steam_Init() returns a 0. Any other digit is a error code but I don't know what any of the codes are but you want a zero.

then in your main loop you want to update steam with Steam_Update()

If SteamResultCode = 0 Then
   Steam_Update()
end if

When an achievement is made use Steam_Achieve() to send the achievement to steam.
Through experimentation I have come to discover that Steam_Achieve needs a RenderWorld() and does not display the steam pop up without one.
It has even crashed on a couple of systems where no RenderWorld was present. I assume the same is true for Steam_Init() but my Steam_Init is in a 3D environment and
I have not tested it without but keep it in mind that Steam_Init() May crash the graphics if it encounters a Flip with no RenderWorld.

Steam_Achieve("ACHIEV")

The "ACHIEV" is the code for your steam achievement on steam itself.
To set an achievement go to partner.steamgames.com and navigate to your apps landing page then in technical tools click on "Edit Steamworks Settings"
Then under stats and achievements click on achievements. Then click "New Achievement" and a new achievement will pop up, edit the details and upload your icons.(You can change the NEW_ACHIEVEMNT_1_1 to be what ever you want, this is the code you will send with the Steam_Achiev command)


When exiting your program Use Steam_Shutdown() to close down steam.

If SteamResultCode = 0 Then
   Steam_Shutdown()
EndIf

I would assume that everything closes down anyway even if the program crashes before closedown but its always better to do things correctly.


You can also use SteamUnAchieve to remove the achievement for testing achievements over and over

If SteamResultCode = 0 Then
   Steam_UnAchieve("ACHIEV_FIRST_FLOOR")
EndIf

These are things I was shown by a B3D user called VaneBrain if it was not for him I would not have any steam achievements in Dungeons of Mysteria but because nobody could tell me how to add achievements I thought it should be written down for other people :)
There is obviously a lot more to steamworks but this is all I've managed so far

RemiD

#1
thanks for sharing :)