<?xml version='1.0' encoding='utf-8' ?>
<!--  If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/  -->
<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:media='http://search.yahoo.com/mrss/'>
<channel>
  <title>Game Design Kitchen</title>
  <link>http://psysal.livejournal.com/</link>
  <description>Game Design Kitchen - LiveJournal.com</description>
  <lastBuildDate>Tue, 30 Jun 2009 01:25:42 GMT</lastBuildDate>
  <generator>LiveJournal / LiveJournal.com</generator>
  <lj:journal>psysal</lj:journal>
  <lj:journalid>228746</lj:journalid>
  <lj:journaltype>personal</lj:journaltype>
  <image>
    <url>http://l-userpic.livejournal.com/84127728/228746</url>
    <title>Game Design Kitchen</title>
    <link>http://psysal.livejournal.com/</link>
    <width>100</width>
    <height>100</height>
  </image>

<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/67470.html</guid>
  <pubDate>Tue, 30 Jun 2009 01:25:42 GMT</pubDate>
  <title>Geography: Where It&apos;s At</title>
  <link>http://psysal.livejournal.com/67470.html</link>
  <description>I started this as a reply to increpare&apos;s question: How much do you plan on characterizing each of the playing areas?&lt;br /&gt;&lt;br /&gt;I thought it would make a good dev blog post.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Define &quot;Area&quot;&lt;/h2&gt;&lt;br /&gt;For the purposes of this blog post, I should explain what I mean by &quot;area&quot;.&lt;br /&gt;&lt;br /&gt;Each &quot;area&quot; is a 50x50 block that you can think of as being closely analogous to a &quot;screen&quot; in non-scrolling games. That is, it normally fits within a greater geography but creates a very concrete sense of location. When the player leaves one area, they hit an edge and the next one loads. It&apos;s a somewhat abrupt and very deliberate transition. As a result, the player&apos;s sense of location in the game world is discrete: she knows she is on the area (screen) with the waterfall, not just &quot;near to&quot; the waterfall.&lt;br /&gt;&lt;br /&gt;In that sense, each area is mainly characterized by it&apos;s shape, and it&apos;s contents: where are the exits, walls, and what buildings or set pieces are inside of it. I lay trees/rocks out in certain patterns or try to create distinctive points of interest on each area. By the same token, other areas are more anonymous in feel (e.g., somewhere in a forested area); they seem to just be a &quot;forest square&quot;. Even so, landmarks such as bends in a river or particularly placed trees are helpful.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Greater Geography&lt;/h2&gt;&lt;br /&gt;Beyond this the game is broken down into a greater geography. There are &quot;real world&quot; and a &quot;alternate reality&quot; planes which have slightly different color sets and terrain types, as well as completely different trees/rocks/walls/etc. This creates a nice division between the two.&lt;br /&gt;&lt;br /&gt;Within each plane, I try to create a sense of location by how I lay out objects and how areas flow into each other. So for instance, certain flowers may be very prominent on the southwest corner of a map, across several areas, but not at all existent on the southeast corner. Other, larger &quot;places&quot; help to define the areas such as a castle, graveyard, or town. &lt;br /&gt;&lt;br /&gt;Certain elements also flow between areas; so farms have fields that cross across boundaries and walls which pass through several areas. We have to follow the walls (usually by walking on a path) to a nearby gate to get through (although in many cases there are crumbling sections which not only add interest but prevent you from having to walk all the way around).&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Start With Setting&lt;/h2&gt;&lt;br /&gt;Lastly, or rather, firstly, I start off thinking of setting. The first thing I usually want to create is the setting, and that means mapping. So I draw maps on paper, changing and reorganizing, until they seem to have interest and look natural. &lt;br /&gt;&lt;br /&gt;All this, without respect for the gameplay they will later have to support. For the most part, the entire game world was created before I had a good idea as to the specifics of locations, or other functional elements (e.g., crossing a bridge or getting through a certain cave to reach a more advanced area). I think this approach creates a better sense of place, so that you feel the game world is quite logically organized.&lt;br /&gt;&lt;br /&gt;I also think this is a more authorly way to work. Do novelists start off by thinking of a story and then construct a setting to fit around it? Of course not. A setting inspires a story and if it&apos;s not based on a real place or time on planet earth, then typically requires a lot of imagining on the author&apos;s part. &lt;br /&gt;&lt;br /&gt;Of course, you make modifications to your setting to fit your story, once you have it in place and realize what you need.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;End Result: Believability&lt;/h2&gt;&lt;br /&gt;The purpose of this kind of organization is to allow the player to orient themselves within a believable world. We give them enough landmarks and subdivide the world into discrete blogs to give them a very good sense of where they are at all times. At the same time, we have a greater sense of geography that we constructed to be interesting in the first place, before we started to think about gameplay and story. What we end up with is a world that both feels natural and is easy to understand: and hopefully somewhere fun to be!</description>
  <comments>http://psysal.livejournal.com/67470.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/67074.html</guid>
  <pubDate>Mon, 29 Jun 2009 03:35:04 GMT</pubDate>
  <title>When to Cut Your Losses</title>
  <link>http://psysal.livejournal.com/67074.html</link>
  <description>&lt;h2&gt;Persistence is Key, but...&lt;/h2&gt;&lt;br /&gt;Finishing a game requires a LOT of persistence and a lot of ability to just plough through small details and so forth.&lt;br /&gt;&lt;br /&gt;But sometimes you need to recognize when something you&apos;re working on should be just dropped. I don&apos;t mean a whole game, I mean a feature or an idea. You&apos;ve already decided to add a certain feature; how do you undecide?&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;When to Stick To It&lt;/h2&gt;&lt;br /&gt;You can&apos;t just undecide based on difficulty. Some features may be necessary but fairly painful to implement, for example hunting down memory leaks. This could take you a few days but you can&apos;t really avoid it. For these, I think you just have to stick to it.&lt;br /&gt;&lt;br /&gt;Other features may not be necessary but seem like a good idea. I.e., if you could get this feature in it would fix certain gameplay-related problems. In this situation, I think you normally have to follow through as well. Reason being, if you don&apos;t pay attention to certain problems with gameplay, those problems are going to ruin the whole rest of your game.&lt;br /&gt;&lt;br /&gt;Sometimes you can comprimise. For instance, a blog post or so ago I talked about NPCs opening doors. &quot;Properly&quot;, the NPC should determine that they are in front of a door, stop, open the door, walk through, stop, and close the door. This is a ton of game logic. Instead, I took the middle ground and had them detect when they were already on top of a door, open it (so that technically it opens late) and then once they are off of it, close it. They don&apos;t stop, and they technically pass through the door before opening it. But it&apos;s a good comprimise. Without this, the game have a rather large gaping &quot;hole&quot;: NPCs would pass miraculously through doors. I can&apos;t really get away without fixing that.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;When to Cut Your Losses&lt;/h2&gt;&lt;br /&gt;So when do you actually decide to cut your losses and drop a feature altogether?&lt;br /&gt;&lt;br /&gt;I would say, you &quot;undecide&quot; when you realize that you made bad decision, and why.&lt;br /&gt;&lt;br /&gt;Recently, I decided to clean up the side-to-side area transitions. When you move from areas on the world map, there was a &quot;wiping&quot; transition that sort of wipes the screen to black, then unwipes it. Not really terrible but as someone pointed out, quite jarring. I had stopped seeing it as jarring, but after reading a comment on a video I realized, in fact, it was.&lt;br /&gt;&lt;br /&gt;This is probably something I need to fix, one way or another. It breaks continuity in a fairly major way.&lt;br /&gt;&lt;br /&gt;But I made a bad decision. I wanted to make the screens &quot;slide&quot;. If you&apos;ve played the original Legend of Zelda, or the SNES version Link to the Past, you know what I mean. I thought this would be a nice retro effect, and provide good transition.&lt;br /&gt;&lt;br /&gt;But there were problems with decision:&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Problem One: * vs. 1&lt;/h2&gt;&lt;br /&gt;First, the game engine was built from the very start to assume there is only one &quot;area&quot; live at a time. This was in order to simplify implementing many things and to remove many design decisions that would otherwise have to be made. As well, it gives the player a nice sense of &quot;concreteness&quot;; the game is divided into discrete areas, so they have a good sense of where they are.&lt;br /&gt;&lt;br /&gt;Allowing for a slide transition meant I had to jerry rig the engine to have more than one area open or &quot;live&quot; at once. This was problematic, though I eventually did actually get it working. Not a total hack, but far from elegant. And it had (as you may expect) some unforseen consequences that would have required perhaps some painful fixing, for example there were lighting and &quot;noise&quot; seams between areas.&lt;br /&gt;&lt;br /&gt;Framerate also dropped off significantly during the slide transition, because we&apos;re rendering more than one area at once. This sort of negates the benefits of sliding, since the framerate becomes chop-city.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Problem Two: Coordinates&lt;/h2&gt;&lt;br /&gt;The other problem had to do with the camera, and coordinate systems. Again, stemming from the fact that I only wanted one area open, everything is coordinated relative to the current area. Changing areas means recoordinating: the camera now needs an offset, we need to know where the player should be relative to each screen, etc. etc. Ugly!&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Solution&lt;/h2&gt;&lt;br /&gt;The first part of the solution was to dump this idea, which I happily did. I needed to recognize why I had made a bad decision, and cut my losses. It&apos;s not just that it was difficult. It was difficult BECAUSE it conflicted with other core design decisions made for the game.&lt;br /&gt;&lt;br /&gt;The second part is to come up with a replacement that will not be so disrupting. In this case, I need some element to create a sense of continuity. That element, it turns out, will be the sky.&lt;br /&gt;&lt;br /&gt;The sky right now during the daytime shows just blue (at nighttime it shows stars, which is good). My plan, not yet implemented, is to have clouds going back and forth on the sky. I will then have a nice faux-reflective effect on water surfaces which shows this sky. The effect is overall somewhat trippy, since the sky is visually &quot;below&quot; you (rendered underneath the terrain, along the edges) but in reality represents something &quot;above&quot; you. It was a cute idea when I had it and a great one.&lt;br /&gt;&lt;br /&gt;What I&apos;m going to do is put animated clouds on the sky. These clouds will blow back and forth peacefully creating a nice sense of place. When I transition between areas, I will wipe not the entire screen but just the terrain/area etc, so that the sky shows beneath it. This way, we get a greater feeling of continuity without violating the core mechanic.&lt;br /&gt;&lt;br /&gt;Later, I can update it to also show the player (a bit tricky, but it should be possible), and the effect should be complete.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Conclusion&lt;/h2&gt;&lt;br /&gt;Don&apos;t give up on solving problems that need to be solved, but cut your losses when you realize you&apos;ve made a bad decision.</description>
  <comments>http://psysal.livejournal.com/67074.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/66835.html</guid>
  <pubDate>Thu, 18 Jun 2009 02:10:03 GMT</pubDate>
  <title>At last.. IT IS TIME TO DIE!</title>
  <link>http://psysal.livejournal.com/66835.html</link>
  <description>Games are funny. Or at least it&apos;s funny how my game development tends to go. I tend to get some core mechanics in very, very late. In fact, usually I get death itself in very late. Hmn.&lt;br /&gt;&lt;br /&gt;Anyhow, I need to implement dying, since I&apos;ve now got a slime burning status effect. This is what happens if you pick up something that is slimy or maybe if you step in slime, I don&apos;t know.&lt;br /&gt;&lt;br /&gt;If you stay slimed for too long, you&apos;ll die from sliminess. I don&apos;t know exactly what causes the death but it&apos;s sort of an acid-burn type thing.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Death Mode&lt;/h3&gt;&lt;br /&gt;This leads me to my next observation. I need a separate play mode for death. A play mode is basically a very broad level control. Title screen is a play mode. Explore is a play mode. That&apos;s about it. Everything in the game takes place in &quot;explore&quot; mode, which shows the map, lets you walk around, etc. etc. &lt;br /&gt;&lt;br /&gt;Title shows the title screen and helps you with menu options.&lt;br /&gt;&lt;br /&gt;Death shows your death screen. I could maybe re-use title playmode for it but, somehow I don&apos;t want to. I&apos;m not sure why.&lt;br /&gt;&lt;br /&gt;Rather than call it, Death, however, I decided I would like it to be more generic. So I&apos;m calling it &quot;story&quot; playmode. I will structure it more around telling a story with text and pictures than navigating a menu and saving/loading games.&lt;br /&gt;&lt;br /&gt;Other than that, I&apos;m not sure yet. First iteration I guess will just show some text about your death.</description>
  <comments>http://psysal.livejournal.com/66835.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/66799.html</guid>
  <pubDate>Thu, 18 Jun 2009 02:04:05 GMT</pubDate>
  <title>Sleepiness Status Effect</title>
  <link>http://psysal.livejournal.com/66799.html</link>
  <description>I need to implement the sleepiness status effect. This will cause you to doze off periodically, if you don&apos;t take a proper nap. What it falls to me now, to do, is implement some kind of appropriate visual analogue for being sleepy.&lt;br /&gt;&lt;br /&gt;What I want is to have sort-of an &quot;eyelid&quot; over the whole screen. As you get sleepy, the eyelid should start to close, eventually blinking periodically until it closes completely and you get a &quot;you fell asleep&quot; message.&lt;br /&gt;&lt;br /&gt;Not too hard, but what&apos;s the appropriate way to model the eyelid effect? &lt;br /&gt;&lt;br /&gt;We could just use a sum of sine curves of different phases/rates, and use that to determine how open or closed it should be. We could use a bit of a function on top of this to make it tend to fully open or fully closed, or to a few levels of open-or-closedness. Or some kind of holdness counter, where we hold our eyelids for X seconds at the current sine level, then change them and reset the holdness counter.&lt;br /&gt;&lt;br /&gt;Hmn, I thought this was going to be a long post about some kind of model for fighting to keep your eyes open, but I think this may just be simpler than I thought.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Update&lt;/h2&gt;&lt;br /&gt;Hmn, this LJ post didn&apos;t go through the first time. Anyhow, sleepiness now works splendidly. Your eyelids droop and eventually you just nod off. You can also sleep in beds (much better). Voila!</description>
  <comments>http://psysal.livejournal.com/66799.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/66346.html</guid>
  <pubDate>Sat, 13 Jun 2009 12:02:05 GMT</pubDate>
  <title>Progress, NPC Doors</title>
  <link>http://psysal.livejournal.com/66346.html</link>
  <description>Here&apos;s a quick update. I&apos;ve been blazing ahead full-tilt for the past couple of weeks, making excellent progress.&lt;br /&gt;&lt;br /&gt;Chief thing I&apos;ve been working on most recently is fleshing out the castle. This has been great fun. I&apos;ve fixed bugs, reworked and generally just added a humungous-chinese-vaseload of detail. Good fun!&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Opening Doors for NPCs&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;lj-embed id=&quot;4&quot; /&gt;&lt;br /&gt;&lt;br /&gt;One of the more interesting problems I tackled, something from my TO DO list, was to make NPCs open doors. There were two obvious solutions:&lt;br /&gt;&lt;br /&gt;Solution 1. Make it part of the NPC control code. When an NPC is going to walk through a door, make him stop, open it, walk through, close it, and then continue.&lt;br /&gt;&lt;br /&gt;- Pro: Fairly lifelike, this is how we interact with doors.&lt;br /&gt;- Pro: Same rules that player plays by, thereby bringing the player further into the world.&lt;br /&gt;- Con: Requires managing the NPC control code, which is already fairly complex.&lt;br /&gt;- Con: Requires adding additional code relating to pathfinding, to detect beforehand if we&apos;re about to go through a door.&lt;br /&gt;&lt;br /&gt;Solution 2. Make it so that the NPC has a sort of sensor, that when they are on top of a door, open it automatically, and once they pass through, close it.&lt;br /&gt;&lt;br /&gt;- Pro: Better than having the NPC go through the door magically, like they do now.&lt;br /&gt;- Pro: Requires no prediction, which is a help&lt;br /&gt;- Pro: Can implement it as a simple &quot;add on&quot; to the NPC control code, doesn&apos;t have to modify existing code. I.e., it can function orthogonally to the rest of the NPC code, for the most part.&lt;br /&gt;- Con: Not very lifelike, as the NPC will not stop either before the door or after. Gives more of an effect of an automatic door than of the NPC opening it themselves.&lt;br /&gt;- Con: Different rules than the player. The player will definitely notice that NPCs don&apos;t interact with doors in quite the same way.&lt;br /&gt;- Thought: Maybe that doesn&apos;t matter too much; there are other ways that NPCs don&apos;t really interact with the environment, e.g., they don&apos;t pick up and carry items, solve problems, or whatnot.&lt;br /&gt;&lt;br /&gt;I chose Solution 2.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Solution&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;Funny, but Solution 2 has more pros, so I guess in some ways it&apos;s not too surprising that I chose it. I guess it&apos;s partly surprising because I have been fairly dedicated to taking the highest *quality* solution for the past little while, not always the cheapest. This is I guess because Texas is well-enough designed that I can afford to, and it&apos;s been enjoyable.&lt;br /&gt;&lt;br /&gt;That&apos;s where we&apos;re at! I&apos;m adding status effects for the player, as they have been on my TO DO list for a long time, and they are pretty high priority (they are a core gameplay mechanic, that so far is completely absent). Hoorah!</description>
  <comments>http://psysal.livejournal.com/66346.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/66184.html</guid>
  <pubDate>Mon, 08 Jun 2009 06:29:02 GMT</pubDate>
  <title>Models, Water</title>
  <link>http://psysal.livejournal.com/66184.html</link>
  <description>&lt;h3&gt;Success from Yesterday&lt;/h3&gt;&lt;br /&gt;So it turns out my idea for the sticklike property was indeed quite awesome, and turned out well. I ignored the issue with &amp;quot;dips&amp;quot; entirely, it&apos;s an edge case and I&apos;ll wait until I get some legitimate in-game situations that look disturbingly bad before I address it. &lt;br /&gt;	&lt;br /&gt;This one shows sticklike containment:&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://kittylambda.com/sites/default/files/StickLikeContainment.png&quot;&gt;&lt;/img&gt;&lt;br /&gt;&lt;br /&gt;What you see here:&lt;br /&gt;&lt;br /&gt;- Player is carrying a mop (sticklike)&lt;br /&gt;- Another mop is contained in a giant yellow vase (you see the handle)&lt;br /&gt;- Smaller vases on the ground&lt;br /&gt;- Each smaller vase contains a smaller flower (sticklike)&lt;br /&gt;- Another smaller flower is on the ground between the vases, automatically laid on it&apos;s side (sticklike)&lt;br /&gt;- Player has his underpants on the outside.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Systems vs. Models&lt;/h3&gt;&lt;br /&gt;There is a real difference, to my mind, between a &amp;quot;system&amp;quot; and &amp;quot;model&amp;quot; in game design; though it&apos;s something of a continuum between the two.&lt;br /&gt;&lt;br /&gt;A system is like a set of rules that you envision for the player to exist within. So for instance you have HP for life, MP for magic; if you run out of HP you die, and MP you can&apos;t cast spells. Within these basic sets of rules you introduce new rules: if you have the Cure spell, then you can cast Cure and recover 25 HP for a 5 MP cost. And so on.&lt;br /&gt;&lt;br /&gt;A model is just a system whose set of rules that fit together naturally. Since our definition of &amp;quot;naturally&amp;quot; is going to vary a lot, so does the definition of model. But let&apos;s examine it.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;MP and HP&lt;/h3&gt;&lt;br /&gt;In the above example, you might introduce rules for bodily and mental sleepiness. When you sleep, you recover MP (your mind rests) as well as HP (your body rests). You might also sit down and rest for awhile, e.g., if you were reading a book to study a skill in an RPG, but this won&apos;t recover MP, only HP. Now we&apos;re leaning towards model; the rules are starting to fit together naturally. &lt;br /&gt;&lt;br /&gt;As we add rules to a model, we should think about ways that they would naturally fit together or interact. If we add a rule for poisoning, we should think about what that poisoning will do to not just HP, but MP. Maybe while you are poisoned, your maximum MP is cut in half to simultae adverse confusion effects due to feeling sick. Or, perhaps, your magic skill reduces temporarily for the same reason.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;A Better MP&lt;/h3&gt;&lt;br /&gt;The trick is, some sets of rules might fit together better than others. In the above example, we aren&apos;t sure how to represent the mental effects of being sick in our given set of rules. Perhaps MP isn&apos;t the best model for mental energy, then? A better model might be mental strain. As you stay awake, this increases bit by bit, and when we cast a spell, study something, etc. our mental strain increases greatly; up to a point. If our mental strain is too high, casting a spell is less likely to work, or work well. Resting might reduce our mental strain somewhat, but only to a point; we eventually need to sleep. Lastly, as our mental strain increases a lot (e.g., if we were forced awake for 48 hours) we could start to hallucinate. Being sick with poison would increase our mental strain by a set number of points as long as we are poisoned, since we&apos;re constantly thinking about and feeling sick.&lt;br /&gt;&lt;br /&gt;This illustrates the difference between a &amp;quot;system&amp;quot; and a &amp;quot;model&amp;quot;. Mental strain is a model; things fit together more naturally. You could say it&apos;s a set of very simple rules that do a better job of capturing real life than the simple MP system does. As long as we&apos;re at all trying to mimic reality, we&apos;ll find it easier to work with the mental strain model than the MP system.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Sticklike is a Model&lt;/h3&gt;&lt;br /&gt;This brings us to the aforementioned sticklike properties. The reason I implemented it, and the reason it works so well, is not because it&apos;s a good &amp;quot;system&amp;quot; for storing things. It works well because it&apos;s a good model for reality. It&apos;s based on euclidean geometry in a way that is mathematically sound.&lt;br /&gt;&lt;br /&gt;It&apos;s not a full physics simulation. A full physics simulation can be very fun; the trick is to make sure that a) it can can capture the variety of effects we want to capture and b) it&apos;s not too difficult to structure gameplay around it. But by this theory, physics is a better model for reality, and so works more naturally in a game design sense, too.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Water Containment&lt;/h3&gt;&lt;br /&gt;What I realized this morning, was that I could fairly easily handle water containment, now that I have this model. The basic idea is that, we add a tiny bit of extra information to our model. First, for pointlike objects, are they a liquid (maybe in the future, how much). Also, for liquids, a liquid color would be useful (future? opacity). &lt;br /&gt;&lt;br /&gt;For planelike objects (really, should be boxlike) we just need to flag if they will hold water or not.&lt;br /&gt;&lt;br /&gt;With this information, we can make very slight modifications to the existing model in only a few places to allow jugs, etc. to contain liquids. Moreover, and more amazing, we can actually quite consistently show the liquid being contained. &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Too Much Detail&lt;/h3&gt;&lt;br /&gt;I really shouldn&apos;t go into this much detail, but I do need to make notes for myself to read over tomorrow (the primary purpose of this dev blog, after all =)&lt;br /&gt;&lt;br /&gt;We have already something called an areafiller. When we are creating the renderable object, we pass in an areafiller. This filler just takes two parameters, W and H, and returns a renderable object. The generator that uses the areafiller doesn&apos;t need to know anything about it, which is what is nice. &lt;br /&gt;&lt;br /&gt;What we do is create a special areafiller generator which returns an areafiller that shows the contents of an object (items inside) and also calculates liquids. This already exists, and works marvellously; we just have to extend it to show liquids.&lt;br /&gt;&lt;br /&gt;Net result is that for instance, if we open up a box we can see what is inside, no matter what we put in. So simple but it&apos;s very satisfying as a player. This will just be extended to show liquids, if we&apos;re containing any. &lt;br /&gt;&lt;br /&gt;Net result, if you put flowers and water into a jug, it will figure out based on the volume of water and the dimensions of the jug, how high the water should come, and render it. It will also show the flowers in the jug.&lt;br /&gt;&lt;br /&gt;Behaviourally, we also have nice effects. For instance, how do we fill a jug with water from another source? We just put it in that source, and then take it out again. A bigger jug will contain a smaller one. &lt;br /&gt;&lt;br /&gt;We could also envision an object-to-object move mechanic, but that isn&apos;t implemented and might be overkill (though it might be more intuitive, and hence worthwhile). &lt;br /&gt;&lt;br /&gt;The other thing we could do, is when you drag a jug to another jug, if the first jug has a liquid in it, it will pour the liquid in.&lt;br /&gt;&lt;br /&gt;We also need some way to account for volumes. I think the most consistent, model-like way of doing it would be to specify the volume of the water in liters. That would work but I have to think whether I really want to. First step would be to have a liquid object have a fixed number of liters.&lt;br /&gt;&lt;br /&gt;We need also to handle mixing. This itself shouldn&apos;t be too hard, as long as you can end up with swampwater at the end (if you e.g., mix things that we don&apos;t know what it should produce). I&apos;ll have to think about it, but this would be a worthwhile model/system to have in place.&lt;br /&gt;&lt;br /&gt;Enough! Lots to think of, and we shouldn&apos;t implement this right away. These things should be mulled over for a day or two before we start to implement. But containing liquids is going to go in, one way or another.</description>
  <comments>http://psysal.livejournal.com/66184.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/65904.html</guid>
  <pubDate>Fri, 05 Jun 2009 04:47:34 GMT</pubDate>
  <title>StickLike Property</title>
  <link>http://psysal.livejournal.com/65904.html</link>
  <description>Most things in a game can be thought of standing up, with a base dimension and a height. For example a treasure box, it might have a 2x1 and be 1.5 high. These things are essentially &quot;block like&quot;, they have effectively a 2-dimensional base. Since they have a 2-dimensional base, they can stand on their own.&lt;br /&gt;&lt;br /&gt;Imagine putting a box inside another box. If the base of the smaller box is bigger than the outer box, it won&apos;t fit. Objects in Texas only turn in 1/4 turn increments, so we could try reorienting it one way but generally, it&apos;s an easy check.&lt;br /&gt;&lt;br /&gt;Other things are small, for instance a coin. This is more like an object with a 0-dimensional base. We could think of putting infinitely many of these things into a containing box. They take up such a small amount of space, they can fit in any shape as long as it&apos;s 2-dimensional; it will never &quot;not fit&quot; and never fill it up.&lt;br /&gt;&lt;br /&gt;Of course, you might notice we&apos;ve skipped a dimension. And in fact, that&apos;s right! Some things can be thought of as having a 1-dimensional base. These are &quot;stick like&quot; objects.&lt;br /&gt;&lt;br /&gt;The trick with stick-like objects is their unique topology when it comes to fitting into other things. Imagine a flower in a vase. The vase has a 2D base, and the flower has a 1D base. We can fit infinitely many flowers into the vase, as long as we tilt it up. Once it&apos;s tilted up, it has effectively a point or 0D base and so it will fit. But if it&apos;s on it&apos;s side, it has a 1D base and we can&apos;t even fit one in.&lt;br /&gt;&lt;br /&gt;Now imagine a sword. We can put a sword into the vase, as well, as long as we stand it up. So a sword might be most interesting if we model it as a 1D object.&lt;br /&gt;&lt;br /&gt;1D objects are also special in how they interact with the terrain and building surfaces. Mainly, sometimes they might lay down and sometimes they might lean on things. A sword looks quite natural leaning against a wall, as does a shovel, pitchfork. It depends on how long it is, how close it is to a wall, etc., as to whether it should lean against the wall or just lay flat on the ground.&lt;br /&gt;&lt;br /&gt;We want to implement sticklike mechanics, for now. Boxes and containers with 2D bases will, for now, only contain 0D and 1D things. 1D things will stand up, and only fit if they aren&apos;t too tall for the container (i.e., they would tip out: imagine putting a really tall pitchfork into a vase-- it would tip it over)&lt;br /&gt;&lt;br /&gt;This is the easiest part. The harder part is when they drop on the ground. What we want to do is calculate an appropriate &quot;leaning&quot; slope for each dropping direction. So they will have a position where they are dropped, but they will lean in one of four directions depending on the slope of the terrain/building.&lt;br /&gt;&lt;br /&gt;Imagine a pitchfork. Call the fork end the top, and the other end the bottom. The bottom point, end of the handle, corresponds to where the pitchfork is dropped. Since it has a 0D base (as it&apos;s a 2D object) it will fall one of four directions. The algorithm for placing it could therefore look like:&lt;br /&gt;&lt;br /&gt;1. Pick a random direction to fall.&lt;br /&gt;2. Calculate the fall mechanic.&lt;br /&gt;&lt;br /&gt;Step 2, to calculate the fall mechanic, will depend on how long it is. But basically, we would start with a slope = 0 (i.e., laying flat) and iterate per-block over the length of the pitchfork. Each block we encounter that we&apos;d be intersecting (i.e., if it fell in the direction of a wall or a table) we would re-calculate a larger slope, and start over. We start over because the slope will affect how many blocks we need to iterate; when the slope is 0, we iterate the most number of blocks; if it were possible to be standing perfectly straight (slope inf) then we would not iterate any.&lt;br /&gt;&lt;br /&gt;Once we can iterate the whole length of the pitchfork, we have the final slope. This doesn&apos;t take into account center-of-gravity issues, but for now, let&apos;s ignore that. We&apos;ll just assume there is a lot of friction at the bottom end of the pitchfork, so that if it leans against even a short box, it will still have the bottom end touching the ground (versus tipping over the box). We could, however, probably take that into account without *too* much difficulty, by changing the initial Z position that we iterate from.&lt;br /&gt;&lt;br /&gt;Once we have this algorithm, we can choose a &quot;resting slope&quot; for the pitchfork, and it will appear to rest on the ground naturally where we dropped it.&lt;br /&gt;&lt;br /&gt;One more thing remains, which is we can make Step 1. a bit smarter. Instead of choosing randomly, calculate the resting slopes for all four possible fall directions. Let&apos;s assume the player is a bit smart. He knows in advance how the pitchfork will rest, just as you or I would, before he sets it down. By default, he wants it to be standing up, since it&apos;s tidier and easier to reach in the future. So if there is a resting angle that is &quot;standing up&quot;, i.e., high enough slope, then choose it.&lt;br /&gt;&lt;br /&gt;Otherwise, he doesn&apos;t want it to be resting in a way that, as per our final note on Step 1, would result in in with a weird center of gravity issue (e.g., he&apos;s not going to lean it against a short box since he knows it will slide off). So if that&apos;s the situation, choose whatever direction has the flattest slope.&lt;br /&gt;&lt;br /&gt;One final note. What if we drop it while standing on a short box, or something? Well in this case, it&apos;s fine, the slope will be negative but the general rules still apply, more or less. In this case, there won&apos;t be a way to &quot;stand it up&quot; at all; so choose the flattest (minimum of absolute value of slope) slope to place it. We just end up with a negative resting slope.&lt;br /&gt;&lt;br /&gt;In fact, a negative resting slope will cause us to appear to poke through whatever we&apos;re resting on, but we can fix that by incrementing our position artificially by whatever direction we chose to fall in, * 0.5 blocks.&lt;br /&gt;&lt;br /&gt;VOILA! This is kind of complicated, but something I&apos;ve been wrestling with for awhile, and today it sort of came to me how to solve it. So I wanted to write it up before it was lost.</description>
  <comments>http://psysal.livejournal.com/65904.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/65586.html</guid>
  <pubDate>Wed, 03 Jun 2009 06:32:07 GMT</pubDate>
  <title>Set Pieces, Backstory</title>
  <link>http://psysal.livejournal.com/65586.html</link>
  <description>I&apos;ve started to add some backstory, and some set pieces to the game.&lt;br /&gt;&lt;br /&gt;&lt;lj-embed id=&quot;3&quot; /&gt;&lt;br /&gt;&lt;br /&gt;Also on &lt;a href=&quot;http://www.youtube.com/watch?v=A_qCuBcKw7o&quot;&gt;YouTube&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Since the castle is a tourist destination, it makes sense to have informational signs in each room explaining what the historic role of the room was and supplying some interesting facts. These facts are purely made-up and fake, tee hee.&lt;br /&gt;&lt;br /&gt;Moreover, these signs are setting-space for inserting important backstory details later on. For instance, the castle may or may not have been once occupied by a mad wizard. If that&apos;s the case, then we can make allusions to it on certain signs, the game design equivalent to literary foreshadowing.&lt;br /&gt;&lt;br /&gt;Other signs just serve the purpose of making the setting more consistent, and adding humorous details for the player to chuckle at. If we do a really good job, we can create the effect of causing for the player the &quot;I wonder what *that* sign says&quot;.&lt;br /&gt;&lt;br /&gt;A set piece is some visual resource that exists in only one place. These seem a bit expensive to make: for instance, the set piece I most recently created was a suit of armour. It took around two mornings to put together.&lt;br /&gt;&lt;br /&gt;What a set piece does I think is help to create a bell curve for uniqueness of game visuals. Graphics in a game will usually repeat many times, and the player will notice this (of course). &lt;br /&gt;&lt;br /&gt;Now imagine, for each graphical object of type T, it appears N times somewhere in the game. We look at all objects of type T and count their N instances, and create a graph using it.&lt;br /&gt;&lt;br /&gt;If every object appeared 50 times, we would have a flat curve. My theory is that this is unnatural. I think in the real world, objects occur according to a bell curve. So for instance, some objects are relatively plentiful (these exist at the center of the curve) and some are quite rare (these exist at the ends of the curve).&lt;br /&gt;&lt;br /&gt;If we tailor the repetition of objects to a bell curve, this will more closely match yours and my day-to-day experience with discrete objects in the real world. Laptops are more rare than leaves, but not so rare as an ancient ruin or as Ankor Wat (which is more like a real-world set piece). Houses are fairly common, but again not as common as leaves. &lt;br /&gt;&lt;br /&gt;When you get to grains of sand, you could say they are so common that they break the bell curve, but we don&apos;t normally perceive them as discrete objects. Instead, we group them into beaches or maybe conceive them as handful-sized-lumps, in which case they probably fit somewhere in the same realm as leaves, rocks, blades of grass, and that sort of thing.</description>
  <comments>http://psysal.livejournal.com/65586.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/65372.html</guid>
  <pubDate>Mon, 01 Jun 2009 07:19:33 GMT</pubDate>
  <title>Let&apos;s Talk: Episode 1</title>
  <link>http://psysal.livejournal.com/65372.html</link>
  <description>Aha, here it is! Episode 1 of my video blog:&lt;br /&gt;&lt;br /&gt;&lt;lj-embed id=&quot;1&quot; /&gt;&lt;br /&gt;&lt;a href=&quot;http://vimeo.com/4893217&quot;&gt;Let&apos;s Talk Ep 1: Bouncing Deer&lt;/a&gt; on Vimeo.&lt;br /&gt;&lt;br /&gt;This is a bit of an experiment, a bit of a promotional thing, and a bit just for the hell of it. I want people to know about my game, obviously, but I want to have some fun with it too.&lt;br /&gt;&lt;br /&gt;Lessons learned:&lt;br /&gt;&lt;br /&gt;- Camera footage looks kinda very bad, better find a way to fix it&lt;br /&gt;- Need to come up with a more homogeneous way to record my voice&lt;br /&gt;- It takes a long time to make but not too long&lt;br /&gt;- A simple script and some planning helps things along wonderfully&lt;br /&gt;- A little music, even used without permission, can make a big difference&lt;br /&gt;- Microsoft Movie Maker is actually totally awesome, but use simple (read: no) transitions for the best effect and just plan out your scenes/sync your audio cuts a bit.&lt;br /&gt;&lt;br /&gt;Inspiration:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://hamumu.com/behindthedumb.php&quot;&gt;Behind the Dumb&lt;/a&gt; by Hamumu and &lt;a href=&quot;http://blog.wolfire.com&quot;&gt;the Wolfire blog&lt;/a&gt;.</description>
  <comments>http://psysal.livejournal.com/65372.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/65184.html</guid>
  <pubDate>Wed, 27 May 2009 00:08:11 GMT</pubDate>
  <title>Website, Video, Hamumu, Objects</title>
  <link>http://psysal.livejournal.com/65184.html</link>
  <description>First off, I&apos;ve made a first gameplay video and finished revamping my website. You can see both of them here:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.kittylambda.com&quot;&gt;http://www.kittylambda.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I think that I can&apos;t continue to separate game development from game promotion. I think I&apos;m going to do some kind of video blog, because I&apos;ve really enjoyed Hamumu&apos;s Behind the Dumb:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://hamumu.com/behindthedumb.php&quot;&gt;http://hamumu.com/behindthedumb.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;However, I&apos;ve spent most of the past week working on this stuff, and I think it&apos;s now time to move on to other things; namely actual game development. I&apos;m going to start off by changing the deer animation and then start adding some more game objects, like a suit of armour for the east hallway and maybe a chandelier or two.</description>
  <comments>http://psysal.livejournal.com/65184.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/64991.html</guid>
  <pubDate>Mon, 18 May 2009 01:50:09 GMT</pubDate>
  <title>BeautifulTimer</title>
  <link>http://psysal.livejournal.com/64991.html</link>
  <description>Now let me tell you about BeautifulTimer; this is (close to) the best way I&apos;ve found for doing game loop timing.&lt;br /&gt;&lt;br /&gt;First, you (of course) split your game logic into update (T) and render () sections. update (T) controls all game logic and animation state, and T is an input variable representing elapsed time since the last frame. render () just draws things to the screen, based on the current game logic and animation state.&lt;br /&gt;&lt;br /&gt;Timer Type 0: Type 0 game loop timers are those that ignore or don&apos;t have the T-parameter in update (), and don&apos;t have any special waiting cycles. This can be effective I&apos;d imagine on very specific hardware, but it&apos;s problematic for two reasons. i) if the hardware is too fast, the game will run too fast, and ii) if the hardware is too slow, the game will run too slow.&lt;br /&gt;&lt;br /&gt;Timer Type 1: Type 1 game loop timers are where you have an additional wait () method in between frames. The idea is simply to figure out how long it&apos;s been since the last frame, and wait long enough. Think of this as a fixed frame rate timer. Given that ii) above isn&apos;t a problem, then using this the game will run at a constant framerate. In this situation the update (T) does not need the T parameter; each time it&apos;s called, you can call update with the same value for T since the same amount of time (ignoring ii) has elapsed.&lt;br /&gt;&lt;br /&gt;Timer Type 2: Type 2 game loop timers are where you now call update (T) with a T value containing how long has elapsed since the last frame, and where you have a wait () method as in type 1. This takes care (ostensibly) of i) because you wait () to make sure that the game doesn&apos;t run too quickly, and ii) because you&apos;re updating game logic with larger timesteps: the player&apos;s brain will fill in the details.&lt;br /&gt;&lt;br /&gt;Most game developers will be familiar with all of these types of timers.&lt;br /&gt;&lt;br /&gt;There are some problems with Timer Type 2, that cause many developers to revert to using Timer Type 1 and trying to optimize their code enough to avoid ii).&lt;br /&gt;&lt;br /&gt;Problem 1: Physics and other game code becomes unstable/unreliable with large timesteps. As the game takes longer to process each frame, the gameplay can completely go off the rails: stuff can fly through walls, oscillating relationships can explode, and so forth. You don&apos;t want a game where on a slow enough machine, the player can just walk through walls or past the final boss, or where the player can&apos;t swing his sword because it causes a floating point error. Eew!&lt;br /&gt;&lt;br /&gt;Problem 2: Coding everything to relate to parameter T can be a chore. This might be true, but I actually don&apos;t think so. When you code logic updates without T, you are thinking in terms of frames. This is an additional calculation for your brain to make to create a very good intuitive guess as to what game behaviour should be. For example, do you want the NPC to stand and look at the wall for 1.5 seconds, or 90 frames? &lt;br /&gt;&lt;br /&gt;Parameter T is always present, it&apos;s just that if absent then it&apos;s implied to be the time for one frame. And, well, you can teach yourself to think in frames, but I think seconds might be a bit more intuitive. And coding relative to a floating-point time value might make some code easier to tweak.&lt;br /&gt;&lt;br /&gt;This bring us to BeautifulTimer.&lt;br /&gt;&lt;br /&gt;First, we observe that if we just clamp T to a certain range, say to a maximum of 1/10th of a second, we can avoid many &quot;exploding&quot; or gameplay logic errors. How big MAX_T can be is a bit of an exercise, but you can always implement a debug mode with the largest-possible T and do your testing that way.&lt;br /&gt;&lt;br /&gt;Second, we observe that often the render () code is why things run slowly. When the camera pans out, there usually isn&apos;t more game logic to calculate, there is just more to draw to the screen. Likewise, situations that cause the game logic to suddenly grind to a halt are probably things that have to be avoided or optimized away (e.g., a flock of enemies replicating exponentially will cause your game logic to stutter, but probably indicates a bug somewhere).&lt;br /&gt;&lt;br /&gt;Further, the update (T) game logic code can often be optimized more easily than render (). You&apos;ve always got to show a complete screenful of plants, buildings, people, monsters and items. You just can&apos;t normally leave any of them out (assuming they are supposed to be visible). But, you could tweak your spaceship AI code to only run half as often, when you discover using a profiler that it&apos;s a bottleneck. Easy.&lt;br /&gt;&lt;br /&gt;What we do then, is allow to run update (T) more than once per call to render (), if T exceeds MAX_T. We still probably want to clamp this, i.e., only allow at maximum 3 or 4 calls to update (T) per one call to render (), and there might be more sophisticated ways to figure out where the bottleneck is, but that&apos;s the core idea.&lt;br /&gt;&lt;br /&gt;So the final game loop using BeautifulTimer looks like this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
