You are here.

Mega-ZBlog header image

Generic Game Launcher

January 23rd, 2007 · 19 Comments · Programming

I’m working on my latest product… a game launcher which has the capability to support any game through plugins.

[Edit: Updated screenshot.]

In an older screenshot I was using Krypton Toolkit for this until I realized I wasn’t really using anything I couldn’t just do with .NET alone. The nicer features I would have really liked to use are in Krypton Navigator, which is not free, unlike Toolkit. So I scrapped it and am using normal Windows Theming.

I am trying a few new programming techniques with this. The first is a plugin-style architecture. From a tutorial plus some intuition about how .NET works I’ve figured out there are a couple ways I could have done it, but right now I’ll stick with the tutorial’s way, which involves an intermediate DLL used by both the host program and the guest plugins to provide a standard Interface structure to define a plugin class. Then all the host program needs to do is load the classes, and it knows how to interact with them because of the common Interface. I deviate from the tutorial somewhat to satisfy my own tastes, and had a few problems because of it, but everything is working smoothly now.

A DLL can contain one or more plugins. A plugin defines multiple “games”, but of course these should have some sort of overall logical relation with each other. My test plugin is “Windows” and it defines all the games that come with Windows, such as Solitaire, Minesweeper, etc. An example of a more typical plugin would be a “Jedi Knight” plugin, which allows you to launch “Jedi Knight” as well as any modifications you have for “Jedi Knight”. That is as far as I would take it, but you could also show individual levels in the list if you wished. Another plugin idea would be to have a “Steam” plugin which shows all your steam games and third-party mods. I will probably implement both of these for a first proper release. I can salvage code for “Jedi Knight” stuff and more from my Über Jedi Mod Manager project, which was this projects predecessor. ÜJMM was designed for the Dark Forces/Jedi Knight series of games, and had a more traditional GUI and hard-coded plugins. Generic Game Launcher will be more “Vista-ish” and simpler in its GUI, and will be what ÜJMM should have been but for more games.

My other new programming technique I am trying is to try and separate GUI manipulation from back-end code. Normally I just put back-end code directly in the GUI event handler, but with this I’m going to try and separating the back-end code into a different module. Hopefully this will help organize my code better.

The current status of the code is that it can load the plugins and show progress on the main form, using a neat GUI widget I made using standard .NET components. The status bar serves as a non-modal progress bar and status indicator. The main app can still be interacted with while another thread is loading or working or whatever, and the action can be canceled at any time. When the action is over, the status bar shows the result of the action, and can be hidden with a close button. It will then only reappear when another loading or working thread is launched.

In a slightly older build I had a listview automatically populated with the current installed Windows games, and I was able to launch them with a couple clicks.

Right now I need to change the way game information is loaded from plugins so it is done in a new thread, so the GUI can still be used. Also I need to work on the GUI filtering (left column of buttons in the screenshot) and the sorting and grouping in the listview, so it works as you would expect it to in real time.

After that I’ll probably work on the Options interface, and Property Pages, which will work like Windows Explorer property pages. A plugin or a game information class can define tab pages to add to the properties dialog of a plugin or game, which will allow the user to change plugin- or game-specific options. I will probably use an inherited UserControl as the basis for this, since I wouldn’t know much about being able to show a TabPage itself on a dedicated design surface.

Tags: ·

19 responses so far ↓

You must log in to post a comment.