Commit graph

32 commits

Author SHA1 Message Date
Pedro J. Estébanez abdfbef075 Add project setting for agile input event flushing
If enabled, key/touch/joystick events will be flushed just before every idle and physics frame.

Enabling this can greatly improve the responsiveness to input, specially in devices that need to run multiple physics frames per each idle frame, because of not being powerful enough to run at the target frame rate.

This will only work for platforms using input buffering (regardless event accumulation). Currenly, only Android does so, but could be implemented for iOS in an upcoming PR.
2021-08-13 11:45:50 +02:00
Rémi Verschelde aa2215e681
Main: Fixup bogus fallback to project manager with more bolognese
WARNING: Hacks everywhere!

The logic in `main.cpp` is due a full rewrite as it's extremely hacky,
splitting argument parsing over several functions, with a mess of global state
and assumptions about what combinations of arguments or lack thereof should
mean in terms of what we want to read: game, editor, project manager, or
command line tools such as `--doctool`, `--export` or `--script`.

Until this is fully rewritten, this patch hacks things some more to ensure
that we don't fall back to the project manager in cases where it's not
warranted, and especially not *too late*, as it can mean that we haven't
properly initialized stuff like `EditorPaths` needed by the PM (which in turn
impacts what kind of path will be used for logs and the shader cache, etc...
the rabbit hole goes deep).

Fixes #41435.
Fixes #49392.
Fixes #49658.
Fixes https://github.com/godotengine/godot/issues/38202#issuecomment-773158477.
2021-06-16 19:11:08 +02:00
Pedro J. Estébanez 23907e6f19 Make glue generation shutdown more graceful 2021-02-22 11:06:33 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Andrii Doroshenko (Xrayez) 6f426c3360 Port ClassDB tests to use doctest
Extracted the most minimal core initialization functionality from
`setup()` and `setup2()` so that `ClassDB` could be tested properly
(input, audio, rendering, physics etc, are excluded).

Display and rendering servers/singletons are not initialized at all.

Due to the fact that most subsystems are disabled, fixed various crashes in the
process (in order):
- `AcceptDialog` OK/cancel swap behavior (used `DisplayServer` while
  `register_scene_types()`);
- `make_default_theme` which depends on `RenderingServer`;
- `XRServer` singleton access while calling `register_modules_types()`;
- hidden bug in a way joypads are cleaned up (MacOS and Linux only).

Removed manual `ClassDB` init/cleanup calls from `test_validate_testing.h`.

ClassDB tests:

Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
2020-08-16 16:41:02 +03:00
RevoluPowered 579342810f t Add unit testing to Godot using DocTest and added to GitHub Actions CI
Implements exit codes into the engine so tests can return their statuses.
Ideally we don't do this, and we use FIXUP logic to 'begin' and 'end' the engine execution for tests specifically.

Since realistically we're initialising the engine here we don't want to do that, since String should not require an engine startup to test a single header.

This lowers the complexity of running the unit tests and even for
physics should be possible to implement such a fix.
2020-07-24 13:05:33 +01:00
Fabio Alessandrelli 1b6e3458b2 Move frame delaying functions from Main to OS.
Will allow specific platforms to override it and avoid blocking on the
main/GUI thread.
2020-06-30 19:39:09 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
IAmActuallyCthulhu 82b9557803
Remove redundant author doc comments 2019-08-12 04:26:38 -05:00
Juan Linietsky 8ff00ca52d Make recursive nature of iteration not fail. 2019-01-24 13:09:05 -03:00
Juan Linietsky 0c9fd3c4b4 Avoid cyclic iteration check, fixes #24969 2019-01-22 13:17:39 -03:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde eb4af940dd Main: Group static members and add some docs 2018-09-20 14:38:40 +02:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Juan Linietsky 5bb412f389
Revert "Make the performance reporting update frequency customizable" 2018-05-28 08:47:09 -03:00
Hugo Locurcio 228ae60a63
Make the performance reporting update frequency customizable
The default update frequency has been changed from 1000ms to 250ms.
2018-05-18 11:49:21 +02:00
Manuel Moos d5abd4eb75 Add hysteresis to physics timestep count per frame
Add new class _TimerSync to manage timestep calculations.
The new class handles the decisions about simulation progression
previously handled by main::iteration(). It is fed the current timer
ticks and determines how many physics updates are to be run and what
the delta argument to the _process() functions should be.

