【转】独立游戏如何对接STEAM SDK
独立开发者在对接STEAM SDK之前 首先得先登上青睐之光,也就是我们俗称的“绿光”
一般要先对接G胖家的SDK,然后提交版本,最后等待审核。。。
我本身是unity 开发,对C++也是糊里糊涂..所以这里主要围绕unity说下我对接SDK的一些经历
sdk地址:http://steamworks.github.io/installation/
c#接口介绍地址:http://steamworks.github.io/gettingstarted/
steamwork使用教程视频:https://www.youtube.com/playlist?list=PLckFgM6dUP2jBeskIPG-7BVJR-I0vcSGJ
-----------------------------------------------------------------------------------------------------
第一步:
安装 Steamwork.NET(这里要感谢外国小哥)
1.下载 .unitypackage Stable (7.0.0) 或者从 Github 克隆
2.导入下载的所有文件到项目 Assets/
目录下.
3.打开unity项目,会自动生成steam_appid.txt到项目的主目录下.
4.打开 steam_appid.txt
并将 480
修改为自己的 AppId.
5.更改脚本 SteamManager.cs 找到 SteamAPI.RestartAppIfNecessary(AppId_t.Invalid)将AppId_t.Invalid替换成(AppId_t)480" 或者 "new AppId_t(480),480改成自己的APP ID如图:
- if (SteamAPI.RestartAppIfNecessary(new AppId_t(55220))) {
- Application.Quit();
- return;
- }
6.Steam根据提示修改重启unity,保证 steam_appid.txt 已生效.
7.重启unity,保证 steam_appid.txt 已生效.
8.安装sdk完成.
如何使用
1.下载SteamManagers.cs
2.将SteamManager.cs脚本挂在GameObject上,steam会自动生成单例
3.完整C#接口请点击查看
注:需要在https://partner.steamgames.com/home下载sdk,里面有提交游戏的工具,在\sdk\tools\ContentBuilder\builder
在https://partner.steamgames.com/home/steamworks可以查看文档
在http://steamworks.github.io/gettingstarted/可以查看C#接口的使用方式
- // The SteamManager is designed to work with Steamworks.NET
- // This file is released into the public domain.
- // Where that dedication is not recognized you are granted a perpetual,
- // irrevokable license to copy and modify this files as you see fit.
- //
- // Version: 1.0.5
- using UnityEngine;
- using System.Collections;
- using Steamworks;
- //
- // The SteamManager provides a base implementation of Steamworks.NET on which you can build upon.
- // It handles the basics of starting up and shutting down the SteamAPI for use.
- //
- [DisallowMultipleComponent]
- public class SteamManager : MonoBehaviour {
- private static SteamManager s_instance;
- private static SteamManager Instance {
- get {
- if (s_instance == null) {
- return new GameObject("SteamManager").AddComponent<SteamManager>();
- }
- else {
- return s_instance;
- }
- }
- }
- private static bool s_EverInialized;
- private bool m_bInitialized;
- public static bool Initialized {
- get {
- return Instance.m_bInitialized;
- }
- }
- private SteamAPIWarningMessageHook_t m_SteamAPIWarningMessageHook;
- private static void SteamAPIDebugTextHook(int nSeverity, System.Text.StringBuilder pchDebugText) {
- Debug.LogWarning(pchDebugText);
- }
- private void Awake() {
- // Only one instance of SteamManager at a time!
- if (s_instance != null) {
- Destroy(gameObject);
- return;
- }
- s_instance = this;
- if(s_EverInialized) {
- // This is almost always an error.
- // The most common case where this happens is when SteamManager gets destroyed because of Application.Quit(),
- // and then some Steamworks code in some other OnDestroy gets called afterwards, creating a new SteamManager.
- // You should never call Steamworks functions in OnDestroy, always prefer OnDisable if possible.
- throw new System.Exception("Tried to Initialize the SteamAPI twice in one session!");
- }
- // We want our SteamManager Instance to persist across scenes.
- DontDestroyOnLoad(gameObject);
- if (!Packsize.Test()) {
- Debug.LogError("[Steamworks.NET] Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.", this);
- }
- if (!DllCheck.Test()) {
- Debug.LogError("[Steamworks.NET] DllCheck Test returned false, One or more of the Steamworks binaries seems to be the wrong version.", this);
- }
- try {
- // If Steam is not running or the game wasn't started through Steam, SteamAPI_RestartAppIfNecessary starts the
- // Steam client and also launches this game again if the User owns it. This can act as a rudimentary form of DRM.
- // Once you get a Steam AppID assigned by Valve, you need to replace AppId_t.Invalid with it and
- // remove steam_appid.txt from the game depot. eg: "(AppId_t)480" or "new AppId_t(480)".
- // See the Valve documentation for more information: https://partner.steamgames.com/documentation/drm#FAQ
- if (SteamAPI.RestartAppIfNecessary(AppId_t.Invalid)) {
- Application.Quit();
- return;
- }
- }
- catch (System.DllNotFoundException e) { // We catch this exception here, as it will be the first occurence of it.
- Debug.LogError("[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" + e, this);
- Application.Quit();
- return;
- }
- // Initialize the SteamAPI, if Init() returns false this can happen for many reasons.
- // Some examples include:
- // Steam Client is not running.
- // Launching from outside of steam without a steam_appid.txt file in place.
- // Running under a different OS User or Access level (for example running "as administrator")
- // Ensure that you own a license for the AppId on your active Steam account
- // If your AppId is not completely set up. Either in Release State: Unavailable, or if it's missing default packages.
- // Valve's documentation for this is located here:
- // https://partner.steamgames.com/documentation/getting_started
- // https://partner.steamgames.com/documentation/example // Under: Common Build Problems
- // https://partner.steamgames.com/documentation/bootstrap_stats // At the very bottom
- // If you're running into Init issues try running DbgView prior to launching to get the internal output from Steam.
- // http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx
- m_bInitialized = SteamAPI.Init();
- if (!m_bInitialized) {
- Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.", this);
- return;
- }
- s_EverInialized = true;
- }
- // This should only ever get called on first load and after an Assembly reload, You should never Disable the Steamworks Manager yourself.
- private void OnEnable() {
- if (s_instance == null) {
- s_instance = this;
- }
- if (!m_bInitialized) {
- return;
- }
- if (m_SteamAPIWarningMessageHook == null) {
- // Set up our callback to recieve warning messages from Steam.
- // You must launch with "-debug_steamapi" in the launch args to recieve warnings.
- m_SteamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamAPIDebugTextHook);
- SteamClient.SetWarningMessageHook(m_SteamAPIWarningMessageHook);
- }
- }
- // OnApplicationQuit gets called too early to shutdown the SteamAPI.
- // Because the SteamManager should be persistent and never disabled or destroyed we can shutdown the SteamAPI here.
- // Thus it is not recommended to perform any Steamworks work in other OnDestroy functions as the order of execution can not be garenteed upon Shutdown. Prefer OnDisable().
- private void OnDestroy() {
- if (s_instance != this) {
- return;
- }
- s_instance = null;
- if (!m_bInitialized) {
- return;
- }
- SteamAPI.Shutdown();
- }
- private void Update() {
- if (!m_bInitialized) {
- return;
- }
- // Run Steam client callbacks
- SteamAPI.RunCallbacks();
- }
- }
第二步:
如何提交游戏版本
1、找到sdk\tools\ContentBuilder\scripts目录,该目录下有两个配置文件名需要更改
2、假如我的APP ID 为 "55220" ,修改app_build_55220,"appid","depots"内容如下:
- "appbuild"
- {
- "appid" "<span style="color:#ff0000;background-color: rgb(255, 204, 153);">55220</span>"
- "desc" "Your build description here" // description for this build
- "buildoutput" "..\output\" // build output folder for .log, .csm & .csd files, relative to location of this file
- "contentroot" "..\content\" // root content folder, relative to location of this file
- "setlive" "" // branch to set live after successful build, non if empty
- "preview" "0" // to enable preview builds
- "local" "" // set to flie path of local content server
- "depots"
- {
- "<span style="color:#ff0000;background-color: rgb(255, 204, 153);">55221</span>" "depot_build_<span style="color:#ff0000;background-color: rgb(255, 204, 153);">55221</span>.vdf"
- }
- }
修改depot_build_55221,修改 "DepotID" ,"ContentRoot","LocalPath" 内容如下:
- "DepotBuildConfig"
- {
- // Set your assigned depot ID here
- "DepotID" "<span style="font-size: 14.4px; font-family: Lato, proxima-nova, "Helvetica Neue", Arial, sans-serif; background-color: rgb(255, 204, 153);"><span style="color:#ff0000;">55221</span></span>"
- // Set a root for all content.
- // All relative paths specified below (LocalPath in FileMapping entries, and FileExclusion paths)
- // will be resolved relative to this root.
- // If you don't define ContentRoot, then it will be assumed to be
- // the location of this script file, which probably isn't what you want
- "ContentRoot" "<span style="color:#ff0000;background-color: rgb(255, 204, 153);">D:\SDK硬盘位置\steamworks_sdk_138a\sdk\tools\ContentBuilder\content\</span>"
- // include all files recursivley
- "FileMapping"
- {
- // This can be a full path, or a path relative to ContentRoot
- "LocalPath" "<span style="color:#ff0000;background-color: rgb(255, 204, 153);">.\windows_content\*</span>"
- // This is a path relative to the install folder of your game
- "DepotPath" "."
- // If LocalPath contains wildcards, setting this means that all
- // matching files within subdirectories of LocalPath will also
- // be included.
- "recursive" "1"
- }
- // but exclude all symbol files
- // This can be a full path, or a path relative to ContentRoot
- "FileExclusion" "*.pdb"
- }
3、找到sdk\tools\ContentBuilder\content目录在目录下新增文件夹 windows_content
4、复制需要提交的游戏文件至 windows_content 目录下
5、找到sdk\tools\ContentBuilder\目录下的runbuild.bat右击编辑 更改内容如下:
- builder\steamcmd.exe +loginsteam用户名 密码 +run_app_build_http ..\scripts\app_build_自己的APPID.vdf
暂时先写这么多,后面还会更新 steamwork商店的一些配置
【转】独立游戏如何对接STEAM SDK的更多相关文章
- 独立游戏《Purgatory Ashes》的经验与总结
1.引子 游戏的灵感萌生于2015年,当时只有一些概念性的设计图. 后来我利用资源商店的素材搭建了最早的原型. 游戏的最终画面: 早期以D.P作为代号进行开发,来源于两个单词的缩写 Devil Pro ...
- 半年收入超2亿RMB 独立游戏开发者的艰苦创业路
一款叫做<监狱建筑师>的模拟经营游戏,目前在Steam平台获得了3000万美元(近2亿元)以上的收入.这款游戏由英国独立工作室Introversion Software发布,而团队最困难的 ...
- Unity3D独立游戏开发日记(二):摆放建筑物
在沙盒游戏里,能自由建造是很重要的特点,比如说风靡全球的<我的世界>,用一个个方块就能搭建出规模宏大的世界.甚至有偏激的人说,没有自由建造,就不是一个真正的沙盒游戏.的确,沙盒游戏的魅力有 ...
- Unity3D独立游戏开发日记(一):动态生成树木
目前写的独立游戏是一个沙盒类型的游戏.游戏DEMO视频如下: 提到沙盒类型的游戏,就有人给出了这样的定义: 游戏世界离现实世界越近,自由度.随机度越高才叫沙盒游戏.所谓自由度,就是你在游戏里想干啥就干 ...
- 独立游戏大电影 原名(Indie.Game)
电影链接 独立游戏大电影 感觉很不错呢!!
- 用Qt制作的Android独立游戏《吃药了》公布
一个多月的努力最终有了回报,我自己研究制作的独立游戏<吃药了>.最终在360应用商店上线了. 这一款游戏呢.使用的是Qt开发的.事实上开发这款简单的应用之前.我 ...
- funhub 独立游戏团队诚邀策划,美术,技术,QA 大大加入(可远程办公)
我们刚成立的的独立游戏团队,base:广州,团队陆陆续续已经有 6 个成员了,现在还缺的岗位有策划,美术.不过有其 他岗位的仁人志士也可加入. 另外,我们支持远程办公,这是互联网行业的天然优势,一定要 ...
- air游戏接入小米支付sdk
小米支付sdk要求在Application.onCreate中进行初始化 为了这个初始化搞了半天,最终搞定了.今天将更改的步骤记录下了. 1. 创建ANE.ANE的创建就不罗嗦了,这里须要注意一点,这 ...
- unity独立游戏开发日志2018/09/22
f::很头痛之前rm做的游戏在新电脑工程打不开了...只能另起炉灶... 还不知道新游戏叫什么名...暂且叫方块世界.(素材已经授权) 首先是规划下场景和素材文件夹的建立. unity常用的文件夹有: ...
随机推荐
- 【渗透笔记】利用逻辑漏洞批量拿GOV EDU
前言: 这个Oday是以前就有的,不过都没有人出过详细的使用教程,昨天帮群里某学院拿了他们的学校之后突然想起来这个Oday,而且实用性还很强,所以我就想分享到这里来了 关键字:inurl:sitese ...
- CRF技能词识别过程
最近在用CRF做未登录技能词识别,虽然艰难,但是感觉很爽,效率非常高. (1)数据准备: 选取30000行精语料作为训练数据.每一个br作为一条数据.使用已有的技能词典对数据进行无标注分词. (2)训 ...
- java private修饰的类和变量
private主要用来修饰变量和方法,一般不会用来修饰类,除非是内部类. 1.new对象 被private修饰的变量和方法,只能在自己对象内部使用,其他对象即使是new你这个对象也是获取不到被priv ...
- javascript实现jsp页面的打印预览
1.加载WebBrowser打印预览控件 <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" heigh ...
- C# 实现AOP 的几种常见方式
AOP为Aspect Oriented Programming的缩写,意为:面向切面编程,通过预编译方式和运行期动态代理实现程序功能的中统一处理业务逻辑的一种技术,比较常见的场景是:日志记录,错误捕获 ...
- Java中的异常和处理详解
简介 程序运行时,发生的不被期望的事件,它阻止了程序按照程序员的预期正常执行,这就是异常.异常发生时,是任程序自生自灭,立刻退出终止,还是输出错误给用户?或者用C语言风格:用函数返回值作为执行状态?. ...
- 文件系统的几种类型:ext3, swap, RAID, LVM
分类: 架构设计与优化 1. ext3 在异常断电或系统崩溃(不洁关机, unclean system shutdown ).每个已挂载ext2文件系统计算机必须使用e2fsck程序来检查其一致性 ...
- 超级简单实用的前端必备技能-javascript-全屏滚动插件
fullPage.js fullPage.js是一个基于jQuery的全屏滚动插件,它能够很方便.很轻松的制作出全屏网站 本章内容将详细介绍Android事件的具体处理及常见事件. 主要功能 支持 ...
- 集美大学网络1413第十五次作业成绩(团队十) -- 项目复审与事后分析(Beta版本)
题目 团队作业10--项目复审与事后分析(Beta版本) 团队作业10成绩 --团队作业10-1 Beta事后诸葛亮 团队/分值 设想和目标 计划 资源 变更管理 设计/实现 测试/发布 团队的角色 ...
- 团队作业8——Beta 阶段冲刺3rd day
一.当天站立式会议 二.每个人的工作 (1)昨天已完成的工作(具体在表格中) 添加了订单功能,并且对订单功能进行了测试 (2)今天计划完成的工作(具体如下) 添加支付功能 (3) 工作中遇到的困难(在 ...