Please login or register.

Login with username, password and session length
Advanced search  


Forum rules - please read before posting, it can save you a lot of time.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Mnemonic

Pages: [1] 2 3 ... 10
Scripts, plugins, utilities, goodies / Steam plugin
« on: October 19, 2013, 12:28:02 PM »
Steam plugin for WME

If you are lucky enough to have your game published on Steam, this plugin will allow you to leverage some of the Steam features, namely achievements and game stats.

Getting started

Download the plugin here:
Source code is also available:
  • Copy wme_steam.dll (the plugin itself) and steam_api.dll (Steamworks API library) to your WME installation directory.
  • The Steam library needs to know the unique ID of your game (you will get the ID once your game is accepted to Steam). If the game is executed from the Steam client, it already knows the ID. However for testing purposes, you will need to create a text file in your WME installation directory, called steam_appid.txt. This file will contain the ID of your game.
  • Define your game's achievements and stats using the Steam partner site (notice that each achievement and stat is identified by a unique string ID).
Note: If your game is not on Steam yet and you want to test the Steam integration anyway, you can use a test game called Spacewar. Its ID is 480 and the defined achievements are listed on this site

Accessing Steam functions from WME scripts

First you need to create a SteamAPI object and store it in a global variable. Typically you will do this when the game starts, i.e. somewhere in the beginning of game.script:
Code: WME Script
  1. global g_Steam = new SteamAPI();

To check whether the initialization was successful, check the SteamAvailable property.
Code: WME Script
  1. if (g_Steam.SteamAvailable) ...
If the SteamAvailable property is false, something is wrong. The typical reasons are that either the Steam client is not running or you've provided an invalid game ID (see above).

Working with achievements

To unlock an achievement, call the SetAchievement method. It accepts a string ID of the achievement (the ID you assigned to your achievement when defining it) and it returns true/false, depending on the success. It is safe to call this method multiple times, if the achievement is already unlocked, subsequent unlock attempts will be ignored.
Code: WME Script
  1. g_Steam.SetAchievement("ACH_WIN_ONE_GAME");

This is pretty much everything you will typically need. The plugin provides more functions, though:

To check whether an achievement has already been unlocked by the player, use the IsAchieved method:
Code: WME Script
  1. Game.Msg(g_Steam.IsAchieved("ACH_WIN_ONE_GAME"));

To reset an achievement back to unlocked state, use the ClearAchievement method. You will probably only need this for testing purposes, not in the actual game:
Code: WME Script
  1. g_Steam.ClearAchievement("ACH_WIN_ONE_GAME");

To query all achievements defined for the game, use the NumAchievements property and GetAchievementId method. The following example will print out all achievement IDs:
Code: WME Script
  1. for (var i = 0; i < g_Steam.NumAchievements; i = i + 1)
  2. {
  3.   Game.Msg(g_Steam.GetAchievementId(i));
  4. }

Working with stats

Stats are some persistent values related to your game, stored by Steam across multiple gaming sessions. You can use them for tracking information such as the number of times the player started your game, the number of miles the player traveled in total etc. Steam can store either integer numbers or float (decimal) numbers. Just like with achievements, you define stats using the Steam partner site.

To store a stat value, use the SetStat method. It accepts either integer or float numbers. If unsure about the value of your variable, convert it explicitly using the ToFloat() or ToInt() WME functions.
Code: WME Script
  1. g_Steam.SetStat("NumGames", ToInt(10));
  2. g_Steam.SetStat("FeetTraveled", ToFloat(100.5));

To retrieve stored stats, use either the GetStatInt or GetStatFloat method:
Code: WME Script
  1. Game.Msg(g_Steam.GetStatInt("NumGames"));
  2. Game.Msg(g_Steam.GetStatFloat("FeetTraveled"));

Other functions

For testing purposes you may need to clear all stats and achievements. To do that, use the ResetAllStats method. It accepts a logical argument, specifying whether you want to reset just stats or also all achievements:
Code: WME Script
  1. // reset just stats
  2. g_Steam.ResetAllStats(false);
  4. // reset both stats and achievements
  5. g_Steam.ResetAllStats(true);

To reload the stats/achievements states from the server, use the RequestStats. Normally you shouldn't need to call this method. The plugin will call it automatically upon initialization.
Code: WME Script
  1. g_Steam.RequestStats();

To check whether the stat/achievement info is available, use the StatsAvailable property. Stat info is downloaded from Steam asynchronously, meaning that there may be a slight delay between plugin initialization and stats becoming available. Until this property is true, all other calls to methods dealing with stats and achievements are ignored.
Code: WME Script
  1. if (g_Steam.StatsAvailable) ...

You can query the game ID using the AppId property:
Code: WME Script
  1. Game.Msg("Current game ID is: " + g_Steam.AppId);

