Hello, I've been here before.

posted in Jemgine
Published February 02, 2011
Advertisement
I'm cross-posting this to my journal on Gamedev.net because the journals there are now apparently free. A long time ago I had gdnet+ and I had a journal there, where I talked about some sort of mud engine I was working on or something. I'm sure that mud engine totally sucked, and the one I spent the last week working on is a thousand percent more awesome. (It's pretty amazing how much you can get done in a few days if it's interesting enough.)

So, GDNet people : I know you have no idea what I'm talking about. I've got this 2d engine called Jemgine. It's on codeplex at http://jemgine.codeplex.com And, well, it's pretty much the most awesome thing ever made.

I haven't updated in a while. I have a good excuse, but no, I won't tell you what it is. I spent some time creating a model editor, and an animation editor, so I could create some sort of skeletally animated 2d models. What I discovered, however, was that they totally blew. The whole time I was thinking, I'd really like to just animate the whole entity. Move the chunks and splines and whatever around. So that's what I decided to do.

I'd already written a working skeletal animation system, so it was pretty easy to do. Now I can animate the entire entity. It's a pain, because I can't see the skeleton in the map editor, but I'll fix that.

It needs a lot of polish before I can show it off, but the results are already pretty astounding.


Meanwhile, I've been writing a MUD engine for some reason. I know nobody plays MUDs anymore, but I had an itch to write one so I scratched it. It's my first time using SQL too, so that's been interesting. Lets look at what I think is the most interesting part - the command matcher. Here is the definition for the command 'look'

Parser.AddCommandSet("LOOK", new Matchers.SequenceMatcher(new Matchers.KeyWordMatcher("IN", false),
new Matchers.ObjectMatcher(true, true, true,
new Matchers.OSAnd(new Matchers.OSContents(0, "WORN"), new Matchers.OSShortHand()))),
new Commands.LookIn());
Parser.AddCommandSet("LOOK", new Matchers.KeyWordMatcher("HERE", true), new Commands.LookHere());
Parser.AddCommandSet("LOOK", new Matchers.SequenceMatcher(
new Matchers.KeyWordMatcher("AT", true),
new Matchers.ObjectMatcher(false, false, false, new Matchers.OSShortHand())),
new Commands.Look());
Parser.AddCommandSet("LOOK", new Matchers.RestMatcher(false), new Commands.SimpleEcho("I don't see that.\n"));


These four definitions will be attempted, in order, until one matches the input string. The second argument to AddCommandSet is a 'TokenMatcher'. It takes a token stream, and tries to interpret it in some specific way. KeyWordMatcher, for example, only succeeds if the next token is the keyword (Unless it's optional, then it will always match). Each token matcher does not just return true or false; it returns a list of every possible match. This is key to how the matchers work. The command parser explores every possible match at once. SequenceMatcher will try it's second argument for every single possible match of it's first argument. So, if a KeyWordMatcher is optional, and the keyword is present, it will return two possible matches. One with the keyword consumed, one without. This is basically how a certain kind of regex matcher works.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement