Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Discussion of States and Interactions in Game Engines [long]

This thread is locked; no one can reply to it. rss feed Print
Discussion of States and Interactions in Game Engines [long]
Kanzure
Member #3,669
July 2003
avatar

Hey, yeah, I am back for a little while. What has happened around these parts anyway? Does anybody remember me? Anyway, I do not specifically point out many important questions in this post, but I'm guessing that those of you who have something to say will post your thoughts on these same subjects.

Guys, this has been on the top of the stack for years now. There is no specific occasion for this topic, here are some thoughts looking to be discussed. The issue at hand is that of text adventures and interactive fiction relative to game engine design and more specifically the internal game-world states that are used. Feeble structures with a few integers does not seem suitable or appropriate.

It is easy to see that there can be a metaphor for the output of the game engine. There is most commonly visual and audio output. Text adventures are merely just a different form of representation concerning the changing states of the environment. Now, there is a particularly confusing problem that I have noticed. Many people chose to hardcode or script objects/modules for their games. There is nothing wrong with these modules and they work well. However, suppose that you were coming up with an automatic content generating text adventure where you do not necessarily know which actions the player is going to be performing on your objects and modules.

You hit a problem. You can not possibly include thousands of objects and thousands of actions and allow for each of the actions to effect each of the objects. There is clearly not enough time to write that much script. So what could one possibly do? Scripting a reaction to every possible action is tedious.

One solution that I have considered involves setting up some 'characteristics' for each of the objects or modules. Every table, chair, tree, donut, knife, backpack, bicycle, and so on would have a set of characteristics. Every action would then look at these characteristics before making some sort of a change specific to the action being executed at the moment. The real trick is figuring out what sort of characteristics are required.

I was considering the option of making all actions basically amount to a combination of either
1) degrading an object
2) improving or supporting an object
3) ignoring an object
or 4) using the special function of the object

However, that sort of scheme is severely limited and would ignore a significant amount of possible scenarios in the ideal imaginable text adventure. Assume that our scientists build a theory of everything that is able to effectively predict outcomes in the natural world. This theory would likely not be easy to use to predict the results of a tissue box being thrown at a window or a bear diving into a pool of water. There is a level of abstraction that has to be present while still preserving the coherency of reality that we all know and love.

Thinking it through even further there is easily envisionable a warehouse of modules for inclusion in a text adventure not too unlike the Debian and Gentoo package databases. Authors would write specific modules that would be essentially be scripted programs. The problem with this is that there are many different possible stories that require/use different social perspectives on the way that things work and interact and behave with each other. So how can the different perspectives on object-object interaction and action in matter be accounted for in such a large warehouse?

Instead of the scientific ultimate theory of everything (which we will never know if we get to the absolutely best correct theory), what we need is a way of quickly switching between different predictive theories of various objects. These 'theories of objects' would be simple things that are not based on more fundamental theories-- for example, there could be a Anglo Saxon theory of cats that would describe the module in terms of an object that has to eat, sleep, run around every now and then and utterly piss of any Anglo Saxon that even looks like a programmer. Yet, still, a mechanism for allowing the development of said theories/modules has not been discussed.

The only solution that I can see is that of building a language-grammar that could serve as a guide for a computer to generate possible theories/modules/objects and possible views. By following the grammatical rules the computer would be able to construct valid sentences that may or may not make a great deal of sense in reality. The important thing is then to start the computer off with some basic sentence (Anglo-Saxon theory of cats module -> "Cats are small creatures.") that could then be expanded by the grammatical rules ("Cats are small ugly creatures" and "Cats are small beautiful creatures" would be two possible expansions that would come up given proper command of English sentence structure). Actions would be more like modifiers to the (already parsed and known) grammatical structures. They would make the generator of grammatical structures (that starts with a given sentence structure) do some weird tricks like revert a few stages to another point or do something completely different. Applying something like the action "kick" to the "cat (a small ugly creature)" may lead the engine to come up with "the kicked cat" or "the small, ugly cat was kicked" depending on the sort of representation that has to be used to maintain prose consistency.

Yes, I know that many commercial game engines do not bother to go this far and stick with some sort of pre-1900s psychological understanding of 'things' as represented by visual graphics, but I'm not trying to reinvent the history book here, people. 'erm, this was supposed to be a mention to the historical influences on modern game development, but this isn't specifically fully-fledged yet.

Anyway, thank you for reading, thoughts and comments appreciated as usual.

kentl
Member #2,905
November 2002

I've read it all. I don't have much in terms of comments and no thoughts as I didn't really get what you're trying to describe. Could you describe your idea in a less abstract and rambling way? :) A short and concise description would be great.

Kanzure
Member #3,669
July 2003
avatar

Kent,

