Home
About this Journal
At the moment, this is a journal of a game programming project, an offline role-playing game with a huge world and advanced AI. Stay tuned.
Current Month
 12345
6789101112
13141516171819
20212223242526
2728293031
Jul. 21st, 2008 @ 09:56 pm Pathfinding
Current Mood: pleased
Tags: ,


I'd known about the A* Algorithm, a simple method for finding efficient paths along a map, for some time, but never tried implementing it. (It's no coincidence that my little game worlds have been big open spaces!) So, as an exercise I tried building a version of it last night. Then I got frustrated and closed it, came back and worked some more, gave up for the night, prepared for bed, got an idea, then hunched over my desk to work at it around 3 in the morning until I had it working.

Anyway, it finds a path between designated start and end points (red and green), marked in white. It assumes that the cost to enter a grass tile (in time, fuel or whatever) is 1, forest is 2, and water is 9. Given those constraints it makes reasonable decisions to go around water and when possible, around forests. It can also handle starting inside a concave barrier, as seen here:



I don't like that it assumes full knowledge of the terrain, but it could be adapted to guess at areas it can't see. It could also be used to calculate which of several possible trade routes might be best, taking into account not only distance/time but some measure of danger and profit. ("Danger" would be handled by adding to the cost for any area thought to have, say, pirates, while "profit" would be handled in an unrelated way by asking whether there's thought to be a good price differential at the goal.) It'd also be possible to have variant personalities for the thing by having one version prefer safe routes (ie. putting a high cost on any danger) and another prefer high-value endpoints (ie. discounting the movement cost).

Code w/graphics (119 KB)
About this Entry
Badge (Otter)
Jul. 10th, 2008 @ 04:28 am Trade Game: Mk. II Screenshots
Tags:
New screenshots:


I can get now from a clunky but usable version of a map screen, to a port, to a shop within that port, and get to a deal being made, so the flow of gameplay is better established than before. Info on the trade goods is loaded from a file now, with enough background that I can say "this is a building supplies shop" and have it carry only that type of product. In the background, I've tweaked the interface code and graphics (eg. buttons are now more distinct from other widgets) and figured out how I can upgrade the interface and core "ringtale" logic module next time.

Although I'm working on implementing more detailed flavor text, I still need to find that way to ensure that the experience of the trading itself is fun. Because you're not seeing an explicit price list like "grain costs 2 coins," I could see a player getting frustrated due to a lack of information. Probably, the player needs to be able to express desires clearly or they'll feel both ignorant and mute, which is less fun than a standard spreadsheet form of trading. How about a button at the bottom of your list of trade goods, that when clicked brings up a menu for doing things like asking the trader about their guild or where a good destination might be? Would it make sense, even, to show explicitly what values the trader currently places on each item? That seems like cheating, because... well, imagine doing that with a used car salesman. Provides more information but spoils the strategy.
About this Entry
Badge (Otter)
Jul. 3rd, 2008 @ 12:54 am Trade Game: Progress?
Tags:
I rebuilt much of the code for the recent trade game demo, setting up a system by which there are multiple traders per port, with inventories tending to have a theme like food. Traders have some more variables like "patience." What's next is to try implementing the trading again, this time in such a way that there's more flavor text, more distinctive trader behavior patterns, and a limit (patience) to how much trading you can do. I'm hoping that these changes will make the basic activity of the trade be fun, so that it's not just a chore that you do to get money for other activities.

The fact that I have in mind a Renaissance-like setting with big wooden ships and a variety of goods, rather than a Stone Age setting, I kind of need the concept of specie, precious-metal coins. That's going to be tricky to implement, as it's not just another form of trade good. Some merchants (ship dealers in particular) should be reluctant to trade for anything but coins.

As a side note, I imagined the setting having a tribe of feral dolphins who accept gifts, and in return occasionally pop up and give you random stuff or information. That'd be a neat feature, but a secondary one.

I wonder if I could use my implementation of the "codelet" AI technique for making decisions for traders? That trick is something that can be used in a stand-alone way (a version of it is here) without getting into super-duper AI.
About this Entry
Badge (Otter)
Jun. 17th, 2008 @ 09:27 pm RPG Styles
Current Music: Nights: Journey of Dreams - Level Clear
What would make a computer RPG, or a board game, fun and original? I'm thinking specifically about a particular board game theme, and my trade-game project.

Earlier, I'd noticed that although having a generic board game set might be interesting, it wouldn't be as fun for me as a more focused set with a strong theme or "chrome." So I thought about what I could do with a theme of sailing, islands &c., that's been on my mind. "You've got to have gold coins, not a "scoring track" or gold cards." A fun meeting last weekend with [info]slysquirrel reminded me of that.

On a related note, I had a problem with Squidi's Mechanic #054. He proposed building an RPG in the style of Final Fantasy by defining some "hub" locations, drawing a map connecting them (I'd do this with the Voronoi trick), then placing various kinds of barrier along the borders. Eg., you need the Red Key to cross one border, so you go to another hub, and then you use the Red Key to get the Airship to reach a third hub... I was dissatisfied because it made for a linear game of make-work quests. Squidi distinguished between that kind of "narrative" RPG and a "simulationist" RPG in which you can pretty much go anywhere, as in Morrowind. I thought about making a strongly story-driven game like Final Fantasy, but thought, "Why? I'm sick of that kind of game."

