CreationTemplate & SettingsTemplate modification proposal

edited October 2019 in Projects - Tools

Here follows a proposal about modifying CreationTemplate.ini and SettingsTemplate.ini in order to make them more editor-friendly.

AINVAR Document syntax proposal
; [SectionName] - no modifications
;
; KeyName[FreeKeyName|PostFixedKeyName|Enum] = [[ValueType(limit):Default|None] | [[ValueType(limit):Default|None] & [ValueType(limit):Default|None]]:
;
; KeyName attributes:
;   FreeKeyName         = KeyName is a place holder for a list of free key names
;   PostFixedKeyName    = KeyName is a place holder for a list of free key names that will have KeyName as postfix
;   Enum                = Value of an existing enum known or defined in place. 
;                         Known enums are conveniently input keys (mouse/keyb/joy)
;                         Enums defined in place will follow *enum definition syntax*
;
; Value attributes:
; [[ValueType(limit|(min<max)):Default|None]
;
;   ValueType           = Int|UInt|Bool|Float|Vector|String 
;                           (min & max can be applied, if present. the interval can be open (min<) = min to infinite (<max) = -infinite to max)
;                         Enum
;                         Template:TemplateType
;                         List:Type:... ; In this case the (limit) value is used to express the max list size
;                         FilePath:DynamicLibrary|Storage|Config|Image|Sound
;                         DirectoryPath
;                         Command
;                         ShaderExtension
;
;   Default             = type default value, if appliable
;                         None that by default the key is not defined
;                         
;
; Since a key may have multiple value rapresentations, we can give a way to document such alternatives
; KeyName = [[typedef1] | [typedef1]] ; means we can have valuedef1 type or typedef2
; KeyName = [[typedef1] | [[typedef1] &# [typedef3]] ; means we can have valuedef1 type or typedef2 and typedef3 separated by #
;
;


; Enum definition syntax
; [Enum:name{value1|value2|value3|...}]
;
; In addition, to make the document more readable, I propose a special section used to declare enums and avoid in-place definitions
; [@EnumDefs@]
; EnumNameA = value1|value2|value3|...
; EnumNameB = value1|value2|value3|...

Comments

  • edited October 2019

    As briefly discussed on gitter, I really like the endeavor.

    Regarding the details though, I'm afraid I will likely not be able to check it out thoroughly before the end of the week, as it's a very busy week on my side. Sorry for the delay!

  • Hi @ainvar,

    I read the document a few times, however I'm not sure I grasp all the details.

    Would you have some examples of all the different types of entries proposed, maybe base on the content of the current template files?

    Thanks!

  • Of course.
    Here's a first modification of SettingsTemplate.ini contents

    [Main] ; !!! DEPRECATED - This section is only used by the default orx launcher, not for stand alone applications !!!
    GameFile = [FilePath:DynamicLibrary] ;path/to/GameFile; NB: This is only used with the default built-in main launcher;
    
    [iOS] ; !!! This section is only used on iOS (iPhone/iPod Touch/iPad) !!!
    AccelerometerFrequency = [Float:0]; NB: Frequency in Hz, if explicitly set to 0, the accelerometer will be disabled. Defaults to iOS' default value;
    
    [Android] ; !!! This section is only used on Android !!!
    AccelerometerFrequency = [Float:0]; NB: Frequency in Hz, if explicitly set to 0, the accelerometer will be disabled. Defaults to Android's default value;
    UseJoystick = [Bool:False]; NB: use joystick and gamepads, if enabled will disable Accelerometer.
    SurfaceScale = [Float:0]; Read-Only, scaling factor applied
    
    [Resource]
    Config = [List:FilePath:Storage] ;path/to/storage1 # ... # path/to/storageN; NB: Config group: orx will look for resources following the order defined by this list, from first to last;
    Sound = [List:FilePath:Storage] ;path/to/storage1 # ... # path/to/storageN; NB: Sound group: orx will look for resources following the order defined by this list, from first to last;
    Texture = [List:FilePath:Storage] ;path/to/storage1 # ... # path/to/storageN; NB: Texture group: orx will look for resources following the order defined by this list, from first to last;
    WatchList = [List:Enum:Groups] ;Texture # Config # Sound # ...; NB: If defined, orx will monitor these groups of resources and will reload them as soon as modified. Dev feature, only active on computers;
    
    [Config]
    DefaultParent = [Template:Config] ;DefaultParentName; NB: This section will be used as implicit parent for any other config section. By default there's not default parent section;
    
    [Console]
    ToggleKey = [Enum:KeyboardKey] ;KEY_*; NB: Defines the toggle key for activating the in-game console;
    ScrollSize = [UInt:3]; NB: Number of lines to scroll at a time, defaults to 3;
    Alias[FreeKeyName] = [Command]; NB: Any other key than ToggleKey will be added as a command alias; Commands are case sensitive;
    ;MyOtherAlias = [Command]; NB: Any other key than ToggleKey will be added as a command alias; Commands are case sensitive;
    

    Sorry I had to truncate it.

  • Here's the continuation:

    [Clock]
    MainClockFrequency = [Float:None]; NB: If no value is specified, the main clock will update as often as possible.
    
    [Plugin]
    DebugSuffix = [String:d] ;DebugSuffixString; NB: If none if given, orx will use "d" as default;
    
    [Display]
    ScreenWidth = [Int:None]; NB: For Android, limit the width of the display framebuffer
    ScreenHeight = [Int:None]; NB: For Android, limit the height of the display frame buffer (ignored if ScreenWidth is defined);
    ScreenDepth = [Int:32]; NB: Defaults to 32bits;
    ScreenPosition = [Vector:None]; NB: Defaults to OS positioning when not specified;
    RefreshRate = [Int:60]; NB: Defaults to 60Hz;
    FullScreen = [Bool:False];
    Decoration = [Bool:True]; NB: Only used when not in fullscreen, defaults to true;
    AllowResize = [Bool:False]; NB: Only works in windowed mode, defaults to false;
    Title = [String:None] ; TitleText;
    Smoothing = [Bool:False];
    VSync = [Bool:None];
    DepthBuffer = [Bool:False]; NB: Defaults to false, set it to true only if you plan on doing 3D rendering on your own;
    ShaderVersion = [Int:None]; NB: If defined, a matching shader version preprocessor directive will be added to the top of fragment shaders;
    ShaderExtensionList = [List:ShaderExtension] ;[+|-]Extension1 # ... # [+|-]ExtensionN; NB: If defined, shader extension directives will be added to the top of fragment shaders;
    Monitor = [Int:1]; NB: Index of monitor, defaults to 1 = primary monitor;
    Cursor = [Enum:Cursors{arrow|ibeam|crosshair|hand|hresize|vresize|default}] | [[FilePath:Image] & [Vector]] ; NB: Defaults to 'default'; If a texture is provided, an optional vector can be added as the hotspot;
    IconList = [FilePathList(16):Image] ;path/to/texture1 # ... # path/to/textureN ; NB: Up to 16 icons can be defined, the one with the best-fitting resolution will be used automatically;
    
    [Render]
    ShowFPS = [Bool:False]; NB: Displays current FPS in the top left corner of the screen;
    ShowProfiler = [Bool:False]; NB: Displays a layer containing gathered profiling info;
    MinFrequency = [Float:10]; NB: Minimum frequency allowed for render/core clock. Defaults to 10Hz. Can be deactivated with an explicit negative value;
    ProfilerOrientation = [Enum::Orientation{portrait|landscape}] ; NB: Defaults to landscape;
    ConsoleBackgroundColor = [Vector:None]; NB: If specified, will override console's background color;
    ConsoleBackgroundAlpha = [Float:None]; NB: If specified, will override console's background alpha;
    ConsoleSeparatorColor = [Vector:None]; NB: If specified, will override console's separator color;
    ConsoleSeparatorAlpha = [Float:None]; NB: If specified, will override console's separator alpha;
    ConsoleLogColor = [Vector:None]; NB: If specified, will override console's log color;
    ConsoleLogAlpha = [Float:None]; NB: If specified, will override console's log alpha;
    ConsoleInputColor = [Vector:None]; NB: If specified, will override console's input color;
    ConsoleInputAlpha = [Float:None]; NB: If specified, will override console's input alpha;
    ConsoleCompletionColor = [Vector:None]; NB: If specified, will override console's completion color;
    ConsoleCompletionAlpha = [Float:None]; NB: If specified, will override console's completion alpha;
    
    [Mouse]
    ShowCursor = [Bool:True]; NB: Defaults to true;
    
    [Input]
    SetList = [List:Template:InputSet] ;InputSetTemplate1 # InputSetTemplate2; NB: The first valid set in list will become the default one when loaded;
    DefaultThreshold = [Float(0.0<1.0):0.15]; NB: Defines a value [0.0, 1.0] under which all input values will be ignored. Defaults to 0.15;
    DefaultMultiplier = [Float(0.0<):1.0]; NB: Defines a value ]0.0, +inf[ by which all input values will be multiplied. Defaults to 1.0;
    
    [InputSetTemplate] ; NB: Up to 8 different bindings can exist in the same set for the same input
    KeyName[Enum:KeyboardKey] = [StringList@Group1]
    ;KEY_SPACE = Jump # Validate; NB: Binds space key to the "Jump" and Validate inputs;
    ;MOUSE_LEFT = Select; NB: Binds mouse's left button to the "Select" input;
    ;KEY_LCTRL = Select; NB: Binds left control to the "Select" input;
    ;JOY_A_1 = Attack; NB: Binds first joystick's A button to the "Attack" input;
    ;JOY_LX_2 = Move; NB: Binds second joystick's left X axis to the "Move" input;
    ;+JOY_LX_1 = MoveRight; NB: Binds first joystick's positive left X half-axis to the "MoveRight" input;
    ;-JOY_LX_1 = MoveLeft; NB: Binds first joystick's negative left X half-axis to the "MoveLeft" input;
    ;MOUSE_X = Move; NB: Binds mouse's X axis to the "Move" input;
    Threshold[PostFixedKeyName] = [Float]
    ;AttackThreshold = [Float]; NB: Defines a value [0.0, 1.0] under which values for the input "Attack" will be ignored. Takes precedence over DefaultThreshold, if defined;
    ;MoveMultiplier = [Float]; NB: Defines a value ]0.0, +inf[ by which values of for the input "Move" will be multiplied. Takes precedence over DefaultMultiplier, if defined;
    
    CombineList = [List:String@Group1] ; Select # Attack; NB: If an input is in this list, it will activate if and only if all its bindings are active. Otherwise, an input will activate if any of its binding is active;
    
    [Locale]
    LanguageList = [List:Template:LanguageTemplate] ; Language1 # Language2; NB: The first defined language will be used by default if valid;
    
    [LanguageTemplate]
    SentenceId[FreeKeyName] = [String]
    ;MyTextEntry = A string localized for this language.
    ;MyOtherTextEntry = Another string localized for this language.
    
    [Physics]
    Gravity = [Vector:(0, 0, 0)];
    AllowSleep = [Bool:True]; NB: Defaults to true;
    IterationsPerStep = [Int:None];
    DimensionRatio = [Float:None];
    StepFrequency = [Float:60]; NB: Frequency used for fixed-step world physics simulation; Defaults to 60Hz.
    ShowDebug = [Bool:False]; NB: Defaults to false; Only used in non-Release builds (ie. Debug and Profiler ones);
    CollisionFlagList = [List:String] ; # ...; NB: Optional: defines all the literals that can be used to define the SelfFlags and CheckMask properties of Body. This list will grow with every new flag encountered at runtime;
    
    [SoundSystem]
    DimensionRatio = [Float:1.0];
    StreamBufferNumber = [Int:4]; Number of buffers to use for sound streaming. Needs to be at least 2, defaults to 4;
    StreamBufferSize = [Int:4096]; Size of buffer to use for sound streaming. Needs to be a multiple of 4, defaults to 4096;
    
    [Screenshot]
    Directory = [DirectoryPath:"."] ;path/to/directory; NB: If not specified, screenshots will be stored in the Documents directory on iOS or in the current active directory otherwise;
    BaseName = [String:"screenshot-"] ;MyScreenshotBaseName; NB: Defaults to "screenshot-";
    Extension = [String] ;EXT; NB: Defaults to png on iOS and tga otherwise; Available extensions depend on the active plugin. GLFW -> .png, .tga & .bmp
    Digits = [Int:4]; NB: Number of digits for screenshot indexing. Defaults to 4;
    
    [Param] ; NB: All command line parameters can be defined in this section, using their long name
    plugin = [List:FilePath:DynamicLibrary] ;path/to/FirstPlugin # ... # path/to/LastPlugin;
    config = [List:FilePath:Config] ; path/to/FirstConfigFile # ... # path/to/LastConfigFile; NB: This files can override values set in the main config file;
    
  • Sorry for the huge delay. I went into shipping mode with my last project until February, then I have to admit it completely went out of my mind. I'll get back to it shortly, sorry again about that.

Sign In or Register to comment.