Sept 17, 2012
I've been telling a few of my friends that I've been writing a game. I have an entire game engine with a tiny amount of gameplay sitting in my vault under the names "Hack Mars" and "AltSci Cell" (Cell is where this blog comes from).
Unfortunately the reason those games are halted is because I would either need to hire an animator/graphics person or work on it in my free time at the expense of my other projects. After it was finished, selling it would be fairly easy of course, but a risk nonetheless. It turns out that I've made only a little progress on my graphic skill and business skill in the past 6 years, but that my taste has changed. What has convinced me to rewrite from scratch is coding skill and design choices. Instead of calling Python from C++ and passing XML back and forth, I decided to create a Python module using SWIG. This turns out to have a few weaknesses which I have barely even noticed so far. Python is easy to write, natural, and fast. The reason I chose the opposite route originally was because I felt that Python should be called from C++ instead of the other way around. Python should not have the power to crash, so all the stuff you write should act normally no matter what you do. When you write a module for Python that goes out the window because you are handling pointers in many cases. Even if you choose to wrap them in something that doesn't let you crash, you lose the innocence of Python. On the other hand, ctypes. You can't explain ctypes without saying that it is possible to crash Python by using it improperly. In fact, many use cases of ctypes are dangerous. If you consider for a moment the reason why noexec flag for mounting exists on Linux and BSD is to prevent users from doing exactly what ctypes allows you to do, you know that something terrible is going on. Which gives me perfect justification for writing a Python module in C++ that exposes everything (functions and classes) that my C++ program has. Therefore I simply have a main function in Python that does everything that my main function in C++ does except in Python. What benefit does that give you? Ease of code writing. So when I create 100 NPCs and 1 character, I do that with something that looks like:
class NPC: def __init__(self, name=None, type=None, model=None): self.name = name self.type = type if model: self.model = model else: self.model = getModel(type) #end if #end def NPC(name, type, model) #end class NPC names = ["John", "Karen", "Steve", "Wendy"] for i in range(100): mtype = random.choice(types) model = getValidModel(mtype) npcs.append(NPC(random.choice(names), mtype, model)) #next i pc = Player(user_name, model)
Not too difficult huh? Well when the NPCs get to be 2000 lines long, Python saves the day. Arrays, strings, random choice, and so forth make Python quite easy to use. I have written a lot of C and C++ and I always have huge debugging problems. Python's design is strange. I have problems, but it's either a limitation or it's a next-level issue. That's really where I need to be. Limitations of Python are sad, but for anything where there is no limitation, the code quickly becomes as good as it can be allowing me to run into the limit of programming. So what to expect from AIgame aka AltSci Cell? Each NPC in the game will walk around with purpose and you'll feel a little like you're in GTA but something strange is going on. If you're a game connoisseur, you might recall Persona 3/4 or Yakuza (龍が如く). But when you click on a person, their hair will sway as they look at you and a blinking cursor will show up on the screen. You will raise your eyebrows and type "Hello". That's right, it's a text-based adventure in 3D. If you have really explored the breadth of video games, you might consider this game to be more akin to Zork, Leisure Suit Larry, MUDs, or certain visual novels. What fun is a simple RPG with text input? AI. That is my quest and I am confident that I will provide an enjoyable experience.
I wrote a short blog post on AltSci Brasil about my plans for my next visit.
Also my brand new bike was stolen in West Seattle. Today I posted a flyer at Recycled Cycles. I am not going to rest until it is found. Bicycle thieves have a special place in hell for their transgressions.Permalink