From zero to Sphere

From Spheriki

Jump to: navigation, search

Okay, so you searched Google for RPG makers, and came across this. Or maybe you found a link on a site, and was curious as to what Sphere really was. Or you found some cool demo, or even just found all the other makers out there too restrictive.

For jumping straight into making games in Sphere, see the page about getting started.


Contents

Getting Sphere

The first step is to get a hold of Sphere itself. It generally comes bundled with both the engine, and the tool you use to make games with.

GET SPHERE HERE


Windows users

You're in luck, Sphere is primarily targeted for use on Windows. From the link above, get the binaries (containing the program and default resources) and DLLs. I'll tell you what to do with them in a moment.


Linux users

There are two ways to go about things under Linux: go with the binaries made for it, which offers marginally better performance, or go with Wine, which lets you use the Windows version right down to the sounds and such. I recommend going the Wine route.


Native binaries

From the link above, you'll need to download the Linux package, which has been precompiled for x86 environments.

Sphere has four major dependencies:

  • SDL (for the engine)
  • SpiderMonkey (for JavaScript)
  • Audiere (for sound)
  • Corona (for images)

It also has four others, which may or may not be an issue, depending on what you're planning to do with Sphere:

  • wxWidgets (for the Linux Sphere editor)
  • libmng (for MNG support; think PNG images, but animated like GIFs)
  • scintilla (for the script editor)
  • zlib (just for the SPK file format, but still required)

The pack-in editor, based wxWidgets, works like the regular editor. However, it's old and discontinued, and hence not recommended for use.


Using Wine

Wine is software that lets Unix-like systems run programs that would normally only work under Windows. It's great stuff, and I feel it's the easier of the two ways to get Sphere working under Linux. No dependencies to worm out, yay!

In this case, it's quite easy. Just get the same stuff as per the Windows version, DLLs and all.


Setting up Sphere

Okay we have our files... now what?


Windows and Wine under Linux

Just find a nice place to extract your files, like C:\Sphere\, or C:\Program Files\Sphere\. Wherever you put it is where the engine, the editor, and all your games will go, both yours and games of others.

