Singleplayer without networking

I’m going to try and post news about what I’m working on a bit more often again. Here’s my list of what I need to do for an initial Gauntlet mode release:

Gauntlet tasks to do before initial release

Get local games fully working
– Object for holding game state in Gauntlet mode
– Auto-repair system + vehicle swap ability
– Gauntlet game flow from menu to end
– Score system
– Level generation tweaks
– Update scrap drop system
– Item unlock system
– Update How To Play screens
– Test and balance gameplay
– Music?

Looks a bit long and scary, and yes it is rather a lot, but not all of those things are major. I thought the first one was pretty major and I’ve already got it done. What I’m going to do is, each time I complete one of those, I’ll make a post and talk about that line item in more detail. When they’re all done there’ll be a real game update.

Let’s talk about “Get local games fully working”.

Local Singleplayer

I’d like to start with Minecraft as an example here. When Notch originally made Minecraft, the singleplayer and multiplayer components of the survival mode were separate. Bugs would often appear in one but not the other – usually multiplayer because networking is hard, man. A lot of work had to be done twice, in the singleplayer game and also in the multiplayer one. I read an interview somewhere where Notch mentioned that one thing he’d have liked to have done differently was going fully multiplayer from the start, and having the singleplayer just run on a local server. Eventually that’s exactly what happened: The game was changed to be always multiplayer behind the scenes, and that’s why anyone can easily join your singleplayer game on LAN now if you choose to open it up.

When I built Scraps I decided that likewise, having one networked system that everything used was the way to do. In the interests of simplicity, the Melee game mode always runs a separate server. That’s why it was easy to add the “Allow other players to join” option to singleplayer games. Whether you host a multiplayer game or whether you start a singleplayer game, a local server starts up and you silently connect to it.

I don’t think I made a mistake in doing it that way because it works well, but there is an effect on CPU performance because some calculations have to be done twice (the graphics card gets away free here because I run the server with no graphics). For Gauntlet mode I want to have good performance on moderate PCs even on later levels with big vehicles, and getting rid of the need for the server is an obvious win there. Plus I’d done a lot of the work already as I’d needed it in the past for testing. The changes basically entailed writing new paths for things when there was no network present, so what usually had to wait for server confirmation etc would do its own thing.

Now, converting a singleplayer game to multiplayer is always a big job, sometimes such a major change it’s just about impossible. But converting a multiplayer game to singleplayer has been a lot easier! Not least because things always get simpler rather than more complex. This class structure in Scraps:

becomes this:

I’ve actually still got a couple of minor issues to fix but it’s basically all working. As a bonus, when the Gauntlet update comes out you’ll also be able to play the Melee game type in a true local mode – I’ve got that working as well – if you have “Allow other players” unticked:

That should give a bit of a performance boost for people with low-spec CPUs (to be clear, you won’t see this performance boost now, it’ll come with the Gauntlet update).

 

Bookmark the permalink. Trackbacks are closed, but you can post a comment.

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*
*