Creating a (Non-Trivial) Lisp Game in 2018

Lisp programmers are a small group. According to the TIOBE index, Lisp currently sits at #32 on their ranking of programming language popularity. (Common Lisp specifically is somewhere between 51 and 100.) You can certainly imagine that Lisp game programmers are an even smaller group. And then when you consider non-trivial games, the games made by teams, the ones that are significant enough in scope to potentially fund the studio building them… well, I don’t think it’s much of a leap to say that you can probably count the number of those games on one hand.

Suffice it to say that not a whole lot has been written on the art of developing games in Lisp, relative to other languages. As a leader of one of the aforementioned five-or-fewer teams building a sizeable Lisp game (Common Lisp, in our case), I want to contribute to that collective knowledge base. But first, a caveat: It would be premature to consider either (defun games ()), as a studio, or myself, personally, as any kind of “authoritative voice” in the Lisp game community. Spycursion is the first game that we as a studio are producing, and it hasn’t even been funded yet. (Hint hint, Kickstarter, Feb. 26, hint hint!) And although I was a hobbyist Common Lisp developer for about seven years before starting work on Spycursion last year, there’s still a lot about this language I don’t know, and there are certainly people who could write better/faster Lisp game code than me… I’m just the only one who was insane enough to start this project. 😉 We also recently picked up another developer (he hasn’t introduced himself yet, but he will) whose opinions may differ from mine. Taken altogether, what I’m trying to say is: I’m not a guru. I’m just one guy trying to find his way on this bizarre-yet-beautiful landscape, just like everyone else!

