Game Development Reference
In-Depth Information
Figure 11-2. The command system diagram
The command system is designed as an RPC-like (remote procedure call) architecture, where commands are
actually functions that are called with arguments and return one or more values. The call itself can be made directly
using the editor core C++ API or the UI editor application connecting sockets to an editor core server, transmitting the
command call data and then receiving the returned values.
A command executes only non-GUI-related code so it will not deal with the GUI functions itself, only engine
calls and game data. The GUI code will take care of visual representation for the user, and it will call the available
commands.
The plug-ins will expose their set of commands, but they will have nothing to do with the GUI itself. You can
create a separate plug-in system for the editor's GUI. This is where the true decoupling kicks in, the editor core
plug-ins being just “buckets” of non-GUI-related commands with the editor GUI using those commands. There is
no need for a 1:1 match between the UI functions and the commands. You only need to expose the basic/simple
commands, which should be generic enough to be used by multiple UI tools in various situations.
Command Parameters
When calling the commands, you have the option to send parameters to them, and for this you need to define the
parameter type, direction, and description. This information is read from the plug-in's manifest file, but it's optional
since the calling of commands is accomplished through a parameter set that is aware of the data types at the moment
of setting the values. In Listing 11-9, you declare the IParameter interface.
 
Search WWH ::




Custom Search