Help wanted and offered / Posting in this section - read first
« on: August 25, 2013, 09:04:59 AM »
  • If you are a person looking for a team to join, please state whether you are a hobbyist (willing to work for free) or if you are only looking for paid work. The same goes for teams looking for members.
  • If you are offering game-related services and/or pre-made assets, please keep all your posts in a single thread. Don't start a new thread every time you have some new products.
  • Only game-related offerings are allowed in this section.

WME Lite / Any Linux developers out there?
« on: May 24, 2013, 08:23:54 PM »
Hey folks, I was just wondering if there's anyone interested in adopting and maintaining a Linux build of WME Lite. It shouldn't be terribly hard, it's mainly about compiling the dependencies and preparing build files. Perhaps also preparing some way of distributing the games using WME Lite.

Sadly, I have zero experience with Linux development myself (last time I used Linux seriously was in the late 1990s :)) and I don't have time delve into it right now. But maybe you know of some skilled Linux developer who would be interested in helping with the project (or maybe you are one!). If so, please point them in this direction 8)

Obtaining the source code

The source code is available in a public repository stored on BitBucket. There are several ways of getting the code:

1) Download the code in a compressed archive. Go to the downloads section, select the "tags" or "branches" tab and download the arcive of your choice. The "tip" tag represents the latest version of all files.
2) Clone the repository on your computer. You will need a mercurial client for this. If you prefer GUI tools, you'll probably want to use TortoiseHG. In TortoiseHG Workbench use the "Clone repository" command. The advantage is that you can later refresh your local repository by pulling new changes.
3) Create a fork of the repository on BitBucket. Use the fork link on BitBucket. Use this option if you want to work on the source code, separately from the main repo. You can then offer your changes by sending a pull request to the main repository.

Preparing your development environment

WME development is done in Visual Studio 2008. Therefore all the solution and project files, as well as precompiled dependencies are in Visual Studio 2008 format. It *should* be possible to compile in newer Visual Studio versions, but I haven't tried. Also, if you are using Visual Studio 2008 Express, you may need to install the Windows SDK and modify some of the sources (namely the .rc files, referencing the afxres.h file which is not included in VS Express).

To be able to compile the engine and the tools, you will need to install DirectX SDK. WME comes in two flavors, DirectX8 and DirectX 9. For DirectX 9 it's been tested with the "DirectX SDK June 2007", which can be downloaded HERE. It may or may not work with newer SDKs, I haven't tried.
The DirectX 8 version is more tricky. Since Microsoft doesn't support DX8 anymore, the neseccary header and lib files are no longer included in the SDK. To be able to compile the DirectX 8 version of WME you will need a fairly old version of SDK, which can be downloaded HERE (external site, MS doesn't provide the SDK anymore).

Next you will need to setup the directories in Visual Studio properly. Go to "Tools -> Options" and select "Project and Solutions" and then "VC++ Directories". Now setup your directories similarly to following pictures. The "F:\DXSDK\" path represents the location of the old DirectX SDK, and "F:\DXSDK (June 2007)" is the June 2007 DirectX SDK. Please note that the order of items DOES matter!

Note: In Visual Studio 2010 and later these directories are set on a per-project basis.

Compiling the source

Once you have obtained the source and setup your environment properly, you should be able to compile the engine and tools. There are many solutions included, representing various pieces of Wintermute Development Kit. What you'll be probably most interested in is the engine runtime itself. You'll find the solution file in "src\wme\wmeold.sln". By changing the build configuration you can choose between Debug, Release, Debug D3D9 and Release D3D9.
The tools each live in their own directory, e.g. ProjectMan solution is in "src\ProjectMan\ProjectMan.sln" etc.

There's a special solution for building everything needed for a complete Wintermute Development Kit. It's in "src\BuildAll\BuildAll.sln". However it probably won't wor for you unless you switch the build configuration to "Release" and unless you've build the individual projects before. But, must people won't need this solution anyway.

The dependencies (3rd party libraries used by WME) can be found in the "src\external_lib" directories. They are precompiled for Visual Studio 2008, but if you are using a different VS version or if you want to get rid of the annoying "debugging information is missing" warning while compiling WME, you will need to recompile the dependencies. Each of the libraries comes with a .sln file which can be used for this.

Running WME from Visual Studio

If you compile WME in Visual Studio and try to run it, you will probably get the "Some of the essential game files are missing" error. That's because your freshly compiled WME executable doesn't know what game to run. You must point it to a WME project. To do so, first right-click the "wme" project in Solution Explorer and choose "Properties":

In the properties window choose "Configuration Properties -> Debug", and fill-in the "Command Arguments" field. Enter something like: -project "path_to_your_game\project.wpr" (remember to enclose the path in quotation marks if it contains spaces).

Note that this option is build-configuration specific, i.e. different for Debug builds, Release builds etc.