Yes. Let's see. The idea that I was presenting near the end of my message could be summarized as something like this. Do you know of our pathfinder algorithms? Great! The terrain is grammar, the path is the actual strings that are used to come up with some specific item out of the set of all possible grammatical creations. This is a metaphor for what we can do with building in-game modules.

Hope this helps. Thanks for the clarity-check. :)

kentl
Member #2,905
November 2002

If you have a grammar, why do you need to use a path finding algorithm? I'm afraid that I don't understand the specifics of your idea yet. Perhaps someone else will come along and make sense of it. :)

Indeterminatus
Member #737
November 2000
avatar

Hmmm, are you talking about mirroring the world (with its complexity) in a game? Albeit it is certainly interesting to discuss how to do that technically, I don't see it having an impact on the game industry. I might have missed your point, so I won't elaborate (it would be quite pointless then, wouldn't it?)

_______________________________
Indeterminatus. [Atomic Butcher]
si tacuisses, philosophus mansisses

CGamesPlay
Member #2,559
July 2002
avatar

(By the way your original post was very rambling and read as though it were unfocused)

Indeterminatus: I think the main thing to focus on in his post is this hidden remark:

Quote:

However, suppose that you were coming up with an automatic content generating text adventure where you do not necessarily know which actions the player is going to be performing on your objects and modules.

Additionally, see Wyrm (Mark Fabi).

Kanzure: I've experimented with the idea of automatic content generation in games before, though the idea of using a grammar to conceptualize the process had never occurred to me. Here's what I've been able to work out.

As long as you keep the idea of a grammar solely as a metaphor and don't tie too much into natural language principles, I see this working out nicely. Temporarily following the natural language metaphor:

A noun is a fundamental object in the universe which is represented using a finite state machine with each state describing the present situation of the object. From my personal experience with this sort of thing, do not attempt to reduce the number of states by combining them. Keep each as a separate entity.

A verb phrase is a transition between two states in a noun. There is no such thing as a "verb" in my model, only verb phrases (the object must be associated with the verb), however verb phrases do not include adverbs.

Obviously, some verb phrases will not be applicable to some nouns. At this point in design, apply verb phrases individually to nouns, duplicating verb phrases for each state machine. They will be combined later.

An adjective modifies the state machine of an object by adding states to an object. This does not directly add new transitions, it only creates new states which will be able to be transitioned between by verbs which are now applicable to the noun.

One can think of a noun as any other noun after adjectives have been applied. Obviously, an adjective with a negation removes states from a noun.

An adverb modifies a verb phrase. It may add new applicable transitions or modify known transitions in a verb.

To implement this system, I suggest mapping each noun's states and grouping them. I recommend not using a hierarchy for this, but instead forming categories into which you place nouns which share states. A noun need not exist in only one category. Once this has been done, the categories inherit the common states that the nouns possess, and in this fashion categories become "meta-adjectives" which are applied to nouns, and nouns are simply the deviations from the aggregate of their categories.

Once this state sharing has been completed, application of verbs becomes easier. Each verb may apply to any quantity of categories, individual nouns, and nouns with a specific adjective. For example, verb A is applicable to any noun in categories B and C, the noun D, and and noun which has adjective E applied to it.

Adverbs modify both the transitions which the verb represents, as well as the list of nouns to which the verb can be applied.

Technically, I recommend a loosely-typed scripting language using lambda calculus. Something where functions can be modified by functions to generate new functions. It should be obvious that states of nouns are functions, and verbs are functions applied to nouns to create transitions between the state functions. Adverbs are functions applied to verb functions, and adjectives are functions applied to nouns to both generate new state functions and modify existing ones. I am not aware of any such language.

It should become apparent that a system with this much abstraction requires a massive amount of computational power in order to run. I believe it will be necessary to compile the state machines to a more optimized state in order to run them.

[edit]
Spelling, grammar.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Kanzure
Member #3,669
July 2003
avatar

kanzure said:

Hey Ryan, I just read your reply to my ramble. It looks like your proposed systems matches what I was thinking about pretty well. Though you caught one of the hidden lines in my message, there was another one, namely that of the idea of permuting through the possible grammatical structures that can be used with the various objects that you outlined in your post. Would it not be possible to script a generator that could walk through possible versions of your outlined objects for such a game? Yes, it is understandable that much of the output may look like nonsense if not given some restrictions, but perhaps those could be defined by the author / packager of the game.

kanzure said:

Writing out thousands of different objects to include in a game is tiresome and, if a player was to play long enough, would be able to catch up with the designers and run out of fresh content. Ideally, objects could be created and destroyed, they could be 'generated'.

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

that of the idea of permuting through the possible grammatical structures that can be used with the various objects that you outlined in your post

No, I understand that idea as well. One can make arbitrary combinations of adjectives, adverbs, verb phrases, and nouns. The lambda functions are responsible for automating the process of interaction between the pieces.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Go to: