Cave Story plans

31 03 2008

Even though I can’t continue work on Cave Story for the GameCube as a hobby project, that doesn’t mean it’s a dead project.

I have a port of Cave Story I’ve been working on, to basically get a clean cross platform layer in there. What I’d like to do is get a port up and running on another platform, but in terms of other platforms, my options are somewhat limited at this point.

I’m thinking either iPod Touch/iPhone (even though I don’t yet have a Mac or an iPod Touch/iPhone) or even a console download service if I can get permission from Pixel and AGTP, work out all the legal garbage and whatever else.

There’s a whole load of hurdles to get over if going that route, so it’s just a pipe dream at the moment.





NDA’d in 3… 2… 1…

16 03 2008

Regular readers, subscribers (or stalkers!) may remember that I moved on from homebrew PSP development when I gained access to the official docs and development hardware through my work. Because my employer had signed a non-disclosure agreement for Sony, I couldn’t keep homebrewing and still guarantee that I wasn’t inadvertently leaking Sony’s uber-secret technical details to the general public.

I then moved on to GameCube development, as in work we weren’t doing anything for Nintendo hardware and I didn’t have to worry about those kinds of conflicts.

Until now that is, as we’ve just become registered WiiWare developers.

While we’ve not started development on any WiiWare titles yet, it’s probably just a matter of time. I’m really excited about the prospect of doing some cool stuff on the Wii, but I can’t help but feel a bit bummed out that yet another homebrew door has been closed.

It’s easy to feel angry at my employer about this, but really it’s not their fault. Sony and Nintendo’s attitude to developers is to blame here. But that’s a rant for another day.

If any readers would like to continue work on any of my projects, please let me know.

I’ll see if I can fire out a quick release of something before it’s too late, but no promises okay?





Cave Story GameCube reaches the intro screen

7 03 2008

I’ve been a bit quiet about Cave Story progress, so I thought I’d make a short post about it.

Before I begin, I would like to ask news sites to please not copy and paste my posts verbatim into their news stories, as this prevents me from editing posts or making corrections.

But anyway, like Simon Parzer’s GP2X port, the GameCube port uses SDL underneath. GameCube SDL is now a work in progress in the devkitPro CVS repo, and with the help of WinterMute and the other devkitPro guys it seems to be coming along great.

Audio, threads and timers are really not implemented at all in GameCube SDL yet, so there’s a lot of Cave Story (mainly audio) which had to be disabled in order to get the GameCube version up and running past initialisation.

Here are a few pictures to sum up progress:

Cave Story in SD LOAD Cave Story loading its initial data Cave Story at the intro screen Oh no!

The game gets to the intro screen, but crashes shortly after. I’ve got some ideas about what the problem could be, but I’ve not got the time to look into it right now. Perhaps when my uni workload dies down a bit.





GameCube, GP2X and Quake 2

16 02 2008

It’s been a while since I bought a GP2X and I’ve not done much coding for it. Partly this is due to the firmware start-up time — it takes about a minute to get from the Makefile copying the ELF onto my SD card to actually running the build.

I don’t know if this is a Linux problem (not too likely) or a GP2X problem (rather more likely), but a 30 or 40 second start-up delay for a portable game playing device is completely insane. I don’t know how GPH sleep easy at night!

But anyway, for a while I’ve had a GameCube port of Quake 2 in the works. It looks like it’s going to run fast enough but as usual with Quake 2 ports, memory is a problem. I’ve stripped out some memory hogs and tried to shrink down some allocations so while I’m fairly sure Quake 2 for GameCube will happen, I can’t make any promises.

In order to make Quake and Quake 2 development easier, as well as their GameCube versions I maintain a Win32 SDL version of both games. This lets me quickly compile and test platform independent changes without messing around with SD cards or adaptors or waiting for devices to boot.

Given that the GP2X comes with SDL installed I thought I’d quickly adapt my GameCube Makefile for a GP2X version and see how well it ran.

SlowCPU is sloooowwww!

The GP2X has no FPU and Quake 2 does a fair bit of floating point maths, even in the innermost span renderer. The end result is a frame rate just over 5 frames a second (compared to the GameCube’s “easy” 50 FPS).

The Cube is so cute and cuddly, but inside its cheeky purple shell lives a beefy monster!

Anyway, I noticed a few easy performance fixes and by making some changes managed to pretty much halve the time taken to render world spans on the Win32 build. I would imagine the GP2X build won’t see nearly that improvement though as I’ve not yet done any fixed point conversion.

I’ll leave the details of the changes for another time.





Multiple topic catch-up!

14 08 2007

Phew, looks like Quake GameCube was pretty popular. As of now, it’s been downloaded 362 times. Who knew there were so many GameCube homebrew fans!

There’s all kinds of discussion going on about it on various forums and as much as I’d like to respond to all the queries, all those forums are just way too much to keep up with. So what I’ll do is cover the main points here.