The odd thing is, I want a game with a strong theme, yet I'm dissatisfied with the idea of a strong story built atop stale game mechanics.
About this Entry
Masked
Jun. 5th, 2008 @ 11:57 pm Project Complete: Trade Game Demo
Trade Game Demo (5.1 MB)
Screenshot

Known problems:
-Doesn't respond to the standard QUIT event, so you should quit by hitting Escape repeatedly: to back out to the map, then to the "outro" screen, then hitting any key to end the game.


Here's a little demo of the trade game described earlier. It hooks up the basic trade mechanism to an ocean screen where you click on one of four ports to visit. Each has a slightly different set of values for its products, so it's possible to increase your total wealth as measured against the standard set of product values on which the traders' beliefs are based. (Eg. emeralds are valuable, bread is not.)

Thoughts? I'd especially like to hear whether there's any fun value in it, and if so, how to emphasize it.
About this Entry
Badge (Otter)
May. 31st, 2008 @ 06:22 pm Piecepack
Current Music: Final Fantasy Tactics - Tutorial
I came across this site presenting a public-domain set of pieces intended to be a standard board game set, comparable to a deck of cards. I wasn't satisfied with the arrangement, because it's hard to picture people carrying around all of the following: big square tiles, round coins, pawns, and special dice numbered 0-5 and each with a labeled suit. You can't carry that around in a little box as with cards, without the pieces banging around; the custom dice aren't printed properly and won't work well or be durable when made of paper anyway.

I bought some colored paper in hopes of bringing a Piecepack set to Anthrocon, but stopped short of printing one. I used Inkscape to draw a variant set with these features:
-No special dice. Just use standard d6s. Maybe a different color for each suit.
-Pawns replaced with a specially marked set of coins.
-More coins.
-An extra line along one edge of each tile, able to represent a wall or connection.

With this you could assemble a random arena with walls, and since the pieces are all flat plates except the dice, you could carry it all in a pocket-size box with minimal sliding or rattling.

Still I'm not satisfied. The point is to have a board game set, right? So why use one side of each tile like a card, with no board spaces marked on it? One of the Piecepack games ("One Man: Thrag!" I'm still laughing at the title) uses the tiles as cards, which seems to defeat the purpose of the Piecepack set. Also, isn't it a little boring to be using a blank grid when the theme is pirates or space or something? (Meanwhile, I've been helping someone design a generic RPG ruleset so modular that some of it could be described in Python.)

This dissatisfaction teaches me something. There's a tension here between trying to have a truly generic game set, and having a set that supports a particular fantasy with special features and decorations. And of course there are different constraints involved in making a board game than a computer game. The Piecepack project's goal is to have something highly generic, so that severely limits the fantasy aspect of it and forces players to rely on their imagination, in which case why bother using a board game? I think I'd rather make and build something with a specific theme, capable of playing a narrower range of games. I'll play with this idea a bit more.