Next time you execute WME from Visual Studio, it should run the specified project. If you only see a black screen, it means WME cannot compile game scripts, because it can't locate the script compiler. The easiest way is to copy the "dcscomp.dll" file to the same directory where your freshly compiled wme.exe file is located (e.g. src\wme\Debug\wme.exe). The dcscomp.dll is the WME script compiler, and you will find it in your WME installation directory (or you can compile it yourself, the sources are included as well).

Note about porting

From time to time someone attempts to port WME to other platforms. Before you attempt anything like that, please note that there already IS a portable fork of WME. It's called WME Lite and it has a dedicated forum section. The tools, I'm afraid, are totally non-portable.

Also ScummVM does support WME games now.

Closing words

If you have any questions or suggestions related to WME source release, please start a new thread in this forum section.

Community bulletin board / WME is 10 today!
« on: January 12, 2013, 06:08:27 PM »
Wow, can you believe it? Today it's exactly 10 years since the very first public version of WME has been released! The world was different back then, both gaming and otherwise. Yet, somehow this little game engine survived and even 10 years later people are still using it to tell stories. And that was the point in the first place.

I just want to say THANKS to all WME users, former and current, for channeling their creativity through this software, and for creating so many amazing games. You're making me proud :)

For me, personally, WME has always been a huge learning experience and it helped me to find some very good friends. I don't think I could have asked for more.

So... cheers, WME, for the next decade! ::beer Rock on! ::rock

General Discussion / Please support Vampires! on Steam Greenlight
« on: September 21, 2012, 04:36:05 PM »
Hello folks,

the company of our fellow developer metamorphium is finalizing their new puzzle game Vampires! and they are trying to get the game on Steam. Please support the game by voting for it on Greenlight (you need a Steam account).

meta's been helping people on this forum for years and this is the least we can do to repay him ::wave

WME Lite / Migrating to BitBucket
« on: August 01, 2012, 08:43:33 AM »
I will be moving WME Lite sources over to BitBucket. Well, I already did, unofficially, you can find it here:
So far there are only minor changes compared to the Google Code repository, but I prepared a new set of iOS dependencies (see the Downloads tab) and updated the project settings. They will allow you to compile WME Lite supporting armv7 processors, which is now required.

As you may know, WME Lite is using the SDL2 library for graphics. SDL2 is still under development and even the latest version does have some glitches, so I'm keeping the old hacked version for now. The good news is that once SDL2 is ready it will allow sprite mirroring and rotations to be re-enabled in WME Lite.

The BitBucket repository is using Mercurial versioning system. I recommend using the following clients: tortoiseHG on Windows and SourceTree on Mac.

Hi muties,

here is a new (maintenance) release of WME. The main change is rewritten saving which should be much faster than before, plus some improvements and fixes. Since the saving is a rather big change I'm marking this release as beta, although I tested many WME games without any problems.

WME 1.10.1 beta installer download (19MB)

(Note: Saved games are NOT compatible with previous WME versions)

Version 1.10.1 (July 19, 2012)
  • Significantly faster saving; idle scripts are not stored in saved game so they can be easily patched.
  • Game.SaveGame() method now has an optional QuickSave parameter which allows saving without displaying the progress indicator.
  • New script attribute Game.MostRecentSaveSlot which returns the number of the most recently used saved game slot (to allow implementing a "Continue" button in the main menu).
  • Talking caption cannot be skipped for a short period of time after it's displayed to prevent accidental skipping of dialog lines.
  • FIX: Framerate drop after certain use of TrueType fonts.
  • FIX: Crash after unloading an actor which is set as Game.InventoryObject.
  • FIX: Crash after using actor3D.SetTexture().
  • FIX: Images ending with capital G were treated as grayscale thumbnails.
  • FIX: Changing scene main layer dimensions at runtime didn't affect scrolling.

WME Lite / WME Lite and ScummVM
« on: March 17, 2012, 11:01:41 PM »
Hello, I just wanted to mention, that the good folks at ScummVM consider adding WME Lite support. It's one of the topic for 2012's Google Summer of Code. So if you are a student eligible for GSoC and you find this idea interesting, this is your chance :)

ScummVM: We need your talent for GSoC 2012
GSoC Ideas - ScummVM :: Wiki

General Discussion / Merry Christmas and a happy new year!
« on: December 24, 2011, 01:02:32 PM »
Hello everyone, I'd like to wish you all Merry Christmas (if you celebrate it) and all the best for the year 2012! Let's make it a very creative and fun year, okay?  ::wave

Technical forum / Forum upgrade
« on: November 19, 2011, 06:20:43 PM »
Hello folks,

I finally upgraded the forum to the latest version. It took a lot of convincing, but things seem to be stable now. However, if you encounter any glitches, please post them in this thread. Thank you.

Pages: [1] 2 3 ... 10

Page created in 0.093 seconds with 22 queries.