Some folks have quite reasonably supposed that there won’t be any more GameCube homebrew from me because my Wii isn’t capable of running SD Media Launcher any more. The good news is that I do my development using a regular purple GameCube connected to my PC via a TV card. I think I would go insane if I were using the Wii as my main development console. It takes so long to start up and get into GameCube mode!

I really should have put a new post up here when I released Quake, as many sites have copied and pasted my last Quake post into their news items.

Additionally, I really should have put up a screenshot. Many sites used screenshots from GLQuake or highly modified Quake engines to illustrate their news posts, which is a shame because the shots they used don’t represent what the GameCube port looks like.

In terms of gameplay, some people don’t like the way the view centres itself vertically if you start moving. I think this is a Quake feature rather than a GameCube port feature and there should be something useful (“lookspring”?) in the options screen if you want to disable it. I like it on, so I never thought about it.

It’s unlikely that I’ll be doing any updates on Quake soon, mostly because I’m getting stuck into a new project at work and annoying network card issues have caused me to lose some schedule time, but partly because I’m pretty happy with Quake and there don’t seem to be any glaring issues that need fixed ASAP. That’s a first!

Anyway, I’m glad people seem to like the port and hopefully there’ll be something else for you in the coming months.

As I was concentrating on Quake, the GameCube ports of SDL or Cave Story haven’t really progressed much since I wrote about them last.

Simon Parzer has been working on the SDL port of Cave Story. He’s been doing a great job implementing a mixer for sound effects and music. We’re sharing the same Subversion repository so he can port to Linux and GP2X while I port to GameCube.

The GameCube port of SDL is going okay. The only problem I see is with the audio system. SDL won’t convert audio properly when the frequency change isn’t a power of two. Unfortunately the GameCube plays only 32KHz and 48KHz audio, which isn’t very common, and SDL won’t convert correctly between those frequencies and the usual suspects like 11KHz, 22KHz or 44KHz. This is due to be fixed in SDL 1.3, but until then I’ll need to write an on-the-fly rate conversion routine.

After I get back on schedule with work I’ll pick up SDL again. I hope once SDL is released that the flood gates will open for loads more GameCube ports. The scene seems a bit bare. I think the recent GameCube homebrew contest at DCemu only had one entrant!





Quake GameCube update

1 08 2007

I took a break from Cave Story this week to work on Quake for the GameCube.

There had been a couple of long-standing bugs which halted progress on Quake. Firstly, the SD card library seemed to be reading garbage data occasionally, which would generally manifest itself as corruption when loading the second demo in Quake’s attract mode.

Thankfully, softdev released an alternative SD card library which I quickly plugged into Quake. That fixed the bug, but added a couple of limitations which weren’t there before:

  • File names must now be upper case.
  • File names must be in DOS 8.3 format.
  • SD cards are only supported in memory card slot 1.

Thankfully there’s nothing too major, as Quake was a DOS game and SDLOAD (used to run GameCube programs from SD card) only seems to work with slot 1 on my GameCube anyway.

After that bug was gone, fixing the other was much easier. The other bug seemed to cause some variables to get corrupted, but only when starting a new game. Previously I couldn’t tell what the cause was, because the two bugs fed into each other and I couldn’t be sure where the corruption came from.

Disabling optimisation made the bug go away, so I suspected that one or more of the optimisation flags were breaking the code generation somehow. Just to make sure that it wasn’t my code that was buggy, I disabled optimisation for my code only and let Quake’s code use full optimisation.

The bug remained, so I was fairly certain that my code was fine. To be honest, there’s not much GameCube specific code in there but I wanted to be really sure it wasn’t my problem before blaming the tools. You know what they say.

GCC’s -O1 switch turns on a bunch of optimisation switches, so I systematically went through all of them, checking to see if any broke the code generation. And sure enough, one of them did (-fmerge-constants).

So with the naughty switch disabled (-fno-merge-constants), Quake now runs without crashing and with (almost) full optimisation. And boy, does it run. At 320×264 (PAL), demo 1 runs at comfortably over 70 frames per second. At 640×528, it runs at just under 30.

I implemented input and audio too, so the game is quite playable. Unfortunately, Quake uses the standard C library’s file functions for save game access, so there’s no support for loading and saving games yet. I’ll need to convert that code to use the abstract file system instead.

I also need to convert a load of code which expects the user to press “Y” or “N” into something more suitable for joypad users. I currently map the A button to “Enter” and the B button to “Escape” so they seem like good candidates.





The Cave Story port uses SDL

18 07 2007

Last time I mentioned writing a common abstraction layer for Cave Story as an intermediate step to getting it up and running on the GameCube.

I decided on SDL for handling as much of that layer as possible. This has a few advantages:

  • I can test the port on Windows.
  • I don’t have to write so much code.
  • The process of porting to other platforms is simplified.