(Oh, and re: the trade game, I made a quick-and-dirty map screen such that you can visit several ports that each have their own merchant with somewhat different goods and prices. Traders' decision making still stinks.)
About this Entry
Badge (Otter)
May. 30th, 2008 @ 02:24 am Trade Game Mk. II


The item graphics are adapted from some available here. (Thanks to Reiner "Tiles" Prokein.) Porcupine merchant guy by Kelvin the Lion, poorly colored by me.
Read more... )
Anyway, it's playable if you want to see it. Want Python code or an EXE, if so?
About this Entry
Badge (Otter)
May. 27th, 2008 @ 07:26 pm Trade Game
Screenshot: Trade Game

This is my attempt at implementing, with graphics, the code I had earlier for a little barter agent. The code implemented in this screenshot lets you assemble an offer from your inventory of goods (2 cloth, 25 beads in my case). The code not yet used here, but ready to combine with this, looks at an offer, assigns it an internal total value (eg. cloth = 5), then semi-randomly makes a counteroffer from its own stock of goods, trying to offer a set of goods with a similar total value. ("I'll add, oh, 3 beads... still not a high enough total.") At no point do you get an absolute price for something, because one trader will want certain goods much more than another. The merchant can also notice the perceived difference in value between your offer and theirs. Say then that I have the merchant remember whether you gave them a good deal in the past, so that they like you more next time; and that some merchants are more sensitive than others to this so that you have to figure out when to drive a hard bargain and when to be generous. Rejecting an offer could reduce the merchant's liking of you, so that's another tradeoff to consider.

This could be an interesting mini-game that I might be able to implement quickly, and incorporate into better things. Thoughts?
About this Entry
Badge (Otter)
May. 7th, 2008 @ 11:45 pm RetCon Card Game
Current Music: Disgaea - Laharl's Theme
Hero: "I slew the Dragon (100 swords)."
Villain: "No you didn't; your Hero has only 10 swords of strength."
H (plays "Holy Armor" on the timeline between the Hero and the Dragon): "Well, I got the Holy Armor (20 swords) and that helped."
V (plays "Minotaur" before "Holy Armor"): "But you couldn't even get to the armor because you got attacked by a Minotaur (30 swords). And anyway you couldn't use the armor because it required that you be Holy."
H (lacking any suitable cards to beat that, plays "Divine Blessing" just after "Hero"): "Well, I got a Divine Blessing just as I started out (+5 swords), and that made me Holy so I was able to use the Holy Armor once I had it."
V (plays "CURSED!" on the Holy Armor): "But the armor was CURSED, reversing its effect!"
H (noting that "CURSED!" says "Defeat: Holy"): "Aha, but my holiness was enough to defeat the curse! ...That means I proved I could beat one of your cards, so I level up!" (H gets to draw weaker cards that can be used earlier on the timeline)
V: "Pass. You still couldn't beat the Minotaur, much less the Dragon. You're a big fat liar. Nyah."
H (playing a card just before Minotaur): "Well, I summoned a Greek Hero (20 swords) to help me beat the Minotaur. I had 10 swords starting out, plus 5 from the blessing, plus 20 from him, and anyway the Minotaur gets defeated by anything Greek, so I was able to kill the Minotaur! I level up again!"
V: "You say that now, but actually you didn't get the Greek Hero because he was imprisoned in an Evil Fortress..."

The idea here is a card game in which the story gets told in vaguely reverse chronological order, ideally out loud in front of an audience. To keep with the spirit of the backwards justification theme, the hero should start with cards that mostly can only be played late in the timeline, and then levels up to get weaker cards that can eventually justify how they got the more powerful stuff later. Earlier. Whatever. The hero and villain should probably have different decks.
About this Entry
Badge (Otter)
Apr. 23rd, 2008 @ 01:50 pm "Bum Bot"
Current Music: Bach - Sleepers, Awake
Tags:
Article: Bum-Busting Robot

So there's a bar buyer bouncing bums with a battle bot. Look at the details: the police told him to stop brandishing a gun even though he's been repeatedly threatened with guns; the area is full of trespassers including crack-heads; he's never physically attacked anyone with the bot; the city hasn't cleaned up the crime in his area; and he's still being painted as a bad guy.

What he could do if he were really mainly after publicity would be to build six or eight themed robot bouncers: Beer Man, Pretzel Man, etc.. What could go wrong?
About this Entry
Badge (Otter)
Apr. 16th, 2008 @ 01:56 am In Dangerous Zones
Current Music: Bach - Sleepers, Awake
Tags: ,
"This is such a spur-of-the-moment announcement. Would you be able to be here on April 11 at noon?"