MinT = (1/60)
MaxT = (1/10)
MaxCycles = 5 

LastFrameTime = TimeNow ()
loop:
   
   -- handle the waiting; make sure the game never runs faster thna 1/MinT FPS
   CurFrameTime = TimeNow ()
   T = CurFrameTime - LastFrameTime
   if (Elapsed &amp;lt; MinT) then:
      WaitFor (MinT - T)
   LastFrameTime = CurFrameTime
   
   -- compute the number of update cycles so that we never call update with T &amp;gt; MaxT
   NumCycles = 1 + floor (T / MaxT)
   CycleT = T / (NumCycles)
   if (NumCycles &amp;gt; MaxCycles) then: 
      NumCycles = MaxCycles

   -- call update T the appropriate number of times
   for NumCycles times do:
      Update (CycleT)

   -- now, render to screen
   Render ()
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That, my friends, is BeautifulTimer</description>
  <comments>http://psysal.livejournal.com/64991.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>6</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/64753.html</guid>
  <pubDate>Wed, 13 May 2009 02:25:39 GMT</pubDate>
  <title>Chiang Mai</title>
  <link>http://psysal.livejournal.com/64753.html</link>
  <description>Well, we&apos;ve arrived in Chiang Mai, Thailand. So far, so good: this is an incredible city. Bangkok is the city of many tuk-tuk drivers and (unfortunately) many scammers. Chiang Mai is beautiful. Fortunately we were in Bangkok for only 3 days and we are in Chiang Mai for maybe as long as 7 weeks.&lt;br /&gt;&lt;br /&gt;People here know how to cook. Anything. All food here is good. Incredible, actually. Michelle and I tried, but could not really like Hong Kong food (with a few exceptions; Chinese desserts are really fun, if a bit odd). But I don&apos;t think we&apos;ve had bad food since we got to Thailand. Even the airplane food was good.&lt;br /&gt;&lt;br /&gt;In Bangkok we saw the new Star Trek movie at a mall called MBK, which is a big shopping mall the kids like to hang out at. It was a wonderful experience! People in Thailand know how to have a lot of fun, and as a tourist if you can somehow avoid some of the traps it&apos;s a great experience all-around.&lt;br /&gt;&lt;br /&gt;Now I&apos;m set up and going to dive back into Texas a bit this AM. We&apos;ll see where I get!</description>
  <comments>http://psysal.livejournal.com/64753.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/64264.html</guid>
  <pubDate>Sun, 03 May 2009 09:53:26 GMT</pubDate>
  <title>Back in the Saddle, Yaa hoo!</title>
  <link>http://psysal.livejournal.com/64264.html</link>
  <description>So today is the first day working on The Real Texas since Ludum Dare 48H. Truth is, it drained my creativity a bit but also allowed my paid job to pile up (and I had a ton of work to do there), so I got a bit swamped between the paid job and doing touristy things in Hong Kong.&lt;br /&gt;&lt;br /&gt;HK is really fun, and you should go here. The best part of Hong Kong is getting around, it&apos;s so easy! Buses go everywhere and are very affordable. It can be confusing and scary but it&apos;s effective. Anyhow.&lt;br /&gt;&lt;br /&gt;I&apos;ve mostly finished moving the sound engine over to C++. Still to do:&lt;br /&gt;&lt;br /&gt;- Implement soundable_union&lt;br /&gt;- Finish implementing soundable_sway&lt;br /&gt;&lt;br /&gt;I think this might be the fifth or sixth time in some fashion or another that I&apos;ve coded the sway engine.&lt;br /&gt;&lt;br /&gt;Moving the soundable engine to C++ really actually did make sense; I guess it&apos;s just something that should be in C++. Should give me really nice framerate gains (unless the profiler was lying, which I don&apos;t think).&lt;br /&gt;&lt;br /&gt;Premature Optimization? A great question. In some sense, you might imagine creating an entire game and only then doing your optimization. But I find in practice what works better is to optimize in cycles; otherwise your game may not &quot;feel&quot; right as you are developing it. Sounds kind of weak but, I generally develop until the framerate seems stuttery, and the optimize until I get rid of whatever issues have cropped up.&lt;br /&gt;&lt;br /&gt;THATS ALL FOR NOW, FOLKS!</description>
  <comments>http://psysal.livejournal.com/64264.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>4</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/64105.html</guid>
  <pubDate>Wed, 15 Apr 2009 05:12:03 GMT</pubDate>
  <title>Going With Option 1</title>
  <link>http://psysal.livejournal.com/64105.html</link>
  <description>Well this is a revision from two posts back. I implemented the simulation code the way I planned, and the glue, etc.; but the trouble is there are tens of thousands of calls to the code that links the simulation to the lua code. It&apos;s messy.&lt;br /&gt;&lt;br /&gt;I don&apos;t know if the simulation code itself is, after all, going to be useful. But I have decided to take the soundable () class out of lua; the basis for putting it in lua instead of C++ was that it was simple enough and wouldn&apos;t suck up any CPU. Well, the profiler is telling me that no matter how I try and slice this one, it&apos;s sucking up a lot of CPU. So out it goes!</description>
  <comments>http://psysal.livejournal.com/64105.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/63980.html</guid>
  <pubDate>Wed, 15 Apr 2009 01:21:31 GMT</pubDate>
  <title>Save Points, Zelda 1</title>
  <link>http://psysal.livejournal.com/63980.html</link>
  <description>Here&apos;s a trick for you. You&apos;ve got a large world that can be explored in a nonlinear fashion, and you don&apos;t want the player to have to walk that same stretch of ground over and over.&lt;br /&gt;&lt;br /&gt;In Zelda 1, you always started the game on a certain screen in the overworld, or on the first screen of a dungeon in the underworld. This had the effect of making the overworld like a giant, &quot;loose&quot; level: when you were in death mountain area, you were a long ways from that first home screen and so you didn&apos;t want to die. This made sense because Zelda 1 had lots of enemies roaming the overworld, which got more difficult the further from &quot;home&quot; you went. &lt;br /&gt;&lt;br /&gt;In the dungeons it made even more sense because they played out even more linearly: by the time you got to the final boss you had braved many dangers and wouldn&apos;t want to have to go back to the start.&lt;br /&gt;&lt;br /&gt;*** Digression! ***&lt;br /&gt;&lt;br /&gt;You remember how you&apos;d always start out with three hearts? At the start of the game, you&apos;d only have three hearts in total anyhow, so no big deal. However by the time you got to the middle section of the game, three hearts wasn&apos;t very much. The first thing you&apos;d always do was walk to the fairy so you could get refilled. When you were tackling dungeons, you had much the same problem. You&apos;d die, and warp to the start of the dungeon, but good luck tackling it with only three hearts! So you&apos;d have to go to a nearby fairy spring. And maybe even buy healing potions, a lot of preparation!&lt;br /&gt;&lt;br /&gt;Zelda 3: LTTP (the SNES one) fixed this dungeon-hearts issue by putting fairy springs in the dungeons themselves. A nice twist!&lt;br /&gt;&lt;br /&gt;What&apos;s interesting to me is how similar this problem (situation? mechanic?) is to what we see in a shooter like gradius, where your weapons power up as you play. When you die you start back at the last checkpoint, but good luck making it last without your weapons. In some shooters this becomes a crippling problem for the player, so that the game almost operates in such a way that you have to play certain large sections without dying, or else you&apos;re stuck.&lt;br /&gt;&lt;br /&gt;In the case of Zelda, it isn&apos;t so severe and so it&apos;s OK. I still think it&apos;s a little bit arduous, visiting fairies and collecting heal potions, but it has the upside of creating a higher level of anticipation for your dungeon-dive or boss-fight or whatnot. For shooters though, it&apos;s really a gameplay design bug similar to a game where you can save at such a place/etc. that you can&apos;t beat the game and have to start over from the start.&lt;br /&gt;&lt;br /&gt;*** End Digression ***&lt;br /&gt;&lt;br /&gt;In Texas, I need to prevent the player from walking overland too much because there isn&apos;t supposed to be any particular challenge to the overworld, at least most sections. So if you quit or die, where should you re-start?&lt;br /&gt;&lt;br /&gt;I think there are sections of overworld that will play out like in Zelda 1. There is a bridge that you cross and on the other side are monsters. But for the peaceful areas, I think you should restart at whatever screen you last entered. Since there is no special challenge or obstacle in moving from area to area here, you should just start where you left off.&lt;br /&gt;&lt;br /&gt;This is fairly easy to implement, which is a nice side-effect. So in most areas it will auto-save when you enter the area, but if you&apos;re north of the bridge or if you&apos;re in a dungeon/etc. it will save only at designated checkpoints.&lt;br /&gt;&lt;br /&gt;There are some other design choices to make there but they probably aren&apos;t too hard!</description>
  <comments>http://psysal.livejournal.com/63980.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/63620.html</guid>
  <pubDate>Mon, 13 Apr 2009 00:56:33 GMT</pubDate>
  <title>LuaProfiler, Simulation</title>
  <link>http://psysal.livejournal.com/63620.html</link>
  <description>Hello! So I&apos;m working from HK which means using the wife&apos;s laptop. What I discovered once getting Texas to compile for windows is that it doesn&apos;t run as quickly on her machine. Naturally, thought I, It&apos;s a graphics card related problem. Reason being, my Sempron 2800 CPU can&apos;t be faster than Core2 Duo, right?&lt;br /&gt;&lt;br /&gt;Always remember that laptops are underpowered, flaky, and stupid.&lt;br /&gt;&lt;br /&gt;I ran the profiler and it turned out that a lot of time was being spent in lua_pcall and the like, which meant that the lua code was sucking all the time. So it&apos;s not a graphics related slowdown, it has to do with the CPU. I downloaded LuaProfiler and figured out how to get it to work.&lt;br /&gt;&lt;br /&gt;The trick with LuaProfiler is that a) it only gives you function names, which is a pity e.g., when you have a class heirarchy like classname:update (T) it will lump all the update () functions together and b) it doesn&apos;t give you a call graph. The call graph you can work around by searching your code and cross-referencing but separating out the lumped-together function names is a hassle. What I do is for each class&apos;s update (T) method, I peel it out into classname_update (T) and have classname:update(T) call self:classname_update (T). This is sort of labor intensive, adds a certain inefficiency on top of what&apos;s already there, but it works.&lt;br /&gt;&lt;br /&gt;Anyhow what I&apos;ve learned is that a great deal of time is spent in my lovely &quot;sway&quot; simulation code, for sound effects. Yeargh! This is a bummer, and I think the only real way to get it to work efficiently is to peel the code into C++. There is probably a workable hack but it doesn&apos;t feel right.&lt;br /&gt;&lt;br /&gt;The question then, is what code should I peel into C++? I actually run sway simulations in a couple of places. Once for renderables (visible elements) and once for soundables (audible elements). However, the renderables are all in C++ and have appropriate glue to link them with lua. For soundables, I put them into straight lua and this it turns out is much nicer to work with because it lacks the glue. Only in the case of this sway simulation has it caused a problem, because whereas with the renderable the sway code is all C++ and runs instantly the lua equivalent is sucking up a lot of CPU time.&lt;br /&gt;&lt;br /&gt;Option 1 would be to rip out the entirely soundable stuff from lua and make it C++. This is kind of an ugly option because of the amount of code it probably will end up touching. As well, it would be a lot of code to convert from lua to C++. The nice part is that it would solve the efficiency problem quite neatly, and probably give a meaningful efficiency gain for other parts of the code, as well.&lt;br /&gt;&lt;br /&gt;Option 2 is to take an create a special &quot;simulation&quot; class hierarchy. So what I would have is an abstract &quot;simulation&quot; class where you&apos;d be able to create different simulations (right now, I&apos;d just have a swaying one) and then glue them into lua, e.g. with an abstract push_lua_state (L) function that creates a lua table on the stack to return. The sway soundable would then create a sway simulation and just read the appropriate parameters to determine if it needs to play a sound.&lt;br /&gt;&lt;br /&gt;Option 2 on the surface seems clunky, but I think I will go with it. There are a couple of reasons. First, there are the problems inherent with Option 1 above. But second, Option 2 is actually more forward-looking. &lt;br /&gt;&lt;br /&gt;What I&apos;d like to have in the future is actually less C++ code with more general glue. That will probably necessitate some way to take code from lua and put it into C++ when there are real efficiency problems. Pursuing this pathway might help me to see what a good way to do this is, for future projects. There is the added benefit that I might need to move other lua code into C++ later on, and I&apos;d then have a framework in place to do it.</description>
  <comments>http://psysal.livejournal.com/63620.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/63486.html</guid>
  <pubDate>Tue, 07 Apr 2009 22:51:06 GMT</pubDate>
  <title>Hong Konging it With Windows Vista</title>
  <link>http://psysal.livejournal.com/63486.html</link>
  <description>Hey everybody!&lt;br /&gt;&lt;br /&gt;I&apos;m in Hong Kong now, in Sai Kung district. Staying with some friends here, what an amazing place. This is the greatest city I&apos;ve ever seen, and I&apos;ve seen 4 or 5 cities! Even if I see more, however, I have a hunch this will stay as the greatest. It&apos;s a wonderland.&lt;br /&gt;&lt;br /&gt;Anyhow, while I&apos;m here I&apos;m working on my wife&apos;s laptop. So naturally, I&apos;ve loaded the poor beast up with about a zillion different developer applications and indie games and have just yesterday set to getting Texas to compile on Vista.&lt;br /&gt;&lt;br /&gt;Hooray for Mingw32, I have it working. There are a few issues, but they seem to be graphics-card related (It&apos;s Intel 945G, which is the same card that Venture the Void never seemed to want to run on.) This is a great opportunity for me to increase the compatability of Texas and also maybe make it run a bit faster.&lt;br /&gt;&lt;br /&gt;My plan is to keep working while in HK, both on Texas and also my real paying job. This vacation will last 3 months, 1 month here and 2 in Thailand. Here is a picture I took of the village where we are staying:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://picasaweb.google.com/lh/photo/86PjD40gLNX6xmaa6l_LxQ?feat=embedwebsite&quot;&gt;&lt;img src=&quot;http://lh5.ggpht.com/_RXDsvn8nZo4/SdsaPYEQOrI/AAAAAAAABPI/nIwb5c7iijM/s800/Hong%20Kong%202009%20075.JPG&quot; /&gt;&lt;/a&gt;</description>
  <comments>http://psysal.livejournal.com/63486.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/63143.html</guid>
  <pubDate>Fri, 13 Mar 2009 15:16:19 GMT</pubDate>
  <title>Replays</title>
  <link>http://psysal.livejournal.com/63143.html</link>
  <description>One of things I am wanting to do with Texas is allow for replays. This is purely for testing purposes, or rather, for evaluating how people are playing the game. I want to be able to see in beta test where people might be getting stuck, what might be confusing, etc.&lt;br /&gt;&lt;br /&gt;To that end I&apos;m putting in a replay capability. The idea is just to record all the keyboard and mouse input as well as frame timings, etc., and then save to a file. When the game is loaded, you can indicate a replay and watch what the player did. I&apos;ll have to make sure that the random number seeding happens in sync as well, i.e., it&apos;s recorded in the replay or it&apos;s determined at game start so that everything makes sense.&lt;br /&gt;&lt;br /&gt;I guess the place to start is to ask what needs to be recorded? Right now I&apos;m thinking that initial save game state, frame timings, keybord presses and releases, as well as mouse clicks and releases. When I replay, I will have to populate somehow the mouse position and keyboard state array as well as send the events that are read from the file.&lt;br /&gt;&lt;br /&gt;It&apos;s a pretty involved feature but I think in the end it will be more than worth it, to watch people play the game and see how it&apos;s unfolding for them.</description>
  <comments>http://psysal.livejournal.com/63143.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/62788.html</guid>
  <pubDate>Fri, 13 Feb 2009 20:08:34 GMT</pubDate>
  <title>More Tutorial Nonsense...</title>
  <link>http://psysal.livejournal.com/62788.html</link>
  <description>So I have cutscenes worked out, which helps me in my tutorial area. But in my design there are these little blocks which are used to describe to the player what to do, and I&apos;m not 100% sure yet how they should work. Think of them as actual tutorial text, vs. cutscenes which are story-related. A player might choose to disable the tutorials but you can&apos;t disable cutscenes since they control gameplay.&lt;br /&gt;&lt;br /&gt;Option 1: A very advanced tutorial mode that tells you where to click.&lt;br /&gt;&lt;br /&gt;This is problematic because it&apos;s just a ton of work to get working right. You need to be able to detect everything the player is doing, where they are clicking, and hover indicator arrows over the correct buttons and so forth.&lt;br /&gt;&lt;br /&gt;Option 2: A less advanced tutorial mode that consists of some help text, that you can re-read, and a &quot;detector&quot; that can tell when you&apos;ve completed the tutorial action.&lt;br /&gt;&lt;br /&gt;This is probably the way I&apos;ll go; it&apos;s (yet) another UI dialog, but not a difficult one. My current idea is to parody &quot;clippy&quot; with &quot;gunny&quot;, your friendly gameplay six-shooter gun helper. Gunny sits at the right of the screen when there is a tutorial available. The text describes what you need to do, possibly using pictures, but doesn&apos;t detect each action and overlay the interface directly. So for example, in a basic sense it would say, &quot;click the inventory button, then find your hat in your inventory and drag it to your head&quot; along with some pictures. Then gunny sits there looking at you and when you&apos;ve completed the action, he says &quot;Great job! Now you&apos;re wearing your hat!&quot; and disappears.&lt;br /&gt;&lt;br /&gt;Logistically, this requires only a few triggers: a trigger to detect the start of the tutorial, a trigger to detect if you&apos;ve moved out of range of the tutorial (i.e., if you seem to not be interested in completing it), and a trigger to detect that you&apos;ve completed the tutorial. &lt;br /&gt;&lt;br /&gt;My current thinking is to tie these tutorials to places and game state; this is very similar to cutscenes so I may integrate with the cutscene system I just implemented (and really, that would be the sensible thing to do). When you are at a specific place and the game state matches the appropriate state, the help text will trigger, and leave a little picture of gunny and a help button on-screen for you to click. If you complete the given action, regardless where you are, a bubble pops up saying you completed that tutorial. If you leave the area, the help button disappears but the tutorial remains active.&lt;br /&gt;&lt;br /&gt;Everybody hated clippy. Will they hate gunny?</description>
  <comments>http://psysal.livejournal.com/62788.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/62669.html</guid>
  <pubDate>Fri, 13 Feb 2009 00:02:09 GMT</pubDate>
  <title>Success with cutscenes!</title>
  <link>http://psysal.livejournal.com/62669.html</link>
  <description>Here&apos;s the final solution:&lt;br /&gt;&lt;br /&gt;- A cutscene class (in lua) that includes some handy methods and mostly automates cutscenes&lt;br /&gt;- Derived classes for each cutscene, or each type of cutscene&lt;br /&gt;- Don&apos;t think &amp;quot;cutscene&amp;quot;, neccessarily, think &amp;quot;event&amp;quot;&lt;br /&gt;- There is also a cutscene manager that handles adding cutscenes to areas, etc.&lt;br /&gt;&lt;br /&gt;This leaves a fairly lightweight footprint for implementing cutscenes. For instance, I have implemented a &amp;quot;cutscene_forgothat&amp;quot; type but this could actually be a generic one that takes three parameters: the place name to trigger, the text to say, and where to walk the player to. Then I can create these in the cutscene manager as much as I want and have the inserted and triggered into the game.&lt;br /&gt;&lt;br /&gt;The actual cutscene drone works much like the spellcasting sequences, with an additional tweak for the &amp;quot;event&amp;quot; dialog, which in the end was just a simple thing that pops along the bottom to show the text, with a &amp;quot;more&amp;quot; and &amp;quot;OK&amp;quot; button.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://picasaweb.google.ca/lh/photo/gAAkxGg8r8D8Z7mKEM662A?feat=embedwebsite&quot;&gt;&lt;img src=&quot;http://lh5.ggpht.com/_RXDsvn8nZo4/SZS6OvhilpI/AAAAAAAABLs/1ggU4UypdvE/s400/forgothat.png.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is the sequence for forgetting your hat:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Seq = {&lt;br /&gt;&lt;br /&gt;&amp;quot;@Something&apos;s not quite right.&amp;lt;p&amp;gt;England&apos;s bright, orange sun glowers itself hotly upon your brow.&amp;lt;p&amp;gt;...&amp;lt;p&amp;gt;Your hat! How could you have forgotten your hat?&amp;lt;p&amp;gt;It strikes you that it would be foolhardy to attempt serious tourism without your travelling companion. Your hat must be in the car.&amp;lt;p&amp;gt;If you searched the back seat, you might find it.&amp;quot;,&lt;br /&gt;&lt;br /&gt;drone_wait_event_dlg (drone_faceplayer ()),&lt;br /&gt;&lt;br /&gt;drone_moveplayer_to_place (&amp;quot;cutscene_forgothat_backoff_parkade&amp;quot;),&lt;br /&gt;&lt;br /&gt;function () self:retrigger () end&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
  <comments>http://psysal.livejournal.com/62669.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/62388.html</guid>
  <pubDate>Mon, 09 Feb 2009 23:25:49 GMT</pubDate>
  <title>Cutscenes. Argh!</title>
  <link>http://psysal.livejournal.com/62388.html</link>
  <description>For games that are strongly story-driven, the cutscene can be nearly ultimate. For me, to implement, they are ultimately annoying. I&apos;ve never had much success implementing them; it always feels awkward.&lt;br /&gt;&lt;br /&gt;In VtV the cutscenes were just pages of white text on a black screen, not too interesting but probably fit the game.&lt;br /&gt;&lt;br /&gt;To me the essence of the cutscene is that the player isn&apos;t in control anymore; they are a passive participant. If a game were all cutscenes, well then it wouldn&apos;t really be a game. But if you are desperately avoiding them, then the game may seem awkward at times, because you aren&apos;t using a tool that should be available to you and is sometimes (to me) the most obvious way to tell a story.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://picasaweb.google.ca/lh/photo/U84dQMm0atTLh4-SDP-MLA?feat=embedwebsite&quot;&gt;&lt;img src=&quot;http://lh4.ggpht.com/_RXDsvn8nZo4/SZC3-GUDrxI/AAAAAAAABKo/Nsa-11ohpvk/s800/parkade2.jpg&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So I&apos;ve got the initial tutorial area and one of the things I&apos;m trying to teach the player is how to equip clothing. To that end, they are going to want to put on their hat. My idea is that when the player (Sam) goes outside, he will remark that he feels naked to be outside without his cowboy hat. This is a bit artificial, to be sure, but I think it&apos;s acceptable.&lt;br /&gt;&lt;br /&gt;The best way, it seems to me, to accomplish this is a cutscene that is triggered when the player first steps on a certain area. But immediately there are so many problems! For instance:&lt;br /&gt;&lt;br /&gt;1- How do we detect that this cutscene should be activated? Of course there will have to be some code. My best idea is to have a global drone (AI module) which scans some kind of cutscene database and activates them as needed. I can use the existing place system, so that I can do some in-game editing to create a place (or places) where the cutscene happens, and then walk the player around using the cutscene itself. And that&apos;s my simplest idea.&lt;br /&gt;2- How do we show the character (who is a silent protagonist) talking to himself? I don&apos;t have a system in place to really address this. For instance, the UIs are all centered around talking to other people, and interacting with other objects. There is no UI for just simple talking. I need to create a UI for the tutorial hints, so maybe I will be able to re-use this one?&lt;br /&gt;3- How do I easily test them? For the most part they are going to play only once, and set a flag so they know not to load. I guess I can add some kind of &amp;quot;debug&amp;quot; flag to the cutscene database that will make them happen over and over again. But this seems tedious.&lt;br /&gt;&lt;br /&gt;There are more problems, to be sure. But I guess I have a starting place. I&apos;ll need an AI module to detect and activate them, some kind of generic dialog box that can just describe your thoughts or what&apos;s happening without necessarily allowing you to interact (as the normal dialog boxes do), and I&apos;ll have to keep in mind to create a system that makes them not too painful to test.</description>
  <comments>http://psysal.livejournal.com/62388.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/62042.html</guid>
  <pubDate>Tue, 27 Jan 2009 15:47:05 GMT</pubDate>
  <title>Planning for the Parking Garage</title>
  <link>http://psysal.livejournal.com/62042.html</link>
  <description>&lt;span class=&quot;gphoto-photocaption-caption&quot; style=&quot;&quot;&gt;Probably the biggest lesson learned from Venture the Void is to make a game accessible. The gameplay itself can be complex and varied but the player needs to feel they can interact with the game in a natural way. I guess you can think of it in terms of the &amp;quot;third wall&amp;quot;; you want the player to mentally be &lt;em&gt;in front&lt;/em&gt; of the third wall, i.e., on the stage. For that to happen the third wall itself (game controls and interface) should be as transparent as possible.&lt;br /&gt;&lt;br /&gt;So I&apos;m creating a tutorial area! A bit artificial in some ways, but by doing this I can be certain that the player understands and is aware of the main game controls.&lt;br /&gt;&lt;br /&gt;This fits naturally into the scheme of things, as I had a parking garage laid out in maps and in the story but not in the game. It&apos;s the first area you encounter and you can&apos;t return to it once you leave so it&apos;s a natural place to start. First I design the area:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href=&quot;http://picasaweb.google.ca/lh/photo/u44j_tqItDnGfxSxp-FcCg?feat=embedwebsite&quot;&gt;&lt;img src=&quot;http://lh5.ggpht.com/_RXDsvn8nZo4/SX9z8o4jxqI/AAAAAAAABJM/onKqEJjoUaE/s400/parkade.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span class=&quot;gphoto-photocaption-caption&quot; style=&quot;&quot;&gt;&lt;br /&gt;Once I&apos;ve implemented the area visually and put some of the more obvious objects in, so that I can see how it will&amp;nbsp;&amp;quot;feel&amp;quot;, how do I plan the gameplay for it?&lt;br /&gt;&lt;br /&gt;I make a dotfile, which is input for &lt;a href=&quot;http://graphviz.org&quot;&gt;GraphViz&lt;/a&gt;. I start by laying out some of the things I want the player to learn, without connecting them:&lt;br /&gt;&lt;br /&gt;learn_walk [shape=invtriangle color=red]; // learn about walking&lt;br /&gt;learn_click_objects [shape=invtriangle color=red]; // learn to click things to interact with them&lt;br /&gt;learn_click_keyword [shape=invtriangle color=red]; // learn to click on a keyword&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;The shape=invtriangle is visual language for &amp;quot;motivation&amp;quot; which is the most abstract sort of node. In this case I&apos;ve used it for what I want the player to learn.&lt;br /&gt;&lt;br /&gt;Next I put And I put lines&lt;/span&gt; for objects you can interact with, that I know will be in the parkade:&lt;br /&gt;&lt;br /&gt;explore_parkade [color=red];&lt;br /&gt;interact_samscar [color=red];&lt;br /&gt;interact_glovebox [color=red];&lt;br /&gt;interact_vendor [color=red];&lt;br /&gt;pay_vendor [color=red];&lt;br /&gt;&lt;br /&gt;In brief, you can explore your surroundings, interact with Sam&apos;s car, check his glove box, and interact with a ticket vendor. These are just unconnected ideas I have surrounding the parkade and is a natural enough place to start.&lt;br /&gt;&lt;br /&gt;Next, though,&amp;nbsp;I can start to connect them. For instance, you&apos;ll see Sam&apos;s car quite conspicuously as you explore the parkade, and in order to interact with it you&apos;ll need to learn to click objects:&lt;br /&gt;&lt;br /&gt;interact_samscar -&amp;gt; { learn_click_objects; explore_parkade };&lt;br /&gt;&lt;br /&gt;Later on, I introduce elements in order to fulfill a purpose: for instance I need the player to learn that in addition to clickable keywords, they can try stuff by typing. My idea then is after you insert change (found in the glovebox) into the vendor, it refuses your ticket. A window pops up suggesting you &amp;quot;kick&amp;quot; it, which you do by typing kick while you&apos;re interacting with it. At that point, it gives you a ticket (item_ticket):&lt;br /&gt;&lt;br /&gt;pay_vendor -&amp;gt; learn_insert_item;&lt;br /&gt; kick_vendor -&amp;gt; learn_type_keyword;&lt;br /&gt; learn_type_keyword -&amp;gt; pay_vendor;&lt;br /&gt;item_ticket -&amp;gt; { kick_vendor; pay_vendor }&lt;br /&gt;&lt;br /&gt;In short, to pay the vendor you have to learn to insert an item into it&amp;nbsp;(there is a drag-and-drop interface for this). To get your ticket, you have to kick it, which involves learning to type a keyword in. The arrow from learn_type_keyword to pay_vendor may seem mysterious, but all that it means is once you pay the vendor, I trigger the tutorial window explaining that you can &amp;quot;try sum&apos;m&amp;quot; by typing a keyword in. &lt;br /&gt;&lt;br /&gt;Finally, if you&apos;ve paid the vendor and you&apos;ve kicked it, you get your ticket.&lt;br /&gt;&lt;br /&gt;The final dependency graph looks like this:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://picasaweb.google.ca/lh/photo/-2Taz0HD2a3-5yun_O-Dyw?feat=embedwebsite&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://lh5.ggpht.com/_RXDsvn8nZo4/SX8mj2nSNPI/AAAAAAAABIc/yzKZPuMpItQ/s144/parking_garage_gameplay.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description>
  <comments>http://psysal.livejournal.com/62042.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/61766.html</guid>
  <pubDate>Tue, 13 Jan 2009 18:57:11 GMT</pubDate>
  <title>Can you hear the Wind in the Willows?</title>
  <link>http://psysal.livejournal.com/61766.html</link>
  <description>I&apos;ve implemented the sway algorithm, and visually it looks about right. I ended up encoding a sway force with the object&apos;s physical representation (each game object can be attached to a particle, with position, velocity, and now sway force information). The sway force dissipates over time, rather than being reset each frame (which would also work).&lt;br /&gt;&lt;br /&gt;However getting a matching sound effect to work is a bit more difficult! At first I had it set up so that when you walk into the bush, it triggers a sound effect (as long as one isn&apos;t already playing). This is ok, but the sound stops playing when you leave the bush even though it continues to sway. This is an event-oriented approach, basically; when you walk into the bush, play the bush rustling sound effect. One can imagine a moderately complex algorithm to let the sway sound effect play on repeat (fading out as it does so) after you leave the bush, but it feels complex and weird.&lt;br /&gt;&lt;br /&gt;The next idea I had, was to tie the sound effect to the renderable. This turns out to be right idea, sort of. The model I adopted for sound effects in Texas was the idea of &amp;quot;soundable&amp;quot;; an object has a renderable, something that is drawn to the screen, so why not also a soundable, something that is played into the sound engine?&lt;br /&gt;&lt;br /&gt;The secret is to create a new soundable type, called &amp;quot;sway&amp;quot;, which bases it&apos;s behaviour on the same data that the sway algorithm is based on. Imagine the sway algorithm as a pendulum that moves across an axis; every time it moves across the axis, we want to trigger the sound effect. If we use, in effect, the same algorithm (this time in just one dimension) and trigger the sound effect for each time the pendulum crosses the zero line, with the velocity relating to the amplitude of the sample, it should create a good effect; moreover, when we add wind (which will, essentially just apply a &amp;quot;windy&amp;quot; sway force vector to all objects) it should create a natural sound environment that is tied to the gameplay objects.&lt;br /&gt;&lt;br /&gt;Nice!&lt;br /&gt;&lt;br /&gt;Now let&apos;s see if it works...</description>
  <comments>http://psysal.livejournal.com/61766.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/61478.html</guid>
  <pubDate>Mon, 12 Jan 2009 17:56:03 GMT</pubDate>
  <title>Sway, continued</title>
  <link>http://psysal.livejournal.com/61478.html</link>
  <description>The sway algorithm I had in mind seems like it will work well, but I&apos;m faced with two problems:&lt;br /&gt;&lt;br /&gt;1. How to communicate the sway values to the animator.&lt;br /&gt;&lt;br /&gt;The sway occurs at a fairly low level, basically at the &amp;quot;rendering&amp;quot; stage. This is fairly opaque to the game engine itself, which just says &amp;quot;draw this&amp;quot;. The rendering engine takes as a parameter a particle, which is supposed to be the physical representation. &lt;br /&gt;&lt;br /&gt;I think the answer therefore might be to add a&amp;nbsp;sway acceleration parameter to the particle. This makes sense because it&apos;s part of the physical simulation, even though it won&apos;t actually affect the position of the object.&lt;br /&gt;&lt;br /&gt;2. How to introduce randomness into the animator.&lt;br /&gt;&lt;br /&gt;Each swayable object has a few parameters that can be easily set at the start, but right now everything sways &amp;quot;together&amp;quot;, since initial conditions are the same. What I think is that there is probably room for two sources of randomness.&lt;br /&gt;&lt;br /&gt; First in the &amp;quot;snapback&amp;quot; factor which for each swayable object roughly indicates how stiff or rigid it is. This would naturally vary and for instance, with a tree, the trunk or lower level branches would have much higher snapback factor since they are more rigid. &lt;br /&gt;&lt;br /&gt;The second place to randomize woulds be the input velocities themselves. If you walk through a bush, you maybe overall create a sway in the direction of your motion, but the shape of your body and the branches you are interacting with will be somewhat varied, so we can characterize this by just randomizing the sway variable slightly.</description>
  <comments>http://psysal.livejournal.com/61478.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://psysal.livejournal.com/61403.html</guid>
  <pubDate>Sat, 10 Jan 2009 20:39:38 GMT</pubDate>
  <title>Polishing, bushes, longscreen!</title>
  <link>http://psysal.livejournal.com/61403.html</link>
  <description>For Christmas I got a stand that lets me turn my widescreen monitor to a vertical orientation. I have just one thing to say, that is, longscreen is long. It&apos;s pretty weird but you better believe it&apos;s awesome for reading the internet. Never could adjust to coding/internetting on widescreen, but longscreen I think&amp;nbsp;I can get used to. &lt;br /&gt;&lt;br /&gt;Seriously, it&apos;s ridiculously long.&lt;br /&gt;&lt;br /&gt;How to polish a game? As you play you have to notice what&apos;s missing. For example, &amp;quot;there&apos;s no sound effect when I step on this&amp;quot;, &amp;quot;the bush seems... dead&amp;quot;, &amp;quot;I wish there were a bit of fauna around, birds and bunnies etc.&amp;quot;, and so on including of course bugs. If you tackle these things as you run across them, you&apos;ll never get anywhere though because by the time you fix one thing you&apos;ll have forgotten everything else. So you need a TO&amp;nbsp;DO&amp;nbsp;list system. I use &lt;a href=&quot;http://tadalist.com&quot;&gt;TADA List&lt;/a&gt; which is from a great internet company 37signals. It&apos;s just so darn simple.&lt;br /&gt;&lt;br /&gt;Then you just relentlessly tackle things on your TO&amp;nbsp;DO&amp;nbsp;list, without fearing to add to it. It will get gargantuan, because polishing a game is about fixing a million tiny things. But that&apos;s how it gets done, as far as I can see. Don&apos;t think, just fix!&lt;br /&gt;&lt;br /&gt;So yes, &amp;quot;bushes seem... dead&amp;quot;. I want to make so that when you walk into a bush, it shakes a bit. There are other related features that could go with this, like a tree could sway in the wind, etc., but I&apos;m not sure the best way to implement it yet.&lt;br /&gt;&lt;br /&gt;My current idea is to add a method to the object interface that takes a motion vector. This could be used for a lot of things. Most objects wouldn&apos;t pay attention, but for trees it could be used to create sway by a simple wind simulation, and for bushes could be used as the player walks through them.&lt;br /&gt;&lt;br /&gt;This approach seems a logical place to start, it seems a bit too &amp;quot;physics simulation-y&amp;quot; for my liking but it&apos;s not extremely complex. I guess the complexity is not so much in the interface but in the resulting animation/etc., which needn&apos;t be too bad.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description>
  <comments>http://psysal.livejournal.com/61403.html</comments>
  <lj:security>public</lj:security>
  <lj:reply-count>4</lj:reply-count>
</item>
</channel>
</rss>
