Coder Social home page Coder Social logo

trogdor's People

Contributors

crankycyclops avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

trogdor's Issues

Add signal and destroyTimer()

Add a static int timerActive to determine whether or not the clock is running. destroyTimer() will then set this to 0, and the while loop will exit and the threaded timer() function will return, killing the timer thread.

This should be called by destroyGame().

Embedded scripting language (Step 2)

Second iteration involves adding support for parsing mention of scripts in XML. I think that this should be handled by specifying a <script file=""> tag inside of a basic game structure (room, object or creature.) Then, in the game, whenever an event happens on that object, we check the script file to see if there's a function that matches a certain naming convention, and if so, we call it during the execution of that event. Not sure how all of this is going to be handled yet (and this will probably depend on the scripting language used.)

We don't need a C API yet. This will be taken care of in step 3.

Support for Triggers

Need to be able to add support for triggers. Not sure how this will work, yet. First iteration will NOT include any kind of scripting support, only support for pre-defined types of triggers that take arguments.

Object synonyms should not be allowed to match object names

Right now, object names are unique, but one object's synonym could be another object's name. This leads to a possible unresolved ambiguity, where two objects, one with a name and no synonyms and another with a synonym matching the other object's name, both exist in the same place. The easiest way to resolve this is to ensure that a synonym cannot equal the name of any unique object name.

Add support for Creatures

Add support for creatures, which are attached to a room. Creatures won't do anything in the first iteration, only be there and be described to the user.

Add objects (noun step 1)

Add neutral game objects (examples: rope, candle, etc.) -- nouns, which can be placed in a room. We don't have to add support picking up yet.

destroyData() produces segfault

There's a bug in the data destruction routine in data.c. Find and fix it. It seems to have something to do with the destruction of the objectByName hash table inside a room (backtrace lead me to destroyRoom().)

Process filler words like 'the', 'a', etc...

Filler words like articles (such as the and a), of, etc. should be filtered out so that the user can feel more natural by typing them without actually changing what we detect to be direct and indirect objects.

Objects only instantiated if they belong to a room

Right now, the flow of the logic is such that objects only get instantiated if they belong to a room. Now that we're adding support for scripting and such, we should change this. Being in a room is no longer required. All objects should be instantiated, regardless of whether or not they are initialized to be in any particular place.

Player state variables to override untakeable/undroppable settings

Related to #44: we should store some kind of list mechanism in a player's state to grant the player the ability to take "untakable" objects and to drop "undroppable" objects. The same should go in reverse, so we should be able to prevent a user from dropping an object that they could usually drop and from taking one that they could ordinarily take.

Not sure how I'm going to implement this yet. We'll see.

Listing of inventory should include weight information

Should display object weights in terms of percentage (i.e. inventory is 80% filled, object 1 takes up 10% of inventory, object 2 takes up 55% of inventory, etc.) Use floats (we don't need the precision of double, and we're only going to display up to one decimal place.)

Creature respawn

When a creature is killed, the game developer should be able to decide whether or not it will respawn.

Add support for synonyms

Add extensible support for synonyms. Don't know yet how to handle synonyms for verbs vs. prepositions, nouns, etc. Thinking that it should JUST be synonyms for verbs, nothing else. I think noun synonyms will be defined in the game file itself.

Create object classes

Some examples are "text (book, scroll, etc.)", "key," etc. Each class will probably have certain properties set by default (for example text, by default, will have a readable block of text for the player to see when they issue a "read" command.) Objects should then, in addition to names and synonyms, be identifiable by class.

The hierarchy for recognizing objects by class name should be as follows:

First, recognize objects with name/synonym. If these are found, ignore class. If no objects are found by name/synonym, then see if there's an object of the specified class, and if so, you can interact with it. This will be an enhancement to the static function getObject(), most likely.

Pre-defined object classes might have special tags that can go in the section of game.xml. For example, if it's a text, instead of:

[object name="book"]
...
[/object]

It would be something like:

[text name="book"]
...
[/text]

The text block would automatically imply certain attributes that would otherwise have to be explicitly stated in a generic block.

In the future, I may want to create a mechanism to allow the game developer to specify extra custom classes (probably want to put in another ticket for that! :)

Long and short descriptions

There should be two new fields in the room structure:
. shortDescription: what to print by default when the user has already seen the room
. seen: an integer that's set to 0 when initialized and to 1 when the user visits the room

This will effect the struct definition, XML parser and displayRoom().

We should add a new command (look, look around, show, etc.) that will make the game display the long description when the user wishes to read it again.

Specify whether or not an object can be taken

Extra attributes should be specifiable (by default, generic object class makes objects takeable by player and creatures) that allow the game developer to say that certain objects can't be taken by the player and also that they can't be taken by creatures (this behavior can always be overridden by a script.)