I had been in contact with FARG/CRCC, the research group at Indiana University headed by Douglas Hofstadter (author of Godel, Escher, Bach), and was hoping to angle my way into being a grad student with them. I'd even driven to Philadelphia to attend a lecture a week or so before, and got to meet Prof. Hofstadter in person and talk with him for a few minutes. (I happened to catch him as he was leaving for the next lecture in the conference, so we talked as we walked. Lucky!) I got a short-notice invitation from my contact with the group, offering to let me visit. That led [info]slysquirrel to invite me even more unexpectedly to Furry Connection North, but that's another story. This is what happened when I had the honor of spending several hours with these researchers, talking about AI:
Read more... )
So, my reaction to this encounter reminds me of a basic split in AI research: Are you trying mainly to create so that you can understand, or to understand so that you can create?
About this Entry
Badge (Otter)
Mar. 13th, 2008 @ 03:40 am Party Time
Current Mood: worried
Tags:

A very simple AI is able to randomly wander and jump around, or to follow a moving target. The neat thing about that is that there's no "move north" command, so characters calculate when to turn or move forward at their current angle. So, in the picture you can see a party of NPCs following my character and banging into each other. These aren't the sprites I'm looking for, but they're better than the squirrel stickman.

The main AI makes some judgments about things it sees, in a text-only format, and can go from detecting some raw numeric sense data to deciding that a thing is "edible" and spitting out an "eat" command. Next is to hook up the the game loop to the AI so that NPCs get that sense data automatically about what's around them, and if they've got the main-type AI, think about the data and make decisions.

As usual, I was thinking about grand ideas for how to combine better AI with a more conventional RPG adventure. What if I went in the opposite direction of Facade by presenting a setting where the characters are shallow, but have exactly as much depth as they pretend to? No pre-written dialog at all, no pretense of complex backstory. You're on an island with a bunch of otter-people who aren't too bright but "really" catch food and do other things, and can understand you when you talk about their activities and can talk about what little they know. I think I'd rather get that right than have a NPC talking about ancient empires' culture but having no clue what they're saying.

You might think that as a writer I'd be in favor of just making a conventional Final Fantasy-style RPG with a new story and characters but ordinary gameplay. Strangely, I'm not; I'm sick enough of those to put down Final Fantasy XII, thinking, "This isn't actually fun," and Rogue Galaxy thinking, "These plot twists and pseudo-puzzles require that the characters be pushovers and idiots." The fun aspects of those aren't enough to mollify me.
About this Entry
Badge (Otter)
Mar. 5th, 2008 @ 01:26 am Pixel Spaceships
Current Music: Zero Wing - Natols
Someone on the Pygame discussion list linked to a discussion of "pixel spaceships", little drawings you can generate that look like sci-fi spaceships.

My quick-and-dirty implementation:


Fun little exercise. It'd be neat to procedurally generate spaceship modules and then attach several for a bigger ship.
About this Entry
Badge (Otter)
Mar. 1st, 2008 @ 10:54 pm Project Complete: Colony Demo
Current Location: Zone 6,1
Tags: ,
Screenshot
Screenshot 2
Download Windows EXE (4.5MB)
Download Source Code (requires media etc. from the EXE version to run)

Something I forgot to mention in the included Read Me file is that you can make your own scenarios, even with this limited code. See the "Freedom Fighters" scenario for an example of what you can do. The "New World" scenario has almost nothing in it so far, but it does show what I consider the default rules for how the map is revealed. The "map editor" spits out a text file that you can plug into a scenario file.

I also included an old set of notes on what I wanted to do with the game, which is interesting to compare to this scaled-down demo.
About this Entry
Badge (Otter)
Feb. 28th, 2008 @ 03:06 am Colony: Making It Happen
Tags:
Built a little map editor, good enough that I built two test maps with it.
Built a script system capable of handling situations like this... in fact I'll give verbatim the data that (if my new loading code works like the early tests show) will create a game event:

