Skip to main content
gamedev.net
🔒 Locked

Scripting???

Started by NotTaxes 2 replies 150+ views
Original Post
NotTaxes
NotTaxes
Hi, I''m in the process of creating a scripting language specifically for my game''s maps and map objects. The idea being that my map editors can add objects to a map and then write behavioural characteristics for each object (and for the map as a whole). This would allow them to, for example, open doors when levers are switched, effect objects on other maps (if you blow up the power plant on this map, the mag-loc doors are open on another), change the default behaviour of enemies and so on. The script language would be entirely event driven (OnGameTime, OnTouch, OnBring, etc.) with very simple commands allowing the editor to specify modifying other object''s properties and the player''s statistics. A very basic example would be something like this: [RocketPack] OnTouch Player.RocketAmmo +10 End But obviously, I wouldn''t use the script for simple item acquisition. The problem I am facing is that the only other time I''ve done something like this, I used simple text parsing to interpret the script functions. That was a database app, and so the execution speed was not important. But, using text parsing functions is just too slow for a game, and I have no idea how to go about pseudo-compiling the script stuff to make it faster. Does anyone have any ideas for me? The only thing I could think of was to give each operator, statement and event a unique ID and then convert the text script to numeric, which would be faster. But, this seems to still be a duct-tape method of solving the problem.
'Doing the impossible is kind of fun' - Walt Disney
Carrot
Carrot
Are you not compiling the text after the parse into some more game related structure (or is this the problem)?
Anytime I''ve used a scripting engine in a game I''ve compiled the source script into a Finite State Machine - should fir in with your event driven model.
NotTaxes
NotTaxes
Hi Carrot,

Sorry, I''m a bit new to this. Can you give me some more info about how to do that? I''m not looking for sample code or anything, just some high-level info (half the fun of stuff is figuring it out for yourself).
'Doing the impossible is kind of fun' - Walt Disney
Carrot
Carrot
Check out Kurt Miller''s tutorial on Flipcode
for a good tutorial

http://dynodonalies.com/tutorials/tutorialpage.htm

It depends on how advanced you want your scripting engine to be.

Sounds like you just want a simple scripter in which case you will probably just need the parser/lexical analysizer bit.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.