Allow creatures to move

Add support for mobile creatures (whether or not mobile is a game file configurable option), so that on each tick of the game (a tick will probably be defined as each time the user types a command, or at least certain kinds of commands), the creature will randomly move around.

At some point, I might want to have some sort of AI to game (particularly if the creature is an enemy, so we can have him chase the user), but not yet :)

Add room title

We need another field in the room structure, a title. This will affect the struct definition, XML parser and displayRoom().

Make timer ints longs

For max portability, change jobID and gameTime to explicit longs instead of just ints.

Allow transfer of ownership (creature step 3)

Allow the user to give an object to a creature. Game developer should be able to define whether or not creatures accept objects. Game developer should also be able to decide what objects can be given to creatures and what objects cannot.

Also, allow the creature to give objects to the user during certain kinds of interactions.

Custom action messages

We need support for custom messages for actions. So, when player does "take rock," we can either do default "You have taken the rock" if no message is specified or print out what the developer said in game.xml instead.

Make verbs a hash table

Right now, we're iterating through an array of verbs, when instead we should be using a hash table. It will be faster. GGG!

Make creatures friends or enemies (creature step 4)

Allow creatures to be defined as friends or enemies. If a creature is an enemy, the user can attack it. If the creature is a friend, the user cannot attack it. No object drops should occur during this phase.

Event handling

An event handling mechanism needs to exist. Events should be triggered, for example, whenever we enter or leave a room, when pickup, drop or look at an object, etc. This will be useful mostly for when we start implementing scripting.

Custom verbs via scripting

Should support custom verbs via scripts. Not sure how this will work yet, but somehow, we'll register the verb along with a pointer to a function that will execute a scripted function (all verbs go in some game script file?) with a name like verbVerbname. Also, we'll probably want to pull verbs array out of getVerbs function and make it a global in vocabulary.c.

Embedded scripting language (Step 1)

Iteration 1 of embedded scripting support: include should JUST be including investigating a language (current propositions are Python and Lua) and then integrating that library with Trogdor. We don't yet need to be able to setup actual scripts via XML or create a C API for the scripting language to call. These will come in steps 2 and 3.

Adding a timer and events that execute on each tick

Might want to add a timer thread that runs in the background and executes certain events every x seconds (ticks of the timer.) Timer could be used to control creature movement, what happens to certain objects (objects, rooms, creatures, etc. could maybe register events with the timer?)

This could be a very interesting feature to implement. Will have to think about how I might do this...

destroyGame() should not call exit()

Right now, core is functioning as a library that an application (like standalone) wraps around. Since this is the case, core should not call exit() unless there's an unrecoverable error (like memory allocation failure), which means that destroyGame() should not call exit(). Should alter the main game loop in standalone/main.c so that it says something like:

while (inGame()) {
...
}

And then implement inGame() so that it returns TRUE if the game is running and FALSE if the game has ended. Then, initGame() will set the variable this function returns to TRUE and destroyGame(), when we're done tearing down, will set this value to FALSE.

DO EET!

Add global hash table with all objects

All objects should be hashed in a global hash table so that we can easily find them (will be particularly important when we add support for an embedded scripting language.)

Support for inline scripting in game.xml

Right now, we define scripts like this:

[script]filename.lua[/script]

But, what if we want to define script inline without referring to a file? Syntax should be like this instead:

[script src="filename.lua"][/script]

OR

[script]Code goes here[/script]

Having both types in the same tag should trigger an error. Doing this will require us to change the way we initialize Lua state variable. Should have a way to differentiate during parse between filename and inline script so that we'll know what to do in parse.c when we're ready to initialize the Lua state variable.

Allow enemy creatures to move around

Allow enemy creatures to move around in pursuit of players. Could implement a shortest path algorithm to determine which direction to take from current room, then allow it to choose that direction with some percentage determined by how "smart" the creatures is defined to be.

Creatures might also be able to pickup objects (especially objects like weapons, shields, etc.)

Not sure if I would want a creature to move each time the player enters a command or if I would want there to be a thread running in the background that moves the creature every x seconds. Having timed events in the game might make it more interesting (in fact, will put in another ticket for this!)

"nevermind or 'never mind'" on clarification cancels operation

If we, for example, type "take rock," and there are two objects identified by rock, we'll ask which object was meant. It will continue asking until you provide it with a suitable answer. Now, if the user types "nevermind" or "never mind", the clarification operation and whatever called it should be canceled, so that the user won't have to follow through if he decides not to.

Embedded scripting language (Step 3)

Step 3 involves writing a C-to-scripting language API that will allow scripts to actually change the state of the game. This should complete basic scripting support!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.