name: Raid Base Alpha
coords: 4,2
trigger: event entered
text: I crept into the base, looking for my friends.
test: have_item CardKey
failure_text: But I came up against a door I couldn't open. There's got to be a key around somewhere!
success_text: After sneaking past a locked door with the card key, I found my buddy Tesla trapped in a cell, and snuck out with him.
effect: new_recruit Tesla

I think it'll be that easy to place new events now.

Someone asked whether I was making an RTS, and that thought bothers me. How is this different than an RTS in turn-based mode? I'm focusing on exploration rather than combat, especially since there's no battle system in this demo, but I'm still treating characters as needy bundles of skills and stats, little better than interchangeable "units." I'd like to stand out from that line of gameplay by making the individuals more complex and unique. How, though?

One idea that seems manageable is to start implementing the base-building system, which gives the colony stats like "fun" and "comfort." Give each character a set of priorities among those stats and a set point for what they consider OK for each. Then, each turn, each character can generate text like: "Our colony is undefended! But I don't know how to do Guarding. This place is also boring. I have storytelling skill; today I'll work on improving Fun." (If a character has high standards, they'll always complain about something -- optimism vs. pessimism!) The result would be automatic allocation of labor in something resembling a bunch of individuals making their own decisions... but how much of that would the player see? If they never read that text, the effect is the same as if I just brute-forced things by saying "Labor equals people present times N; spend labor in these percentages."

Another idea is to have characters develop relationships. In some older code I'd used a dice-based system to create "friendships" that let characters help each other recover from failures. In that case you might not want to just throw a bunch of characters into a party, because A and B work well together and A hates C.

A third idea is to have some kind of memory, so that characters can say, "You haven't sent me anywhere lately" or "I was once on a mission where my friend died." Again, how would that knowledge get conveyed to the player?

In general, what would you want a simple AI character in an RPG to do, where possible actions include exploration missions, base-building, and research?
About this Entry
Badge (Otter)
Feb. 23rd, 2008 @ 11:48 pm Colony: Progress
Current Mood: tired
Tags:
Screenshot (Map)
Screenshot (Team Select)

Shown here is the map screen of the "Colony" project, with different areas partially revealed based on how well explored/mapped they are.

Despite a "YOUR CODE ASPLODE" moment in which a power drain led my main program to be overwritten with gibberish, there's progress. You can send out teams of explorers to forage in areas on a map, and they come back after a certain time with food and map data. The game loads some scenario data from a file, including a test event in which something happens when you visit a particular area. There are reports generated and displayed when stuff happens.

I hope to release a demo soon showing the basics of gameplay: sending out teams on foraging missions, uncovering the map, and triggering events. I should be able to demonstrate two very simple scenarios with a different feel. Of course I've got several ideas for other features I'd like to add, but it's important to get the basics working first. I'm not planning to implement actual base-building yet.

I'm worried though about whether this will actually be fun. What I see as the fun aspects might be overshadowed by the feeling of dull resource management, because you're not so much going on an adventure as telling other people to. The original "Colony" idea involved letting you lead missions yourself, but that's too ambitious for now.
About this Entry
Badge (Otter)
Feb. 18th, 2008 @ 03:29 am Release: Match Game
Current Music: Celestial Aeon Project - New Dawn
Tags:
Download (7 MB)

Here's a playable version of the matching game, with music and sound, source code, and increasing difficulty. Can you beat my high score?
About this Entry
Badge (Otter)
Feb. 17th, 2008 @ 05:11 am Puzzle
Current Music: Abenobashi Magical Shopping District - Treat or Goblins


Here is the code and graphics for a prototype puzzle game, done out of the blue tonight after I tried the demo of Puzzle Quest, a ludicrously simple game dolled up with good graphics, music and RPG mechanics. They built a whole RPG out of switching pairs of icons!

The bad news is you need Python and Pygame to play this version, just because I didn't build an EXE.

I'm tempted to expand on this code-doodle, but would like to see a similar elaboration with some kind of plot and mechanics beyond switching pairs of icons. But what? One bug that I noticed involved the game "not noticing" that stuff was unsupported until the next time you made a match, which reminded me of cartoon physics. Is there some way to recreate in a puzzle some other toon-physics rules like "everything falls faster than an anvil," Hammerspace, and tunnels painted into walls?
About this Entry
Badge (Otter)
Feb. 10th, 2008 @ 11:45 pm Heart Container Pieces
Lately I've been in coding mode, which for some reason seems mutually exclusive with writing mode. I wrote to Prof. Douglas Hofstadter's research group and got a friendly contact from someone there, who sent a set of interesting papers from their work.

I'd like one or more simple 3D characters that I can render as sprites from various angles. There's a trick to do that automatically from Blender, and so far I've put enough effort into Blender to make a stick figure but not to make the "skeleton" that lets you pose it easily.

After working on the Colony game idea for a while I turned to AI stuff again. It's not much, but I've got a system that looks at raw data representing an object, like:
{"name":"Pillow","mass":1.0,"albedo":.2,"smoothness":.9,"brightness":.5,"compactness":.8,"hardness":.2,"heat":.6}
And makes a set of judgments about it, in this case "matte," "soft" etc., and at a higher level of abstraction "Fuzzy," somewhat "Rocky," and not "Metally" or "Crystally." There's also something akin to a "codelet" system like the one Prof. Hofstadter has used for various things. I picture it as a hand of cards with instructions on each. Some events cause cards to be added to the hand, and every so often a card is pulled from the hand and played, sometimes leading to more cards.

I also started a different judgment system inspired by something [info]nikonraccoon had written: taking some raw stats for RPG characters and making judgments about whether they're "healers," "tanks" etc., then seeing whether a group has a good mix of skills. It was a little side experiment, but it's actually worth pursuing because it's directly related to storytelling. It'd be possible to make similar decisions to "has this party got a healer?", as in "has this story-outline got a protagonist?"

Where I'd like to go from here involves two goals within reach. One is to have a system that tracks surrounding objects and other sensory inputs and feeds those into the perception system, so that it's at least vaguely aware of:
A warm, soft feeling beneath my feet. A warm feeling around me. A big, leafy green thing close on my left. A small, round, fuzzy brown thing in reach on my right. A bright, shiny yellow thing very far above.
It seems important to give the system at least some awareness of things other than objects around it; picture going around with no information about the world but a radar display with some notes on each "target," and nothing about the ground, sky, etc..

The other thing is to adapt some code I have for "plans" and link that in one direction to the really basic action-selection system that spits out one of several words like "walk" to represent commands for basic physical actions. In the other direction the plans should get brought up by things the system perceives. What I'd like to see here is that the system "sees" an object, identifies it as a coconut, thinks of the plan "eat" as a result, picks a target (the coconut), and carries out the plan. As I understand it, in The Sims an object basically broadcasts to the characters "this is what you can do with me." Instead, what I'm proposing would have the system itself decide what to do, with a constant back-and-forth between what it sees and what it's trying to do. "There's a coconut... I need something to eat. There's a tree, a coconut, a monster... Wait, monster! I'll throw something at the monster -- how about this coconut?"
About this Entry
Masked
Jan. 27th, 2008 @ 12:53 am Project Complete: Tactics Demo 2 ("Gear Tale")
Current Mood: accomplished
Current Music: Celestial Aeon Project - Citadel
Game Demo (Windows EXE)
Game Demo (source)
Screenshot

(Music will be uploaded later if convenient. It's also available here, in the songs "Citadel," "Red Fields" and "Angel's Tear." They should play automatically if any of them are in the /sound/music subdirectory.)

Here is a new demo of the tactical combat game, following on the older demo by adding a "campaign," a sequence of battles interspersed with story sequences. The characters are also more serious RPG people. Overall it's still junky, but it was helpful to do. I'm interested in the GalaxyMage Redux project, which aims to produce an open-source tactical RPG, but I'd be more interested in having unique gameplay elements and story than in the raw statistics.

I'd like to see people playing something I'd made at conventions. Still, I'm not sure whether to try following up on this one when there are more interesting projects to work on, and I've accomplished what I'd hoped to learn from this. It could yet become a battle system for use in something else.

Incidentally, I found a crude way to imitate the "Mode 7" pseudo-3D graphics mode seen in Super Nintendo games. My version looks like this, versus how it looked in Secret of Mana. The code for that is here, using graphics here, or you can run it without the graphics to have it demo using improvised graphics. (Requires Python.)
About this Entry
Badge (Otter)