SokuLobbyTouhou 12.3 Server – Part 2

UPDATE August 16, 2010: Dedicated page for the project
UPDATE August 8, 2010: New post, view it here.

If you haven’t read the first post, then go here.  I’m starting to get really sick of hearing the intro music for this game.  I keep it on mute most of the time.

Ah, today was a good day.  I finally got the sync code in place – real sync code.  I’ve been scratching my head over this problem for nearly a week.  Today I finally got it working.  Clients connecting will be in-sync.  In the process, I broke something else.  Button presses were being sent multiple times instead of once.  That has been fixed though.  I’ve put a DO NOT TOUCH THIS CODE tag by the sync code.

However, through recent testing, more issues have popped up.  One of them can, and most likely will, cause a de-sync between players.  The de-sync actually isn’t all that bad.  Players are still in their positions and performing the correct moves.  It’s the weather and spell cards that get de-sync’d.  The other problem; game clients will lock up when the match starts about 75% of the time.  That’s really bad.  I know what is causing it, but not how to fix it yet.

I have analyzed the packets some more.  The “deck” packet is mostly labeled.  It appears that decks cannot be forced (sorry, no fish decks), which is a bummer.  Other things can still be forced, like characters, colors, stages, and music.  I’ve found that decks are verified before the game starts – odd since plenty of other things aren’t.  If the deck is invalid, the player will have no spell cards when the battle starts.  This could be a problem later on.  It appears that the server must send their deck first – which is bad because the server doesn’t know what the players’ decks are yet, so it can’t send one.  Luckily, the clients request the server’s deck twice (yet again, strange).  This could be a ticket out, the server will know the players’ decks by the second request.  I don’t know whether the clients look at the second “deck packet” or not, I need to do more testing in this area.  Hopefully this won’t end badly and require players to upload their decks manually every time they change cards.  Yuck.

I’ve been wondering if this game was coded so that a match-making server could be used.  Almost as if ZUN had plans for one.  Certain things just work out too perfect.  Here’s some things that stick out to me:

  • The server can override the client’s profile name
  • The server can force clients to press buttons they didn’t press
  • The server chooses characters, colors, the stage, and music – even if they aren’t set to random
  • Sync packets can easily be relayed without (much) analysis.

After looking through some of the options available to me, I’ve come up with a better list of what I want and can do with this server.  These are just my ideas and could change depending on how things go.  If you have any suggestions, feel free to comment.

  • Random match-making games
  • Party matches – Players are partnered with others only in the same group (i.e.: friends or LAN)
  • Ladders/rankings
  • Tournaments (some could have special rules)
  • Custom games – Players can create a game with certain rules (forced characters, colors, stage, music)
  • Mirror battle – Play against yourself
  • View your previous matches and other players’ matches
  • Download replays of matches
  • Spectate other matches

I’ve started working on the website for the server.  Not too much progress there.  The website is where players will be able to choose a match to join, participate in tournaments, create games, and other things.  None of that is possible in-game unless I wrote a patch, which I don’t want to do.


Mirror Mode Sample

Here I was messing around. I found that there was a bug in my own code that would allow a player to be matched against themselves. This has been fixed – as far as I know, but I might include a “Mirror Mode” as a game option when this project is finished.


Sync Test with New Code

Just showing off the new code. The players are in-sync with each other except for the weather and spell cards. I also got all of the characters to appear in the character selection screen. I don’t know how I did it, but they’re there. When I play a match without the server, both players only have the minimum selection – odd o_O.

You can leave a response, or trackback from your own site.

Leave a Reply