开发者

Game event scripting engine - different approaches?

开发者 https://www.devze.com 2023-01-04 13:56 出处:网络
I\'m looking for different approaches to an \"event scripting\" engine for use in a game.I\'m talking about capability along the lines of Z-machine (Infocom) or Maniac Mansion\'s SCUMM or engines used

I'm looking for different approaches to an "event scripting" engine for use in a game. I'm talking about capability along the lines of Z-machine (Infocom) or Maniac Mansion's SCUMM or engines used in something like a MUD/MUSH or more modern examples let's say NWN. I'm not familiar with what's behind the scenes of these, but the end result is what I'm looking for. Implementation language for the engine is C/C++

I'm looking at the 2 issues of creating content, and then having that content be interpreted in my engine.

Content creation will be done by expert level engineer-type so I don't THINK there's any rea开发者_运维问答son for including a secondary "scripting" language, the real reason for that would be if I wanted a less technical person to be able to write content correct?

I've got some ideas but I'd rather not guide answers, I want to evaluate several design choices to make sure I pick the best one


A few ideas:

  • Scripting is for rapid prototyping as well as novice users. Even your expert engineers will want to use scripting from time to time.

  • For event processing you can can use a scripting language with objects and bind a set of objects to each event. When an event happens your engine calls the "it happened" method on each object.

  • For event processing you can can use a scripting language with first-class functions and bind a set of functions to each event. When an event happens your engine calls each function with the event.

Most modern scripting languages support both objects and functions, although not all equally well.

For this kind of problem, no language is smaller, simpler, more performant, has a better memory footprint, or is easier to integrate with C than Lua, which was designed to solve exactly this kind of problem. For more information see the book Programming in Lua; the previous edition is free online.

0

精彩评论

暂无评论...
验证码 换一张
取 消