Castle of Chaos

Okay, I’m jumping on the ChoiceScript bandwagon. I had a different idea initially for my first CS game, but as I worked with CS, I discovered it would let me do a bit more than I suspected would be possible. The key is the ability to use JavaScript in the game. I’m not sure if what I do with JS will interfere with my ability to port this game as a native app to hand-held devices, but I’m not going to be concerned about that for now, as long as it’s playable on the web. Most hand-held devices have the means to play web-based games, they just aren’t native to the device.

My idea for Castle of Chaos is a mathematically generated huge maze on a 1000x1000 grid (yes, that’s a total of one million locations). You start at one corner of the maze, and see where you can manage to get to from there. The character is a Tunnels and Trolls based character, which doesn’t mean you need to know the Tunnels and Trolls rules (T&T is the second oldest RPG, for those who don’t know), but if you want to understand the mechanics used in the game, then you can check out the T&T rules. You can find a free abridged copy of the rules at

The complete and latest 7.5 rules that I’m basing my game on aren’t free, but can be found at

This game is basically a vehicle for me to figure out how to do certain things. For instance, one feature of the game will be the ability for members of the Trollhalla Inner Sanctum to use the attributes of their Trollhalla avatars in the game. The Trollhalla Inner Sanctum can be found at

This is possible because a particular URL already exists on the Trollhalla web site that allows the browser to pull the stats for the member when the member is logged into the Trollhalla Inner Sanctum in the browser. The URL returns JavaScript, so I pull it into the game by including a script tag in the index.html file for the CS game; I then transfer the values obtained from the JS to the stats variable in the mygame.js file. It’s working very nicely on my local machine; I don’t yet have any version of the game installed on the web for anyone else to look at or try out.

If the player is not a member of the Trollhalla Inner Sanctum, then I generate stats for them according to the character generation rules in T&T 7.5. Most members of Trollhalla have built up their avatar stats to much higher levels than are easily generated by the rules, so they will have an advantage in the game.

For a game this size, I need a save feature. I have some open source jQuery-based HTML5 storage system code that I created some time ago for other purposes, and I’ve figured out how to make it work with the CS interpreter. It took a while to figure out exactly what functions in the interpreter to call, and what arguments to pass them, but all my tests are now passing (though it will certainly need more testing). The way I’ve implemented it at this point, the links to save, load, and delete games are always on the page rather than being *commands that you embed in your scenes. This means the game can be saved at any time, and a saved game can be loaded at any time. There’s also the ability to delete any saved game. Since it uses HTML5 storage, it can save more data than you could save with cookies, and in fact the system allows the player to save multiple game states, giving each saved game a name to remember it by.

The big drawback to using this storage system is that you can’t save games on one computer and load the saved games on another computer. You can only access the saved game on the same computer that did the saving to begin with. There is a “password” system built into the CS interpreter that allows the player to copy a “password” that can be saved to a file, which could be moved to another computer the same way any other file can be. By pasting the contents of the file into a text area provided by CS (if you know how to enable it), you can restore the game that way as well. I think of that kind of saving and loading as an import/export feature. I’ve got some existing open source code written for doing that sort of thing, which I think I might integrate with the CS interpreter in the same way I’ve integrated the storage system.

Anyway, I’ve really dived into working with CS and the interpreter, and I’ll try to put up what I’ve done so far on the web on my Eposic server as soon as I get a chance. Won’t be this weekend, because I promised someone else I’d post some open source dice animation code for them. Plus, I’ve got to figure out exactly which CS files need to go on the web server when you install a CS game on the server. There’s probably some docs or discussion topics on that somewhere, eh.

Wow.

Looking forward to this.

Everything inside the “web” folder needs uploading, sounds delightful by the way, best of luck!

You make it out to be amazing! I’ll be sure to check it out when it’s out! :smiley:

@CJW, thanks, that makes it easy enough, so I might find a moment this weekend to upload what I have so far. When I do manage to upload the files, I’ll post the URL here.

One thing T&T is still under copyright, so using it will, at best, make it difficult to get hosted on CoG (You’ll need licensing from the owners of T&T). At worst the copyright owners can send you a cease and desist. You may want to check with the publishers (Flying Buffalo Inc. AFAIK) or create a small rule system of your own before continuing.

Hey, @Reaperoa, copyright and licensing are always concerns when making use of material created by someone else, and rightfully so. I don’t take those issues lightly. There has been plenty of wrongdoing in the T&T community where copyright and intellectual property rights are concerned, and I don’t intend to add more. However, I am in communication with both Ken St. Andre and Rick Loomis (head of Flying Buffalo Inc) on a fairly regular basis (I’m one of the admins at Ken’s Trollhalla web site, and Rick Loomis’s web site has a link to my site, pointing people to my T&T animated dice roller for use with online T&T games that aren’t fully automated, which few of them are). I won’t make use of T&T in the final product in any way that Ken and Rick don’t agree to.

