[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: firstname.lastname@example.org
- Subject: game scripts
- From: Pedro Medeiros <email@example.com>
- Date: Wed, 25 Apr 2001 15:58:11 -0300
- Delivered-To: mailing list firstname.lastname@example.org
- Delivery-Date: Wed, 25 Apr 2001 15:00:10 -0400
- Mailing-List: contact email@example.com; run by ezmlm
- Reply-To: firstname.lastname@example.org
- User-Agent: Mutt/1.2.4i
Hi, I have adapted LUA script language
( http://www.tecgraf.puc-rio.br/lua/ ) for a rpg project
I'm writing. I was thinking about an easy (yet poweful)
script engine, so I came up with this model:
a 'location' is a group of 'maps' a player can visit, like
a city and its houses and rooms, shops etc.
A 'map' is a table of characters describing the environment,
like a room in a house or a dungeon. A 'map' has defined
positions, so that it is easier to undestand the script.
For instance: City.House_X.door
A map can connect to another by structures I called 'links'.
That's useful when the player walks through a door, so he is
'transported' to the new map.
Then I thought that maybe instead of these links, I should
use events, then I can interrupt user input anywhere I want
and put a cut-scene, for instance. The gate between two
maps would be just a very common type of event.
Notice that the script engine runs in a different thread,
so the script can call actions to be executed concurrently
and wait for events when it needs to sync. Then when it
calls a function to move a character, it should wait until
a "stop" event is sent.
Here is an example where the player enters a city, and wander
until he triggers an expected event:
-- Lua Interpreted script for GAME v0.0
-- Lines begining with '--' are comments
-- This function is called when the player enters city_X.
-- NewLocation("ID Name", "filename")
-- This loads a new location, maps and some events
City = NewLocation("X City", "city_X.location");
-- Non-playable part of game:
-- method show() -> put map on screen
-- Character walks 5 positions from begining of the map
-- Notice: Knight is global
Knight.position = City.Street.origin;
-- Set an aditional event:
LeavingFunction = function()
Knight.say("I can't leave yet...");
-- NewEvent(event_type, args...)
LeavingEvent = NewEvent("sprite_over", Knight, City.Street.origin,
-- Playable part:
-- Allow the player to move the character until the expected event happens
while (GAME_EVENT != City.TriggerEvent)
I know it still needs improvement. But what do you think?
Any thoughts about it? Anyone wants to bash? :)
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org