The new class tries to keep the number of physics updates per frame as
constant as possible from frame to frame. Ideally, it would be N steps
every render frame, but even with perfectly regular rendering, the
general case is that N or N+1 steps are required per frame, for some
fixed N. The best guess for N is stored in typical_physics_steps.

When determining the number of steps to take, no restrictions are
imposed between the choice of typical_physics_steps and
typical_physics_steps+1 steps. Should more or less steps than that be
required, the accumulated remaining time (as before, stored in
time_accum) needs to surpass its boundaries by some minimal threshold.
Once surpassed, typical_physics_steps is updated to allow the new step
count for future updates.

Care is taken that the modified calculation of the number of physics
steps is not observable from game code that only checks the delta
parameters to the _process and _physics_process functions; in addition
to modifying the number of steps, the _process argument is modified as
well to stay in expected bounds. Extra care is taken that the accumulated
steps still sum up to roughly the real elapsed time, up to a maximum
tolerated difference.

To allow the hysteresis code to work correctly on higher refresh
monitors, the number of typical physics steps is not only recorded and
kept consistent for single render frames, but for groups of them.
Currently, up to 12 frames are grouped that way.

The engine parameter physics_jitter_fix controls both the maximum
tolerated difference between wall clock time and summed up _process
arguments and the threshold for changing typical_physics_steps. It is
given in units of the real physics frame slice 1/physics_fps. Set
physics_jitter_fix to 0 to disable the effects of the new code here.
It starts to be effective against the random physics jitter at around
0.02 to 0.05. at values greater than 1 it starts having ill effects on
the engine's ability to react sensibly to dropped frames and framerate
changes.
2018-04-09 22:27:29 +02:00
Pieter-Jan Briers 1099838079 Makes project manager never initialize mono debug.
The heuristic whether we're in the project manager inside GDMono
didn't work if the project manager was launched by not having any path
to run.

This is fixed now by making a Main::is_project_manager().
2018-02-16 16:15:35 +01:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Rémi Verschelde a91d12ab94 Merge pull request #10531 from RandomShaper/remove-old-android-setting
Sanitize Android debug
2017-08-29 00:09:27 +02:00
Rémi Verschelde bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Pedro J. Estébanez 2a5ee5dec9 Fix Android remote debug not hitting breakpoints
A change in `Main`'s API is needed. Please read the comment in the diff for an explanation.
2017-08-22 17:24:20 +02:00
Rémi Verschelde df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
Rémi Verschelde 5dbf1809c6 A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
2017-03-05 16:44:50 +01:00
Rémi Verschelde c7bc44d5ad Welcome in 2017, dear changelog reader!
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer
with state-of-the-art rendering techniques tuned to work as low as middle
end handheld devices - without compromising with the possibilities given
for higher end desktop games of course. Great times ahead for the Godot
community and the gamers that will play our games!
2017-01-01 22:03:33 +01:00
George Marques 5be9ff7b67 Update copyright to 2016 in headers 2016-01-01 11:50:53 -02:00
Juan Linietsky fdaa2920eb Updated copyright year in all headers 2015-04-18 14:38:54 -03:00
marynate c0547f5691 Add possibility to limit frame to main loop (application/target_fps)
target-fps working, and use fixed physics step before adding physics-fps in project setting

Complete implementation of framelimit

Conflicts:
	main/main.cpp
2014-03-18 18:00:18 +08:00
Juan Linietsky 0b806ee0fc GODOT IS OPEN SOURCE 2014-02-09 22:10:30 -03:00