Aaaanyway, Lisp games. The first thing you should know, before you go tell all your friends “Hey, they wrote Spycursion in Lisp, let’s create our Overwatch/Pokemon/Dark Souls cross-over in Lisp, too!” is that Spycursion is weird. The game itself is weird, its architecture is weird, its developers are weird… Point is, we’re working with some parameters that make Lisp not only suitable for Spycursion, but perhaps even the ideal language for it. Your Overwatch/Pokemon/Dark Souls cross-over may not fit the bill. (Or it may. I’ll let you know after we release Game #2.) It’s also important to remember that Spycursion has a client and a server component, both of which are written in CL. This was not always the case for the client; I’ll share that story in a minute. But let’s talk about the server first.

As we’ve mentioned before, Spycursion has its own programming language. You may have read about how domain-specific languages (DSL’s) in Lisp are grand, how they’ll make your coffee for you, blah blah blah. In my experience, a lot of the conversation about this can get pretty academic, but here’s a summary of what happens when you compile and run a Slang program in the world of Spycursion:

1. Compilation: The server parses your program (assuming it is syntactically correct) and creates a tree of Lisp forms from it.
2. Runtime: Some contextualization happens with that tree of Lisp forms, and then it is evaluated within the context of an in-game device.
3. (Optional): If the program needs to communicate with another program on another in-game device, via in-game network, then some magic happens to determine where that program is, and runs it, too.

This is of course a lot more complicated than I’m making it sound, but it’s still far less complicated than in probably most, if not all, other mainstream languages. Lisp allows you, as a player, to run your own code within someone else’s online game. (And yes, we do run security checks on your code before we parse it. We’re not n00bs, thankyouverymuch.) This is not merely simulated. There are plenty of places within Spycursion where we “cheat” to make things easier on ourselves — hey, we’re an indie, cut us some slack — but Slang is not one of those places. Just thinking about trying to do all of this in C++ gives me an icky feeling. (I eagerly await the e-mail from someone telling me how you can do it in C++, if you just jump through these 27 hoops…)

So, yes, Lisp is awesome as a game server, but I have a feeling that’s not what most of you are here for. You want to know why we’re using Lisp for the Spycursion client, and how you can write your own amazing thing in Lisp too, and clearly the answers are because I’m insane and you should stop listening to me because it’s fun, dadgum it, and by being a masochist early adopter and maybe having a fairly simple game, graphically. Sarcasm aside, these questions deserve longer answers:

Why Lisp (for the client)? Okay, story time. Long, long ago, when the Spycursion server was just Slang and a WebSocket interface and not much else, I set about creating a text-only testing client. I did this in Python, figuring it would be relatively quick and easy, which it was. At this point I’d not completely decided on how the client would be implemented, but I reasoned that, despite Python not being my best language, it would be easy to find developers for — so I could handle doing all the server-side Lisp as long as I had someone else dedicated to the client.

But there was a problem: Writing in Python just wasn’t fun. Some of you may not understand this, but it’s a phenomenon I’ve heard about before — once you get “spoiled” by Lisp, you have trouble getting motivated to code in any other “lesser” language. This was before we existed as a studio, when I was doing this project entirely by myself, so I didn’t have anyone else to shove the Python work off to, but I knew it was important to get something visual produced so that I could begin to show people (not simply tell them) what Spycursion was about.

So I chucked the Python client, rewrote the thing in CL, and around that time, started getting ideas of what I felt this fledgling studio could be. In my opinion, the reasons “nobody programs in Lisp” mostly boil down to, well… because “nobody programs in Lisp.” The community is small, so there are few tools available, so the community doesn’t grow because people don’t use Lisp for major projects due to a lack of tools. This is even more true for Lisp games specifically, but I believe that this chicken-and-egg problem can be helped by creating a well-known game in Lisp, if only to point to it as a success and prove that it can be done. Additionally, by open-sourcing the client code (which we’ve not done yet, mostly due to legal questions that need answering), we show new and aspiring Lispers how it can be done. Again, to avoid getting ahead of ourselves — this thing could still fail, perhaps in spectacular fashion. But at least if it does, you’ll get a front-row seat. 😉 And I guarantee you that it won’t be because of the programming language we chose.

Why do you think it will work? As I mentioned before, Spycursion is weird. There are very experienced people within the Lisp community who think that Lisp, in its current state, is not ready for serious game programming. I have no basis on which to disagree with them, but I do think it depends on the type of game you’re creating. Spycursion has several things going for it that make it different from what you might imagine as a “typical game,” especially a AAA game:

  • There’s no twitch action. An ill-timed garbage collection isn’t going to be the difference between life and death. As of yet, we’ve made no attempt to customize GC or really push for low-level performance in ways that might be challenging to do in Lisp. We might, at some point, but I’m guessing we won’t even need to.
  • Much of the tricky stuff is offloaded to the server. Don’t underestimate the advantage of having a server (read: one single platform, of your choice) running parts of your game. That means fewer shared library headaches and fewer client performance woes — assuming you do everything asynchronously — for starters. (Oh, but please don’t be that developer who forces a network connection for your single-player game. That’s just rude.)
  • We don’t need to build for consoles. Ever tried to run Lisp on the Switch? I haven’t… and I don’t want to.
  • Physics? We don’t need no stinkin’ physics. Or at least no physics that can’t be calculated based solely on what I remember from 9th grade Geometry.
  • We keep graphics simple. I don’t really know how to quantify that, but the game is meant to be played 3rd-person, from a distanced zoom level. (We let you zoom in, but I wouldn’t necessarily recommend it.) The assets will be relatively low-poly and there will be relatively few of them. Note that “simple” does not mean ugly. We’re aiming to make it all look good while still putting most of our effort into gameplay — graphics are one of the places we “cheat.” You’ll be able to judge how we’re doing once we finish the Kickstarter trailer.

Put all of the above together, and you get a picture of a fairly minimalistic game client that really gets out of the way and lets you enjoy playing. (Or at least that’s the picture I hope you get!) And to be clear, I am not saying that fancier, AAA-level games can’t be made with Lisp. I’m saying I really don’t know, but this is our attempt to get as close as we can with the resources we have.

How are you doing it? I would say “pain, sweat, and toil,” but that kind of describes all game development, so…

  • The engine. Oh, just kidding, we aren’t using one. In 2018, I know of at least three Common Lisp 3D game engines in varying stages of development: First Light, Trial, and cl-bodge. In 2017, when I was researching these engines, they were all either too early in development or otherwise just didn’t fit our needs. They might now, but I haven’t followed their progress enough to know for sure. This brings me to what is maybe the most important thing to know if you’re looking to write a non-trivial Lisp game in 2018: You have to be okay with writing a lot of things yourself. Lisp makes this fun to do, and might still even save you time overall depending on just how much you need to write. But it’s a very different mindset from being, say, a plug-and-play JavaScript developer.
  • CEPL. CEPL is an abstraction layer around OpenGL which has been a joy to work with, once I figured out how. (Tip: See the author’s video stream, it’s great.) Its goal seems to be to make OpenGL lispy and fun to work with, and I really think it has achieved that. Spycursion uses CEPL extensively, and while I’m sure we’re doing some things suboptimally, performance has been fine so far. We’re also using cepl.sdl2 which brings in cl-sdl2.
  • QTools. QTools is a lispy wrapper around Qt 4. Most games probably won’t want the heft of Qt, but our device UI actually needs something a bit more featureful, so it’s worth mentioning. We have run into some build problems with QTools, particularly on Linux. Add in that there doesn’t seem to be a Qt5 update on the horizon, and we may well end up switching away from it (to what, I can’t say yet). But it’s currently working well, for what we need it for.
  • Other libraries

And that’s it! Lisp game development isn’t for everyone, but I stand by my assertion that it can be done, and done well, given the right game — and perhaps the right amount of patience.

TL;DR:

  • Use CEPL. Or one of the engines, if they fit. Or maybe both.
  • Yes, you should do it, even if you fail. That’s how the community grows.
  • Be prepared to write a lot of stuff yourself. This is not necessarily a bad thing. It’s fun!
    • Except skeletal animation. Don’t write that yourself.
  • Support our Kickstarter starting on February 26th!



Post-PAX Plans: What’s Next?

PAX was an amazing experience for us and we’re incredibly happy with how it turned out. We want to thank everyone who got in involved, no matter how big or small your contribution. Even if you just retweeted one of our PAX tweets, you’ve helped us and that means a lot. We’re extremely grateful for your support.

What’s next for (defun games ()) and Spycursion you ask? Well, let’s run you through it.

Currently, we’re deep in development on a whole bunch of game developer stuff. Animations, bug squashing, camera code, etc. Nothing super exciting or announcement worthy just yet. We’ll be sure to update you on anything exciting!

We do have a few other things planned, though. Firstly, we’re getting ready to launch our Discord server. This will be a great place for people to discuss Spycursion, us, the weather, or whatever else strikes your fancy. More details on that coming soon.

Secondly, since our first puzzle event was such a success, we’re thinking of doing another! If you took part in the PAX West puzzle event a couple of weeks ago then stay tuned because we’ll have more to say about this soon. If you have any feedback about our last puzzle event, please don’t hesitate to hit us up on Twitter, email, or Reddit.

And, of course, we are continuing to plan the various aspects of our Kickstarter campaign. We want it to be as good as it can possibly be so don’t hold your breath for a launch date just yet. It’ll begin when it’s ready and when we’re ready.

Join the Team

As always, we’re looking for lovely people to join our team and lend a hand. If you, or someone you know, is into the idea of Spycursion and has some expertise in software development, particularly experience with Common Lisp or a Lisp-like language, then get in touch. We’re extremely passionate about Spycursion and, like you, we want to see it come to life as soon as possible. A little help on the development side will allow us to bring that dream closer.

We’d love to hear from you! For more information, see here.



First Trailer For Spycursion!

Spycursion character ostensibly hacking a datacenter

The first ever trailer for Spycursion is now live! It’s a trailer representing an early version of the game and does not represent the final game. Hopefully, it should give you an idea of what Spycursion could look like in action!

Enjoy! And spread the word!



Our Plans For Kickstarter

Earlier this week we shared our ideal vision of Spycursion. A “what if” of the game’s ultimate potential if everything works out like we hope it does. In order to approach that potential, we’re taking this project to Kickstarter.

Our project is a big one, and we’re incredibly ambitious about where we want to take it and what it can be. This is why we’re taking this route. We want Spycursion to be everything we say it will be and more: a sprawling world of subterfuge and espionage centered around a variety of busy and detailed cities where hacking, brokering information, performing espionage and daring thefts are just a few of things you’ll need to do to get by.

As with all good things, though, this is going to need capital, something that we have a strong need for as a small indie studio. I say capital because it isn’t just money we need, we also need talent. As it stands we’re a very small team, there’s only a small handful of us, and only one of us is spearheading the actual development of the game at the moment, and that’s Scott. Dan is the Community Manager and PR, but he has no clue when it comes to coding or programming (it’s true, I really don’t).

If you’re reading this and you want to join the team, see here for more info. We’d be delighted to hear from you!

Anyway, enough preamble, let’s talk details.

  • When will the Kickstarter launch? Well, to be honest, we don’t know yet. We’re still working on building an audience and getting the word out about Spycursion. We’ll launch when we feel it’s right. Don’t worry, though, we’ll be sure to give plenty of notice. If you’re paying attention you won’t miss the launch.
  • What is our goal? We’re quite ambitious for Spycursion because we have so much we want to do with it. That’s why we’re currently thinking of $50,000 as a starting point. That number may change as we go ahead, but that’s our base number.
  • Elastic development. The better the campaign goes, the more of Spycursion’s initial vision we’ll be able to fulfill at the game’s launch! Over time, we can, of course, expand the game based on player feedback and revenues; it might just take longer that way. Some game features will be included as Kickstarter stretch goals.

What can you do now, though? We’d be extremely grateful to anyone that wanted to back the Kickstarter when it launches. Otherwise, though, if you’re a dedicated follower or simply someone who likes the idea of what we’ve got planned, spreading the word about Spycursion and its upcoming Kickstarter is the best thing you can do right now. Share it with anyone you know who might be interested, stay tuned to our social media pages, and help share the exciting updates we’ll have in the future.

We hope you choose to come along with us for the ride, and we hope to see you there when the Kickstarter launches!



What Spycursion Can Become

Can I speak freely for a minute? Marketing your own game sucks. It especially sucks when you’re an indie studio, and it sucks even more when your game is shaping up to be as ambitious as Spycursion. The last thing we want to do is promise features that end up being outside the scope of what our Kickstarter revenue will allow. And yet, I believe that for Spycursion to reach its full potential, our fans and supporters (that’s you!) have to understand what that potential is.

So, rather than the overly conservative details we’ve been putting out, in this post I’d like to give you a glimpse inside my mind (careful, it’s a scary place) at the other end of the spectrum — the level 100 version of Spycursion. Please, treat this post not as information, but as inspiration. If you just want to know what Spycursion will look like when it launches, you probably want to skip this one.


In addition to the core details we’ve already mentioned…

  • Simulated economic, business, and political systems, centered around technology and security.
    • Market fluctuations, of stocks and cryptocurrencies, based on player activity, missions, and random world events.
    • Run your own corporation, by yourself or with other players. Do business legally or illegally, but don’t get caught!
      • If you do, you’ll go to prison and have to break out, or convince someone on the outside to break you out.
    • Alternatively, you could just blackmail a politician to get the laws changed in your favor…
      • … or hack the laws themselves, which are implemented as smart contracts…
      • … or become a politician yourself, if you’re famous enough.
  • Spycraft like in the movies (and hopefully better).
    • Need to follow someone? Hack their phone and watch their GPS…
      • … or do it indirectly by hacking security cameras in the area…
      • … or do it the old-fashioned way and hire informants.
    • Got a tough corporate target to crack? Try buying a phone, filling it with malware, and mailing it to the company to attack their Wi-Fi.
    • Drones. Because of course.
  • Learn the ins and outs of software security.
    • Open-source Slang software can be audited by players for security holes…
      • … but even proprietary software can be fuzzed.
    • Security holes can be found as random world events, in which case they’ll be publicized.
      • Or they can be found by another player, in which case, they can do what they please…
    • Be careful with software you find out in the game world. You never know what kind of backdoors it might contain.

As we’ve mentioned before, our ability to level Spycursion up to 100 depends entirely on you. If you’d like to help with that, please start by joining our mailing list! You should see a subscription form at the bottom of this post.



A Few Tracks From The Soundtrack of Spycursion

We’ve shared a few of the visual aspects of Spycursion, but not the soundscape. That’s why we’re super excited to share with you three tracks from Spycursion’s soundtrack.

These awesome tracks are just a few of the tunes that will permeate your not-so-legal adventures in a dystopian future run by corporations.

Check them out. We hope to share more with you in the future!

Created by the wonderful Vanja Mihajlovic – https://soundcloud.com/vanjamihajlovic



Say Hello To Dan!

Hi, I’m Dan. I’m from the UK. I’m also Spycursion’s Community  Manager/PR man/Scott’s partner-in-crime.

I’m a freelance games journalist by day, and Spycursion Community Manager by night (although it doesn’t always work out that way). I studied a bit of PR at University so I’ve been eager to get some experience ever since. That’s when Scott’s endeavor landed on my lap.

I found his project and saw that he was looking for a PR/Community Manager/person to run Spycursion’s social media accounts. Spycursion seemed like a uniquely fascinating game, and I’ve always had a soft spot for cyberpunk fiction and hacking aesthetics (although I know nothing about coding!) so I applied for the job. I got the position, and now, several weeks later, here I am writing about myself on our shiny, new revamped blog.

Even though we’ve still got a long way to go, it feels like we’ve come a long way already. Rebooting Defun Games’ social media efforts and getting the word out about this weird and wonderful game has been super exciting. Although we’re starting from scratch, the feedback we’ve already received has been amazing.

We have some big things planned for Spycursion and I am genuinely super excited to be part of this project. I hope you enjoy what we’ve got in store, and I hope you’ll join us on this journey.

 



Traveling the (Game) World

Take a look at the following screenshot:

An aerial view of a city in Spycursion

This is an aerial view of a city from an early development build of Spycursion. (In other words, the details may change, but this is the general aesthetic.) It represents one city, out of several cities that will make up the urban game world of Spycursion. We plan to scale the number of these cities based on player base and story needs, but will probably start with five or six.

Each city will vary a bit in size and what it contains; we aren’t ready to show the building interiors yet, but our goal is that every building you see will be explorable — nothing that’s just “filler.” Among some of the purposes these buildings might serve in the game:

  • Bank
  • Internet cafe
  • Library
  • Electronics store
  • Corporate office
  • Datacenter
  • Police station
  • Your apartment!
  • Others we’d like to keep secret… for now.

Your game character will roam this world, making mayhem, stealing secrets, avoiding the law… and remember, this is only Spycursion’s “physical” world. We’ve barely gotten started on showing you the digital one!



Speaking Slang

In this post we’re going to discuss one of Spycursion’s core features, an in-game programming language called Slang. By “core” I don’t necessarily mean a feature that players will interact with all the time (though I’m sure some will), but a feature that is literally a core part of the game. Spycursion contains thousands of different electronic devices — servers, laptops, phones, etc. — and, to some extent, all of them run on Slang. In fact, the Slang language was the very first code we wrote, which should give you an idea of how central it is to the game.

From a language design perspective, Slang has two main goals: Ease of use/learning, and the ability to obfuscate. The first goal is self-explanatory — it should be beginner-friendly. Here’s a simple program:

name = sys.args[ 0 ]
sys.print( 'Hello, ' name '!' )

As you might be able to guess, this program simply takes one argument, a name, and prints out a hello message. You might run this on the command line with “./hello Scott” and the program would print “Hello, Scott!” The code could even be shortened to one line instead of two:

sys.print( 'Hello, ' sys.args[ 0 ] '!' )

We hope that Slang’s syntax is easy to pick up, even for players who have never written code before. But experienced programmers will want to do a lot more than say hello to themselves, which brings us to Slang’s second design goal…

coin_flip() = sys.rand( 1 )
fun heads_or_tails ( )
    if ( coin_flip() == 0 )
        sys.print( 'Heads' )
    else
        sys.print( 'Tails' )
    fi
nuf
i = 0
while ( i < 10 )
    heads_or_tails()
    i = i + 1
done

You might think that the above code snippet is the equivalent of flipping a coin ten times… but you would be wrong! Its practical result is to flip a coin once and print that same result ten times. That’s because in this example coin_flip() is a variable, not a function.

There are plenty more nasty clever obfuscation tricks you can do with Slang. Virtually any string can be used as a symbol name, and symbols are delimited only by white space. Using the above example again, this means that i<10 would have a very different meaning from i < 10.

Why does this obfuscation matter? Remember that Spycursion is meant to be a game of… well, spies. Spies sometimes use Trojan horses — gifts, ostensibly well-meant, with a hidden nefarious purpose. And what better Trojan horse, in the digital age, than some piece of open-source software? “It’s safe, I promise! And you have the source, so you can even review the code yourself!”

Slang is still evolving, and will likely continue to evolve even after Spycursion is released. But for now, we’d love to have your feedback. How are we doing on our design goals of ease-of-learning and obfuscation? Beginners: Did this post make sense to you? Are you excited to learn more about Slang and/or Spycursion? Non-beginners: What would you like to see from Slang? Please get in touch!



Inventing the Internet

What is the internet? It’s billions of devices, all running their own operating system and software, networked together, “speakng” to one another. This networking works because the devices all “speak” in common protocols, some of which you’ve probably heard of: IP, TCP, HTTP, etc.

Spycursion’s own version of the internet is similar. It contains thousands of different electronic devices — servers, laptops, phones, etc. All of these devices are connected, and most of them can be located and/or hacked (with varying levels of difficulty) by players.

Notice the word “located” above. Just like in the real world, Spycursion’s internet is a big place. If you’re on a mission to steal data from someone’s laptop, you could go about that in two ways: You could access it physically, or you could hack it remotely. The latter method is obviously safer, but you would need to know its IP address (its “home” on the internet), which you wouldn’t necessarily have at first. That’s where tagging comes in — identifying the device, out in the game world, and getting its IP address, so that you can hack it remotely from the safety of your own apartment. Very spy-like indeed.

We’ll explain more about the hacking and security mechanics in a future post, but in a nutshell, what you’ll need to do to hack a target over the internet is scan it for vulnerabilities — gather information on what software is running on it — and then deploy exploits against the vulnerable software. You can create these exploits yourself, using the in-game programming language called Slang (another future blog post), or you can purchase them, find them in a secret location, or steal them from an unsuspecting victim.

The miniature internet in Spycursion has a lot of similarities with that of the real world — and being a video game, of course, you are free to wreak mayhem all over it without consequence. Your game character, however, may end up making a lot of enemies…