• Godot HelpProgramming
  • Passing parameters? Like any games have passing parameters like GameName -w 1200 -h 660 -console

Hello everyone, I would like to know how do I pass parameter / argument like any games have passing arguments like example

GodotGame <- It is Main Game binary -w 1200 = width of Main Game has 1200 pixel -h 660 = height of Main game has 660 pixel -windowed = Main Game should be normal window like without fullscreen -console = Enable GUI Console window in Main game ( Console shows in Main Game. ) Result: GodotGame -w 1200 -h 660 -windowed -console example for Half-Life hl.exe -width 1024 -height 768 -sw -console

Does Godot Engine have passing argument like you have write in terminal example MyGame -w 1000 -h 600 than it will be sketch and fullscreen for example.

Is it possible for Godot Engine? If yes than I will have to develop more.

Is it correct or wrong

func _init(arr): for i in arr: match [arr[i]]: "-w": get_viewport_rect().size.height = arr[i] .....

Is it correct or wrong? I am sorry for my bad English...

I think it's possible, though I have no personal experience working with command line arguments, nor how to go about using them in Godot.

A did some quick google searches, and it seems some people have figured out how to parse commands/arguments from the command line. Here's someone's Robust Command Line Argument Parsing In Godot - Github Gist that appears to be able to take arguments from the command line. It looks kind of complicated, but maybe it will help?

Also, here is a Reddit question asking something similar. Apparently OS.get_cmdline_args() gets the arguments from the command prompt and puts them into a list/array that you can parse and use as you see fit.

Hopefully one of those two links above help :smile:

Wow @TwistedTwigleg Nice you have one, but I have tried to search but Google can't find for me. I find only "Godot Script: Passing arguments" And Result always other ways. I can't understand why Google targets for me always wrong. I didn't make criminally. I think Google jokes me.

Wow nice idea I will try that. Thanks for help!

Note that Godot comes with a lot of built-in command-line arguments, including several options to specify the window geometry. The editor offers a few more debugging-related arguments too.

Editor options:

Godot Engine v3.1.alpha.custom_build.970b581 - https://godotengine.org
(c) 2007-2018 Juan Linietsky, Ariel Manzur.
(c) 2014-2018 Godot Engine contributors.

Usage: godot [options] [path to scene or 'project.godot' file]

General options:
  -h, --help                       Display this help message.
  --version                        Display the version string.
  -v, --verbose                    Use verbose stdout mode.
  --quiet                          Quiet mode, silences stdout messages. Errors are still displayed.

Run options:
  -e, --editor                     Start the editor instead of running the scene.
  -p, --project-manager            Start the project manager, even if a project is auto-detected.
  -q, --quit                       Quit after the first iteration.
  -l, --language <locale>          Use a specific locale (<locale> being a two-letter code).
  --path <directory>               Path to a project (<directory> must contain a 'project.godot' file).
  -u, --upwards                    Scan folders upwards for project.godot file.
  --main-pack <file>               Path to a pack (.pck) file to load.
  --render-thread <mode>           Render thread mode ('unsafe', 'safe', 'separate').
  --remote-fs <address>            Remote filesystem (<host/IP>[:<port>] address).
  --remote-fs-password <password>  Password for remote filesystem.
  --audio-driver <driver>          Audio driver ('PulseAudio', 'ALSA', 'Dummy').
  --video-driver <driver>          Video driver ('GLES3', 'GLES2').

Display options:
  -f, --fullscreen                 Request fullscreen mode.
  -m, --maximized                  Request a maximized window.
  -w, --windowed                   Request windowed mode.
  -t, --always-on-top              Request an always-on-top window.
  --resolution <W>x<H>             Request window resolution.
  --position <X>,<Y>               Request window position.
  --low-dpi                        Force low-DPI mode (macOS and Windows only).
  --no-window                      Disable window creation (Windows only). Useful together with --script.