There are quite a lot of references to RECTs throughout the code, which I don’t yet want to convert to SDL_Rects. That may sound silly, but SDL rectangles are stored as “left, top, width and height”, whereas Windows rectangles are stored as “left, top, right and bottom”.

It’s not a large difference, but while converting a few snippets over to the SDL way isn’t at all difficult, the number of RECT references is large enough to cause a few evenings worth of tedious and error-prone work, which I would rather skip! I just want to get the game up and running with as few far-reaching changes as possible.

So instead, I convert RECTs to SDL_Rects at the last second, just before blitting.

But anyway, there is one glaring hole in my longer term plan. As far as I am aware, there is no stand alone GameCube port of SDL. If believe there’s a version for GameCube Linux, but not a stand alone library. Fortunately, porting the parts of SDL I use to the GameCube probably won’t be much more work than I would have had to do anyway.





Cave Story source

13 07 2007

After the initial hiccup from a few days ago, Pixel sent me the source code again and it arrived safely.

I took some time last night and this morning to skim over it and get it compiling using Visual C++ Express. It wasn’t too much trouble, only requiring some brief fixing up of resource scripts, different DirectX SDK locations and the odd thing which has changed with the newer version of the compiler.

I was really surprised to find that most of the code is in very readable English! The comments are in Japanese, but all the variables and functions are in English. I expected them to be in Romaji (because C++ identifiers are limited to a subset of ASCII). Japanese programmers deserve some credit for translating and programming at the same time!

While the code is generally clean, it is very Windows-centric. Some data files (notably the music and end sequence images) are linked into the executable as resources and there are also many uses of Windows types like RECT and BOOL throughout the code.

Handling endianness and debugging it on the GameCube is going to be difficult. I think I will need to go over all of the file loading code with a fine toothed comb and do what I can.

While ufo_z’s PSP port is based on Cave Story 1.0.0.7, I noticed that the version I have is 1.0.0.4. I’ll need to check with Pixel to see if he’s accidentally sent me the older code.

This morning I set about separating the source code files into generic and Win32-specific directories. This will make it easier to strip out any unnecessary Windows dependencies and help define a common abstraction layer which can be used between platforms.

It may be that on non-Windows platforms I will supply a dummy windows.h header file just to define the Windows types that Cave Story needs. The advantage of this is that my modified sources won’t diverge too much from Pixel’s, making patching easier in the future. The downside is of course that doing that would be a kludge, fixing the problem at the symptom instead of at the cause.

But anyway, that’s enough Cave Story for today. I have proper work to do.





Source code: almost gotten!

11 07 2007

Pixel sent me the source code for Cave Story… but I didn’t get it.

Unfortunately, Gmail decided that the viral threat of the archive was clearly too great to accept and promptly bounced the message back to him. As if this is not difficult enough already!

Trying to talk with someone who doesn’t necessarily speak your language well is a bit of a minefield. Many English words have several meanings which are only disambiguated by their context. If the reader doesn’t pick up the context just right, the meaning could be lost.

When trying to phrase things simply and unambiguously, I find it difficult to keep the tone which I would like. In English, sentences are considered polite if they are phrased in a complicated or indirect way. For example, “would you mind if I borrowed your magazine?” as opposed to “give me your magazine”.

Maybe the key to conveying tone of voice would be through cunning use of smileys. I could probably look into that but I really don’t want to get to the stage where I delimit each sentence with a string of faces in order to set the tone!

It struck me that I may be trying way too hard to simplify my English. I learned a bit of Spanish a few years ago and I found that reading it was much easier than writing or speaking it.

I wonder how difficult people who are learning English find it to pick the meaning out of the fluff.





Cave Story

26 06 2007

Thanks in no small part to the wonderful Shih Tzu, it looks like the GameCube version of Cave Story may happen. I have Pixel’s permission to go ahead with the project but he’s not sent me any source code yet.

Additionally, I have Shih Tzu’s permission to use his work in the legendary AGTP English translation, but I’m still waiting for Gideon Zhi’s. I can imagine his AGTP mailbox gets rather flooded with Pokémon translation requests, so I am happy to wait!

I feel bad about having Shih Tzu translate so much for me. It must be a time-consuming process and I bet he’s got other things he would rather do. To say “thank you” I’d like to get him a little present but I’m not sure what. Hopefully he has an Amazon wish list or something like that. I suggested that I could send him something Scottish, but I don’t know if it would be wise to take me up on that offer!

In related news, it looks like there’s going to be a freeware port to the PSP too. A chap called ufo_z put together a Cave Story remake and got Pixel’s blessing to continue with the original source code.

Lucky guy! I would have loved to do the PSP version!

Edit: ufo_z has released his first release candidate! (Wow, that was fast!)