I used to have a pure JS game up on my eposic.org site that was based on the T&T system and that allowed Trollhalla members to use their Trollhalla stats, and Ken was one of the players. The game went away for technical reasons, not for legal reasons; Ken wanted it to stay online. So Castle of Chaos will be a replacement for that game, only better.

Whether CoG hosts Castle of Chaos will be something to work out between all parties concerned, but if they don’t, I will host it on my own site. The Trollhalla members will be told where it is in any case, so if it’s hosted on CoG, it will draw at least a few dozen Trollhalla members to CoG on a recurring basis. I could also make a version of the game that doesn’t use the T&T rules but uses my own custom combat system; I’ll design things so I can easily switch out the combat code from T&T to something else of my own design. CoG should not have a problem with hosting such a version of the game, especially if I strip out all mention of T&T. But I’ll cross all those bridges after I actually have a working game.

At worst, I can pull out all T&T material and host the game on my own site, and I can live with that if I have to.

And I have already created a small rules system that I use in a non-T&T/non-CS online game of my own creation, as can be seen at http://eposic.org/diversions/mini-adventure/ .

If you’re in contact with the current copyright owners, I’m personally sure that something can be done to make things work. Just knew that T&T isn’t out of copyright (despite some old rumors to the contrary) and that people tend to forget (or completely ignore) the limits of fair use.

You seem to have been around the ideas enough to know what to do, just thought I’d mention the obvious so that it’s said and out of the way.

@Reaperoa, T&T is far from being out of copyright. But there are many things one can do that don’t violate copyright. This is how certain RPGs have been created, without violating copyright, but with similar mechanics to prior editions of a well-known RPG. In my case, I’m not going to expose many T&T rules in my game - just character stat generation, and I’ll state it in my own words, not quoting the T&T rules, but identifying the mechanic as the same mechanic that is used by T&T.

Other than character stat generation, I’m planning on using a couple of the same mechanics as T&T. Mechanics themselves can’t be copyrighted; it’s the expression of the details of those mechanics that can be copyrighted. You can’t copyright the mechanic of rolling three dice to generate a stat, for instance. Anyone who wants to use that mechanic for their game can use it. But if your description of rolling the three dice is expressed in a similar fashion to the description someone else gives, you may be in violation of copyright, or you may be guilty of plagiarism, or you may be covered by Fair Use. It can depend on how much you say and whether you give credit to the original author and other factors.

Moreover, titles can’t be copyrighted. I can call something Tunnels and Trolls if I want without violating copyright. If someone else (Flying Buffalo Inc. in this case) claims the phrase as a trademark, then I can’t use it for marketing my own materials without a license from the owner of the trademark, and then only under the terms of that license.

It all gets real crazy real fast, and most people don’t understand intellectual property laws at all. Some people think that if they distribute other people’s work but don’t charge for it, then they aren’t violating copyright. Some people think that if the owner of a copyrighted work gives the work away for free, then anyone else can give the work away for free too. Both of those ways of thinking are wrong.

I don’t claim to be an expert, and I’m not a lawyer, but I’ve pored over the legal statutes and done plenty of research. The thing is, no one, not even a lawyer, can say for sure how any intellectual property court case will go until it’s over. That being the case, it’s prudent for most people to steer as clear as possible of any potentially problematic situation, and reach agreements about everything if the work of another entity is involved in any way whatsoever. That’s why it’s nice when materials come with a license that lets you know the terms under which you’re allowed to use them, so you don’t have to find the intellectual property owner and try to hash out an agreement with them.

I’ve talked with Flying Buffalo and CoG and Ken St. Andre, and I’ll be implementing some of Ken St. Andre’s Tunnels and Trolls solo print games as CS games under the Flying Buffalo imprint. I’m using Castle of Chaos as a prototype and proof-of-concept, to hash out how some things will work in the official games. So I don’t know how fleshed out Castle of Chaos will ever be, and I don’t have the HTML5 local storage hard save system working for it yet, but I do have some working code online, if anyone would like to check it out. You can try it out here: http://eposic.com/diversions/chaos/mygame/index.html

I actually have four domains pointing to the same server, which allows me to have four different saved games, even though the code is currently set up to overwrite the game at each new location visited. If you want to try any of the other domains, that’s cool. In the URL above, just switch out eposic.com for one of the following three domains: eposic.org, eposic.net, or trollmystic.com.

Any feedback anyone cares to give would be much appreciated.

I’ll definitely give this a whirl and get back to you – it’s looking good so far :slight_smile:

I took a quick look, nice. When I get a chance will go through it more completely and give you some feedback.

Do you need to be smaurt

@HeroMaster, it always helps. :wink:

[Spoiler]

In the game, there are some secret doors and such that are more easily found if your character’s INT (the T&T version of smarts) is relatively high. But so far there’s not much to the game other than fighting and moving from one area to the next, once you leave the alcove and get past the first room. Getting past the first room only requires you to put in some numbers and then pull the lever and let it go. If nothing happens, try some different numbers. Most numbers you put in will teleport you out of the room to another area. If you just change X from 0 to 1, pull the lever and let it go, that will get you past the teleporter room and into the castle proper.