Debug options:
  -d, --debug                      Debug (local stdout debugger).
  -b, --breakpoints                Breakpoint list as source::line comma-separated pairs, no spaces (use %20 instead).
  --profiling                      Enable profiling in the script debugger.
  --remote-debug <address>         Remote debug (<host/IP>:<port> address).
  --debug-collisions               Show collisions shapes when running the scene.
  --debug-navigation               Show navigation polygons when running the scene.
  --frame-delay <ms>               Simulate high CPU load (delay each frame by <ms> milliseconds).
  --time-scale <scale>             Force time scale (higher values are faster, 1.0 is normal speed).
  --disable-render-loop            Disable render loop so rendering only occurs when called explicitly from script.
  --disable-crash-handler          Disable crash handler when supported by the platform code.
  --fixed-fps <fps>                Force a fixed number of frames per second. This setting disables real-time synchronization.
  --print-fps                      Print the frames per second to the stdout.

Standalone tools:
  -s, --script <script>            Run a script.
  --check-only                     Only parse for errors and quit (use with --script).
  --export <target>                Export the project using the given export target. Export only main pack if path ends with .pck or .zip.
  --export-debug <target>          Like --export, but use debug template.
  --doctool <path>                 Dump the engine API reference to the given <path> in XML format, merging if existing files are found.
  --no-docbase                     Disallow dumping the base types (used with --doctool).
  --build-solutions                Build the scripting solutions (e.g. for C# projects).
  --gdnative-generate-json-api     Generate JSON dump of the Godot API for GDNative bindings.
  --test <test>                    Run a unit test ('string', 'math', 'physics', 'physics_2d', 'render', 'oa_hash_map', 'gui', 'io', 'shaderlang', 'gd_tokenizer', 'gd_parser', 'gd_compiler', 'gd_bytecode', 'image', 'ordered_hash_map', 'astar').

Export template options:

Godot Engine v3.1.alpha.custom_build.f0405d4 - https://godotengine.org
(c) 2007-2018 Juan Linietsky, Ariel Manzur.
(c) 2014-2018 Godot Engine contributors.

Usage: godot-runner [options] [path to scene or 'project.godot' file]

General options:
  -h, --help                       Display this help message.
  --version                        Display the version string.
  -v, --verbose                    Use verbose stdout mode.
  --quiet                          Quiet mode, silences stdout messages. Errors are still displayed.

Run options:
  -q, --quit                       Quit after the first iteration.
  -l, --language <locale>          Use a specific locale (<locale> being a two-letter code).
  --path <directory>               Path to a project (<directory> must contain a 'project.godot' file).
  -u, --upwards                    Scan folders upwards for project.godot file.
  --main-pack <file>               Path to a pack (.pck) file to load.
  --render-thread <mode>           Render thread mode ('unsafe', 'safe', 'separate').
  --remote-fs <address>            Remote filesystem (<host/IP>[:<port>] address).
  --remote-fs-password <password>  Password for remote filesystem.
  --audio-driver <driver>          Audio driver ('PulseAudio', 'ALSA', 'Dummy').
  --video-driver <driver>          Video driver ('GLES3', 'GLES2').

Display options:
  -f, --fullscreen                 Request fullscreen mode.
  -m, --maximized                  Request a maximized window.
  -w, --windowed                   Request windowed mode.
  -t, --always-on-top              Request an always-on-top window.
  --resolution <W>x<H>             Request window resolution.
  --position <X>,<Y>               Request window position.
  --low-dpi                        Force low-DPI mode (macOS and Windows only).
  --no-window                      Disable window creation (Windows only). Useful together with --script.

Debug options:
  -d, --debug                      Debug (local stdout debugger).
  -b, --breakpoints                Breakpoint list as source::line comma-separated pairs, no spaces (use %20 instead).
  --profiling                      Enable profiling in the script debugger.
  --remote-debug <address>         Remote debug (<host/IP>:<port> address).
  --frame-delay <ms>               Simulate high CPU load (delay each frame by <ms> milliseconds).
  --time-scale <scale>             Force time scale (higher values are faster, 1.0 is normal speed).
  --disable-render-loop            Disable render loop so rendering only occurs when called explicitly from script.
  --disable-crash-handler          Disable crash handler when supported by the platform code.
  --fixed-fps <fps>                Force a fixed number of frames per second. This setting disables real-time synchronization.
  --print-fps                      Print the frames per second to the stdout.

Standalone tools:
  -s, --script <script>            Run a script.
  --check-only                     Only parse for errors and quit (use with --script).
23 days later

Wow my god too much arguments like Unity 3D :open_mouth:

Thanks for answer - I am sorry for late. Because i am very busy...

4 years later