It's a similar deal with Wine, but you have a couple of options:

  1. Make a ~/sphere/ directory, or something similar in your home directory. Easier to set up, but only your user account can access Sphere.
  2. Find a system directory like /opt/sphere/*, and change the permissions for user read, write and execute. A chmod or two will do the trick. All user accounts can access Sphere now, but opening up a system location like this can compromise security. You were warned!

* The reason I choose the /opt/ directory is because that is where self-contained programs go by convention (i.e. those that store all their data in the one directory, outside the norm for Linux apps).

Okay, make that folder (or directory), and just use your favourite extraction program to open and place the contents of both the binaries and DLLs zips in the same directory. That should be about it, at least for Windows.

Wine users: If you try to run stuff now, you may experience some errors. You need this one file named "mfc42.dll". If you have WinXP, mount the drive and copy it from C:\WINDOWS\system32\. Older Windows versions have it in C:\windows\system\. Failing that, try finding it through Google's online search.

However you get mfc42.dll, just put it in the same directory as Sphere.

If you're fonts look really bad under Wine (they might), you should copy the contents of C:\windows\fonts\ as well. They belong in ~/.wine/drive_c/windows/fonts/, and Wine will pick them up automatically. If you're happy with the fonts Sphere uses by default, there's no real need for this step.


Linux with native binaries

Extracting the gzipped tarball Linux package should automatically place everything in a folder named sphere-x.xx/, where the x represents a digit.

First, install the dependencies listed above using your distro's package manager. If you're lucky, everything should work and you're good to go.

If you're not so lucky, drop down into the terminal (or a terminal emulator of your choice), and run the engine or editor from there. In the error message that appears, look for the name of a library or dependency. Observe the version number, and either force install it in your package manager (may not be possible), or install it manually (i.e. go to website, download archive, compile, install, etc.). The latter process is covered in more detail in docs/build/build-linux.txt.

Just repeat this process until you're done, and the engine and editor open up. The editor may be a little more forgiving with library versions.


Getting and installing games

Nothing like a bit of inspiration to get you kick-started in Sphere, and what better way to do that than by sampling a few demos, tech demos and full games made in Sphere?

Go to the link, click on whatever takes your fancy. Read the description and the download link to gauge how far along the game has come; at the time of writing (July 16, 2006), the majority of the games in that category are either complete or playable.

Also, the latest version page contains a games pack compiled by Flikky himself. Check it out.

Download what you please, and then comes the time to get those games into the sphere/games/ directory so you can play them.


Self-contained games

These games come with the Sphere engine files. You already installed Sphere, so all you're interested in is the game. All you have to do is find the game's startup/ directory: that's where the game's project directory is at. Rename it to whatever the game is called (it's not important, but it helps organise things), and move it to your sphere/games/ directory. It should now look like sphere/games/downloaded_game/, where downloaded_game is what you renamed the startup/ directory to.

Hope that wasn't too confusing.


Project directories

This is the other common way to distribute games is by just plain archiving the project directory. Most of the time, when the author has been kind and filled with foresight, you can simply extract the archive to sphere/games/ and you'll be alright.

Check that directory. Sometimes the other thing will happen, which will result in the archive dumping a whole bunch of files in your carefully-managed sphere/games/ directory. If that happens, the only thing you can really do is pick up the pieces, making a directory and placing whatever looks like it doesn't belong inside of it. For guidance, here are the standard Sphere game directories:

  • animations
  • fonts
  • images
  • maps
  • save
  • scripts
  • sounds
  • spritesets
  • windowstyles

Those, and any stray readme files, go in the directory you made.

Alternately, check the archive first. If it contains the one folder with the name of the game, you can just plain extract it. If it's a bunch of files at the top-level, you'll need to make a directory on your own.


Sphere package files (spk)

The Sphere Package File format was meant to provide a convenient all-in-one bundle of a game, that Sphere could just open and run. Think of it like a video game cartridge or disc, but in file form.

If *.spk files are associated with Sphere (under Windows, they'll most likely have a custom Sphere icon), just double-click the file to run it.

If not, make the file association now by running the Sphere editor, choosing Options -> Register File Types, scroll down to the bottom of the list that appears, make sure that spk is highlighted (Ctrl + click to retain other selections). Click 'Register Types', and you're done! Proceed as above.

Alternately, you can run it like so:

engine.exe -package gamename.spk

Where gamename.spk is the SPK file.

Playing games

Just run the Sphere engine. The startup game will fire up, which will (hopefully) present you with a list of games to pick and choose. Pick one and have fun!

Note: The startup game is, as a matter of fact, just like any other Sphere game! It's just in the location sphere/startup/ instead of sphere/games/*. Yep, you can edit it too.

Note * 2: For SPK files, just run them as described in the previous section.


Making games

I'm not going to lie to you: making decent games is tricky business that requires dedication, thought, planning and creative flair. It's far from impossible, though, so let me tell you how it's done.

Fire up the editor. It looks a little bare-bones at the moment, and not very inviting. Get used to this, because this greyish place is going to get pretty crowded halfway through your next RPG.

Note that there are other tutorials featured in this wiki that cover this process in much more detail. The directory sphere/docs/ also has the one file named sphere_tutorial.txt which I classify as essential reading.


New project

Pick File -> New -> Project..., and a small dialog with two inputs will show up.

  • Project Name - The name of the new directory to put the game in.
  • Game Title - The title of the game that displays in the title bar.

I've been working with Sphere for a few years, and I still have to take a moment to remember which is which! :)

A new window will show up, showing the newly-created directory structure that Sphere likes to arrange games like.


Game settings

Before we get too far, let's fill in the details of what your game is all about. This oft-neglected step will make managing and searching through your games that much easier. It will also allow you to set your game screen resolution.

There are two ways to set your game details:

  • Project -> Game Settings...
  • The 'Game Settings' icon in the project window.

They both lead to the same dialog. Fill it in as you see fit. You can safely ignore the 'Main Script' setting for the moment; it will be set automatically when you make your first script file. This is where you come if you don't like where Sphere starts out.

As for the resolution, try to stick with standard 4:3 ratios, such as:

  • 320 * 240
  • 640 * 480
  • 800 * 600
  • 1024 * 768

That way, the game will work in fullscreen as well as in windowed mode. If you intend the game to only run in windowed mode, any sensible resolution will do. Want an arcade-style "tall" screen? You got it, just set it here!


Create and script

For a hands-on approach to learning how to make games, see the page about getting started.

This is the mantra of all Sphere developers, even if they aren't conscious of it:


"Create and Script"


This is the typical development cycle of a Sphere game:

  1. Create content (maps, images, spritesets, fonts, window styles, etc.)
  2. Script that content into the game.
  3. Repeat until finished.

What follows will just give you an idea of what making a game in Sphere is like; you don't have to follow instructions any more. Take a break, and read the rest at your leisure.


Create phase

Sphere games aren't interesting without fancy graphics, character designs, maps, funky fonts, sound effects, or music. In the Create phase, you either make something, or you import it from somewhere else. You may wonder what the "IDE" in "Sphere IDE" stands for; it represents the words "Integrated Development Environment". That means 'editor' :). It also means you don't have to leave the editor too often to get stuff done.

The Sphere editor features a lot of stuff to make these "resources" with: an integrated map editor, spriteset editor, font editor, image editor, and an audio player. It even contains a button to test your Sphere game without leaving the editor! But I disgress.

To make new stuff, pick File -> New and then anything that occurs below 'Project'. Don't be afraid to click something if you want to know what it does! It's easy to just close the window that pops up if you think you took a wrong turn.

Here's a run-down of the items:

  • Map - Tiled maps practically define 2D RPGs! Make tiles with this, and arrange them.
  • Spriteset - Characters and NPCs need to look like something. Draw character appearances and set directions.
  • Script - These make Sphere do stuff. Very important, but I'll cover that later.
  • Font - How do you make text look different? Make or import one of these!
  • Window Style - Because all RPGs have borders and backgrounds to their text boxes.
  • Image - If you just want to display an image that doesn't change much, this is what you're after.

To import stuff, just visit the File -> Import menu. If you don't understand a menu item, you probably don't need to worry about it. Sphere has powerful import tools that link closely with other RPG making packages out there, such as Verge or RPG Maker 2000.

Of note is the 'Windows Font to Sphere Font' option. If you're not up to drawing 128 or more characters in an image editor, just use this instead to save yourself a lot of hassle.

Also, it's possible to open files outside of the Sphere directory, and save them into the project directory. Photoshoppers and aspiring musicians/sound engineers rejoice, you can bring all of your talent (and those files) into Sphere!


Map editor

For RPGs in particular, maps are a big thing. Sphere's map editor is probably the most sophisticated of all the integrated editors of the program. With it, you can obviously make and place down tiles, but you can also put down persons (who the player can maybe talk to), triggers, zones and other event code. Those last things have to do with scripting, using JavaScript, discussed below.

Newbie mistake: You may see a line tool while editing the map layout. This is an obstruction segment. Do not use this yet! Instead, go to the tile palette (you may have to choose View -> Palettes -> etc.), and right click on a tile. Click 'Edit Obstructions' and choose a preset (or draw your own). Now every tile of that type will block the player, saving you a lot of time. Cool, huh?


Script phase

However you've gotten the resources into your project, they have to be used somehow. Remember the File -> New -> Script menu option? This makes script files. Script files drive Sphere. You use them to tell Sphere how to do its job: to make the most fantastic game ever!

Anyway, choose that option to create a new script file. You'll be presented with a scary-looking white editing box, with a blinking text cursor. Just type this in for now:

function game()
{
  Abort("I like muffins!\n");
}

Replace muffins with something else, should muffins not be to your liking. If you run it now (lightning bolt toolbar button), it'll show that text, and wait for a key press before returning you to the editor.

Sphere uses a language known as JavaScript. It has very loose ties with a certain other language called Java. They are not one and the same. Sphere uses JavaScript, and not Java. That's a good thing, because JavaScript is much more forgiving and friendly than Java. You should be grateful.

The basic process in this phase is to make the game do what you want, by writing the code to tell Sphere what you want done. This sometimes involves something you made in the Create phase. It's a big field, covered much better by other tutorials, but nobody will deny that it's powerful and flexible.

I won't sugarcoat it (though it is tempting :P): your game is going to feature a lot of code, and a fundamental background in programming is going to be a big boon. That said, JavaScript tends to be easy to learn, even those who only became aware of the term 'programming' only a few minutes ago.

Flikky has a set of tutorials on his site (see below), and the DaVince scripting tutorial will get you started if you want an option within this wiki.


HELP ME PLZ!!1

Geez, stop sounding so desperate! Wolves can smell fear...

Apart from not typing like this (no, seriously, please don't), there's a small, dedicated and most of all friendly forum of Sphere users in the forums associated with this wiki. There's a link in the sidebar, and another on the front page.

Remember, before asking at the forums, try to find solutions to problems yourself. The material in this wiki isn't just for show: it's all actually very useful, and made for people just like you! Don't let them go to waste!

Finally, Flikky, one of the core Sphere developers, has gone out of his way to provide a comprehensive but concise set of tutorials at his site. If you want to know how to do a particular thing, or even just pick up JavaScript quickly and without a fuss, this is where you go:

FLIKKY'S SPHERE TUTORIALS


Happy Sphering!

--Tunginobi 12:11, 15 July 2006 (PDT)

Personal tools