PDA

View Full Version : Steamworks pascal headers



Relfos
15-10-2014, 07:03 PM
Hi guys!
As some as you know, I've been working on the first pascal game that will be released on Steam.
Not sure if anyone else is interested in this, but I hope so, because I want to see more games made in object pascal :)

Sadly, all of the Steam API is done in C++, which makes it impossible to be used from other languages.
Luckly some guys did a wrapper DLL with a C-style interface to be used in C#.
I wrote a parser that translated those C# headers into a usable Object Pascal unit.

Here's the link:
https://github.com/Relfos/steamworks_wrappers

Later I will also add wrappers to C and Java, as since I already have the code to parse the headers, it is simple to change the code to emit headers in other languages (but Java will need a JNI wrapper).

Supported compilers:
Right now I only tested the pascal unit with Delphi 7 and FPC.
Might work with Delphi XE, if anyone can try it tell me.

Note:
You can only use this if you are a registered Steamworks developer, because otherwise the API won't initialize correctly.

phibermon
15-10-2014, 07:30 PM
The very best of luck Relfos! I too want to see more games made in Pascal and Steam is a great platform to release on. I have dedicated myself for many years to the goal of creating a modern, production ready engine for use by the Object Pascal community as have your good self and a number of other talented developers that frequent this site.

You've made great leaps and I'm sure like me, others will be inspired to push on hearing of this first for game development in Pascal.

Congratulations and let us know when it's released! a major milestone in the fight to have our beloved language accepted as a fully capable tool in game development.

Relfos
15-10-2014, 07:51 PM
Thanks phibermon! :)

Sadly many people still think pascal is a joke language, almost everywhere in the net I find comments about it...
Hopefully people like us will continue making nice projects to show that it is very powerful language.

Now I just wish I had more free time so I could contribute to other pascal projects, especially FPC.
Also I was now reading the news about the PGD engine, and checked the repo. Maybe I can help a bit with it later, in some months, when I finally release Minimon in Steam, since I will have more time then ;)

paul_nicholls
16-10-2014, 12:45 AM
That is great news Relfos :)
Just curious, what do you use to parse the C++ headers? I would be interested in looking at it if you could share?

I am really into parsers and stuff like that :D

cheers,
Paul

Super Vegeta
16-10-2014, 11:02 AM
Totally unexpected and really cool. :)

Relfos
16-10-2014, 11:46 AM
Paul, I did not parse C++ but rather C#, a bit easier :)

Since the whole API was in C++, to use it from pascal it was necessary to make another dll that wrapped the C++ calls with C.
So I searched and one guy did a dll like that already, and provided C# bindings for it:
https://github.com/rlabrecque/Steamworks.NET

I wrote a mini parser that just extracts the functions, enums and structs (and comments too when possible). Maybe later I'll add it to the rep, in case someone is interested on it.

SilverWarior
16-10-2014, 11:57 AM
Supported compilers:
Right now I only tested the pascal unit with Delphi 7 and FPC.
Might work with Delphi XE, if anyone can try it tell me.

Note:
You can only use this if you are a registered Steamworks developer, because otherwise the API won't initialize correctly.

What takes for someone to become Steamworks developer? Do you have to pay anything?
I'm asking this becouse I myself curently I'm not a Steamworks Developer but I do have access to Delphi 7 and all Delphi versions ranging from Delphi XE2 to Delphi XE7 so I could eventually test the headers with all of them.

Anywhay after a quick look at the source code I think that the only change that might be required to the code is replace String types with AnsiString types becouse in Delpbi 2009 and newer the string type is an Unicode String. But other than that I don't think there should be any problems in compiling this with newer versions of Delphi.

Relfos
16-10-2014, 12:10 PM
Yes, true, probably the only change would be String to AnsiString. But in fact, I think I only used string in some constants, and correctly used PAnsiChar in the others :)
I'll change those constants though.

To become a Steamworks developer, right now it is a bit difficult. You have to pay 100$ to be able to put your game in Greenlight, that is basically a voting area for Steam players. The games with more votes are selected to go into Steam, and then you get an oficial invitation from Valve to become a partner.

However there are rumors that soon (possibly next year) this will change and possibly the process will be easier allowing more people to get in.
I think they will remove the voting system and replace it with something else.

phibermon
16-10-2014, 07:01 PM
What the *hell* is unicode??

;)

SilverWarior
16-10-2014, 10:33 PM
What the *hell* is unicode??

Unicode is a modern computing industry standard for the consistant handling of texts (strings) that is not dependant on localized character sets as it contains one universal character set which contails over 110,000 different characters.
The most common implementation of unicode standard used is UTF-8 where each character can use up to 5 bytes of data to represent each of its characters instead of one byte per character that is used in ansi strings.
This makes both string types to be incompatible with each other.

You can read some general thing about Unocde here:
http://en.wikipedia.org/wiki/Unicode
To read about some basics about using unicode support in delphi check the article below:
http://delphi.about.com/od/objectpascalide/a/understanding-unicode-support-in-delphi.htm
And to read how unicode is used in FPC with which you are more familiar check the next page:
http://wiki.freepascal.org/FPC_Unicode_support

SilverWarior
16-10-2014, 10:43 PM
To become a Steamworks developer, right now it is a bit difficult. You have to pay 100$ to be able to put your game in Greenlight, that is basically a voting area for Steam players. The games with more votes are selected to go into Steam, and then you get an oficial invitation from Valve to become a partner.

Based on that I gues that becoming a Steamworks developer for me is out of the question. I don't have any game yet that I could try to port to steam platform and proabably won't have for some time as development is going rather verry slow (still in early development or maybe I should say planning stage for a few ideas of mine).
But if you build a test case a small aplication soley build to test the API I can try to compile it with never versions of Delphi and then send you the compiled binaries to test. But that would mean there would be no real means of proper debuging of these.

Relfos
09-11-2014, 02:58 PM
Well, I think it should fine on XE, since I'm using PAnsiChar everywhere.
There are some String consts, but after checking it seems they are not used anywhere, it seems.

shihonage
11-05-2015, 08:18 PM
My FPC game was Greenlit as well.

I am looking forward to trying your headers!

Relfos
11-05-2015, 10:54 PM
Congratulations, what is your game? :)

shihonage
12-05-2015, 05:52 AM
Thanks.

It's a 2D ASCII shooter with scripted sequences and voiceovers, which was reskinned to have graphics. This didn't work too well, because people don't understand why you only shoot in 8 directions and need to line up with enemies, so for Steam version I'm going to polish the ASCII mode and make it default.

Relfos
16-12-2015, 12:38 PM
Ok guys, so I just uploaded a new version of the headers, and added a SteamManager unit for those who had problems understanding how to call the SteamAPI.

Here's the link, you can find the 3 relevant files in the /headers folder
https://github.com/Relfos/steamworks_wrappers