Scripting decisions

3 views
Skip to first unread message

Barry Gian James

unread,
Nov 11, 2011, 11:20:36 PM11/11/11
to govsanc...@googlegroups.com
Regarding the game's scripting engine, we have to make a few essential and deeply effecting decisions regarding the interface for some (or all) imported functions. Some functionality are by default rendered as functions:
  • functions that manipulate the script's command line arguments
    • this_player(), this_room(), this_item()
  • communication functionality
    • tell(ch.id,"hello there")
Some are by default rendered through globally imported objects:
  • QuestMgr.AddQuest(id,"A Trifle","a_trifle")
  • cmd = Commands.GetCommand("look")
  • TimedEventQueue.AddEvent(e)
While others could be configured as either way:
  • new_item = create_item("a_new_item") -or- new_item = root.create_item("a_new_item")
  • the_target = get_npc(id) -or- the_target = root.get_npc(id)
Which way seems best/most intuitive/most efficient?


Object Handles by Construction or Factory

The next question is whether an object reference should be created through a class constructor syntax or through a factory function. Take the following two examples:

ch = Character(id)
-or-
ch = get_character(id) -or- ch = root.get_character(id)

Which method here seems best?

Post your thoughts, ideas, comments, or suggestions if you have any on these subjects.

Cheers!
-gian
Reply all
Reply to author
Forward
0 new messages