You will earn AP (adventure points) from killing monsters, and you can spend those AP by meditating when you acquire enough of them (10 times the stat level to raise a stat by 1 point). Right now, that’s the only way to heal your CON (T&T’s version of health); when you spend AP to raise your CON a point, your CON stat is charged up to full.

If you look at the stats display, you’ll see X and Y. They tell you where you are on the castle grid. The larger the sum of X and Y, the bigger the monsters will be on the average. You earn AP equal to the monster’s MR (monster rating) when you defeat the monster. But the bigger the MR, the more damage they can deal to you. Combat goes according to the Tunnels and Trolls combat rules, which I won’t go into (but a search on the web will find the free rules if you’re interested), except to say that each combat round usually goes to either you or the monster, with only one (or neither) side taking damage, except that each side takes any “spite” damage dealt by the other side.

I died this time around lol. I really enjoyed the game and look forward to more.

For your local storage, can’t you just do it how CoG does it? http://www.choiceofgames.com/persist.js

I’ve got to admit that’s a little over my head right now, but I’m pretty sure it should be easy enough for someone like you to apply on your own domain.

EDIT: Sorry, I meant to comment on the game.

Technically, this is brilliant, fantastic. I can see it setting some sort of benchmark for future C/S development. However.
I feel its level of complexity and D&D/T&T style will only appeal to a certain audience, and that is - for the most part - not CoG’s current one.

There’s something simple and easy to play about CoG’s games, this feels like it’s a lot more hardcore. Saying that though, I believe that’s probably what you intended. So it’s no big deal, each to their own. I think regular D&D/T&T players will be drooling over this, especially once saving and character importing are sorted.

I think the difficulty could be toned down a tad though, I had three attempts and died every single time I pulled the lever (well, died in the subsequent room). It really doesn’t entice me to play again.

BUT seeing as this is a proof of concept, I have to say I can’t fault the code or the framework. Not at all. It could just benefit from a more involving/developed story. Otherwise fantastic job! Keep it up!

Thanks for the feedback, @LordIrish and @CJW. It helps a lot.

I’m more a story guy than a dungeon-crawler myself… but it’s great that we’re getting games to cater to all tastes.

There’s a lot of repetitive clicking – which I guess is a feature, not a bug, for this particular genre. In my last playthrough, I ended up in a room with no apparent exits, where even after I’d survived my inevitable ugh monster combat, my five choices (to meditate and search each wall) only yielded a useful outcome after I’d clicked through them all several times. (I don’t think I’d failed to search the east wall on my earlier tries?)

Anyway, while I was regularly slaughtered and the setting didn’t hold my interest, like @CJW I’m impressed by the scope of the thing, and I’m sure others will enjoy it more.

Thanks for the feedback, @Havenstone. The game is not your usual ChoiceScript fare, admittedly. CS games don’t typically have so much randomization, and you wouldn’t have to search a wall multiple times to find any secret door that’s there. You and the others have me thinking about what I could do to allow people to play the game either according to the T&T rules (which is where all the randomization comes into play) or as a more traditional CS game, with a deterministic, non-random approach taken.

Historically, T&T solo games are difficult to survive, and some attempted actions fail, whereupon you might try the same action again or try something else—your choice. That being said, there’s still a limit to how much repetition should be attempted before something breaks the monotony. Even the T&T rules have been modified over time because the players complained that some of the combats went on forever (this brought about the introduction of spite damage, which is damage that applies to the opponent no matter which side wins the combat round).

Anyway, what I have in Castle of Chaos so far is pretty much the bare minimum, and I will add to it as time allows. All of the feedback will also be helpful when I start coding up the official Flying Buffalo products.

Okay, I’ve added HTML5 local storage saves to Castle of Chaos. It seems to work reasonably well, allowing you to save within a scene, rather than only at the beginning of the scene. The game state is saved well enough, although the contents of the page are not always the same upon reloading a saved game as they were when the game was saved. This is due at least in part to the random nature of my game. It should work better for more deterministic games.

The save system for Castle of Chaos uses jQuery, jQueryUI, and the Eposic save system. I tried to make sense out of the CoG persist.js file, but didn’t feel like taking the time to dig into how to use it, and I haven’t seen any documentation for it. I did see that it supports many different ways to save one’s game, depending on the capabilities of the device used to play the game, but I believe that each save overwrites the previous save. My system allows you to have multiple saved games (referred to as “datasets”), where you give a name to each one, and can load or delete any of them.

So…while Castle of Chaos leaves a lot to be desired in terms of game play, I’m interested to hear from anyone who tries out its HTML5 local storage save system.

Next I’m working on saving the game to my Eposic server, and allowing you to load a saved game from any computer/device that has web access. After that, I’ll be looking at being able to port a character from one CS game to another CS game. This will require that the character stats in both games are identical, or that defaults can be used for those that are not identical. This likely won’t work as-is for CS games converted to native apps, but it will be a start in that direction.

As a reminder, the link to Castle of Chaos is http://eposic.com/diversions/chaos/mygame/index.html

Thanks in advance for any feedback.