cxong / cdogs-sdl

Classic overhead run-and-gun game
https://cxong.github.io/cdogs-sdl/
GNU General Public License v2.0
895 stars 114 forks source link

Console #338

Open cxong opened 9 years ago

cxong commented 9 years ago

Now that config has been refactored and can be set using dot-separated notation, we can build an in-game debug console that can print and set variables. Could be useful for testing.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

ghost commented 9 years ago

Do you plan to make it a whole command language, like TCL or what Xonotic has?

cxong commented 9 years ago

No plans; since this is only about setting config values it's not too interesting. Maybe once more functions are exposed, like spawning characters. Then it might be useful to include a scripting language such as Tcl or Lua.

ghost commented 9 years ago

config.h mentions groups, so I thought one would be able to alias a setting of a number of config values.

Like

alias debug {
set screen.resolution = default
set keys.shoot = default
...
}

And then simply apply those by

set debug

or something like that; in order to fake profiles.

cxong commented 9 years ago

The groups aren't really related to that; it's a simple hierarchical grouping of configs which makes a few things more convenient. That is, you might have Game.FriendlyFire (yes/no) and Game.SightRange (integer) configs; here Game would be the group. An example of a convenient thing would be "make a menu out of everything in Game".

What you mention can be done as functions in a scripting language, which will set a bunch of config values. That would be an advantage with scripting languages - you can implement profiles simply using the language.