Commit graph

178 commits

Author SHA1 Message Date
Andrei Alexeyev
6a72d4a637
Add env variable TAISEI_SDL_LOG (enables SDL log at given priority) 2019-11-08 21:05:40 +02:00
Andrei Alexeyev
b88fc4ad2e
Support full-screen custom postprocessing
Works just like the viewport one, except the configuration goes in
shaders/global.pp instead. The player uniforms aren't available.
2019-08-09 21:42:04 +03:00
Andrei Alexeyev
5a23fb95fc
make upkeep script preserve existing copyrights 2019-08-03 20:44:22 +03:00
Andrei Alexeyev
3055901998
update my email 2019-07-03 21:00:56 +03:00
Andrei Alexeyev
c7ff531a63
fixup includes 2019-03-18 06:41:12 +02:00
Andrei Alexeyev
cc6514151a
Implement seeking in zip files without reading everything to memory
In particular, this greatly reduces memory usage for music tracks.
2019-03-16 22:11:37 +02:00
Andrei Alexeyev
75ee08535b
fix a few memory leaks 2019-03-09 23:58:42 +02:00
Andrei Alexeyev
180f9e3856
Emscripten compatibility (#161)
* Major refactoring of the main loop(s) and control flow (WIP)

run_at_fps() is gone 🦀

Instead of nested blocking event loops, there is now an eventloop API
that manages an explicit stack of scenes. This makes Taisei a lot more
portable to async environments where spinning a loop forever without
yielding control simply is not an option, and that is the entire point
of this change.

A prime example of such an environment is the Web (via emscripten).
Taisei was able to run there through a terrible hack: inserting
emscripten_sleep calls into the loop, which would yield to the browser.
This has several major drawbacks: first of all, every function that
could possibly call emscripten_sleep must be compiled into a special
kind of bytecode, which then has to be interpreted at runtime, *much*
slower than JITed WebAssembly. And that includes *everything* down the
call stack, too! For more information, see
https://emscripten.org/docs/porting/emterpreter.html

Even though that method worked well enough for experimenting, despite
suboptimal performance, there is another obvious drawback:
emscripten_sleep is implemented via setTimeout(), which can be very
imprecise and is generally not reliable for fluid animation. Browsers
actually have an API specifically for that use case:
window.requestAnimationFrame(), but Taisei's original blocking control
flow style is simply not compatible with it. Emscripten exposes this API
with its emscripten_set_main_loop(), which the eventloop backend now
uses on that platform.

Unfortunately, C is still C, with no fancy closures or coroutines.
With blocking calls into menu/scene loops gone, the control flow is
reimplemented via so-called (pun intended) "call chains". That is
basically an euphemism for callback hell. With manual memory management
and zero type-safety. Not that the menu system wasn't shitty enough
already. I'll just keep telling myself that this is all temporary and
will be replaced with scripts in v1.4.

* improve build system for emscripten + various fixes

* squish menu bugs

* improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS

Note that stock freetype does not work without
EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the
"emscripten" branch here:

    https://github.com/taisei-project/freetype2/tree/emscripten

* Enable -Wcast-function-type

Calling functions through incompatible pointers is nasal demons and
doesn't work in WASM.

* webgl: workaround a crash on some browsers

* emscripten improvements:

    * Persist state (config, progress, replays, ...) in local IndexDB
    * Simpler HTML shell (temporary)
    * Enable more optimizations

* fix build if validate_glsl=false

* emscripten: improve asset packaging, with local cache

Note that even though there are rules to build audio bundles, audio
does *not* work yet. It looks like SDL2_mixer can not work without
threads, which is a problem. Yet another reason to write an OpenAL
backend - emscripten supports that natively.

* emscripten: customize the html shell

* emscripten: force "show log" checkbox unchecked initially

* emscripten: remove quit shortcut from main menu (since there's no quit)

* emscripten: log area fixes

* emscripten/webgl: workaround for fullscreen viewport issue

* emscripten: implement frameskip

* emscripter: improve framerate limiter

* align List to at least 8 bytes (shut up warnings)

* fix non-emscripten builds

* improve fullscreen handling, mainly for emscripten

* Workaround to make audio work in chromium

emscripten-core/emscripten#6511

* emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 21:32:32 +02:00
Andrei Alexeyev
abe4ddf260
refactor audio (module system like that of renderer) 2019-03-05 21:43:01 +02:00
Andrei Alexeyev
c8e057e388
basic emscripten compat and various fixes 2019-02-22 01:56:48 +02:00
Andrei Alexeyev
8fc5abb78a
The Powersurge game mechanic and scoring system (#159) 2019-02-22 01:56:03 +02:00
Andrei Alexeyev
b91b85c42a
Logging: colors, non-fatal error level, alt. format for log file
Also removed traceback support entirely as it never produced useful
output.
2019-02-15 01:58:40 +02:00
Andrei Alexeyev
fa802dbd94
Some refactoring
* Added (and fixed) a few useful warnings
    * Removed some dead code
    * Cleaned up the build system files a bit
    * Once again separated ZIP support from data packaging
    * Converted macOS cross-compilation options into cross-file properties
2019-01-24 22:24:43 +02:00
Andrei Alexeyev
4159ea1249
'upkeep' target for maintenance tasks; back to include guards; happy new year! 2019-01-23 22:10:43 +02:00
Andrei Alexeyev
69079f245a
dubious timing optimizations; try to sleep between frames; skip at constant speed 2019-01-09 05:25:10 +02:00
Andrei Alexeyev
3937618c84
Kick SDL_image's ass out and replace JPEG with WebP 2018-10-19 00:16:06 +03:00
Andrei Alexeyev
ed2fd0f969
fix -t segfault 2018-07-25 07:46:04 +03:00
Andrei Alexeyev
322edd0dce
Text rendering rewrite and optimizations; some refactoring (#129)
* wip font rendering stuff; hashtable monstrosity is temporary

* various text rendering fixes/improvements

* HashTables™ 3.0

* Add some comments to aid navigating the hashtable macro maze

* overhaul text rendering API; add default and example shaders

* text: implement text_render for spellcard effect; misc fixes

* README: update dependencies

Bye SDL_ttf, hello freetype2.

* text_draw: fix resolution/scale-dependent bugs

* make text_draw fallback to the current shader, fix hud and stagetext

* repair the bgm loading

* fix spell practice mode

* fix walloftext

forgot one site of text_draw earlier

* fix wrapped text rendering

* fix and simplify the hud text shader

* dynamic glyph cache

* implement font size change on window resize/quality setting change/etc.

* rename text shaders for consistency

* preloads for fonts and text shaders

* make the stagetext shader look somewhat better

* text_render: attempt to normalize height

* small improvement for stagetext
2018-06-30 00:36:51 +03:00
Andrei Alexeyev
9356f263fd
integrate fonts into the resource system (preparing for text rendering rewrite) 2018-06-08 07:49:40 +03:00
Andrei Alexeyev
09946ebff9
Threading improvements (#125)
* Add a general purpose multi-threaded task manager (worker pool) for background tasks

Reimplemented screenshots off-loading using the new task manager.

* Largerly rewrite resource loading internals

They use the new task manager API now and should be generally more
robust.

* Made the game playable without threads again

* wait for resource async load task instead of intermediate state change

* remove dead code

* taskmgr: if creating a worker thread fails, try to make sure the others terminate
2018-05-25 09:01:07 +03:00
Andrei Alexeyev
2932247249
attempt to refactor the util disaster into several smaller disasters 2018-05-15 03:27:25 +03:00
Andrei Alexeyev
2996d40d30
remove duplicate logging of libpng version 2018-04-18 18:27:57 +03:00
Andrei Alexeyev
aefc398883
remove outdated/broken tests 2018-04-18 18:23:24 +03:00
Andrei Alexeyev
58252950d4
add replay verification mode: taisei --verify-replay file.tsr 2018-04-18 02:48:28 +03:00
Andrei Alexeyev
af7c4bbb4f
add portable wrappers around getenv/setenv and friends 2018-04-18 01:34:41 +03:00
Andrei Alexeyev
59cf8f6300
Rendering system rewrite, tons of refactoring, optimizations, and other cool stuff (#116) 2018-04-12 17:08:48 +03:00
Andrei Alexeyev
a9561d7baf
Sprites and texture atlases; upgrade most graphics to a higher resolution (optimized for 1600x1200) (#113) 2018-02-06 08:19:25 +02:00
Andrei Alexeyev
5987e6a29a
whooooooooooooooops 2018-01-09 02:43:23 +02:00
Andrei Alexeyev
5790dfb685
fix credits layout; support non-looping BGMs 2018-01-09 01:32:52 +02:00
Andrei Alexeyev
0667c80a69
fix some fucking stupid replay bugs 2018-01-08 23:23:07 +02:00
Andrei Alexeyev
80e2328e18
single stage mode: act like a practice mode; ability to save replays 2018-01-06 23:18:11 +02:00
Andrei Alexeyev
485c9a8ed6
Happy New Year! 2018-01-04 19:14:31 +02:00
Andrei Alexeyev
ddc15eafc7
format stage ids more consistently 2017-12-31 10:08:07 +02:00
Andrei Alexeyev
29acd5f58a meson: intel intrinsics, various improvements 2017-12-21 03:58:54 +01:00
Andrei Alexeyev
3e8982d0ad
fix build for SDL <= 2.0.5 2017-11-24 01:42:23 +02:00
Andrei Alexeyev
db8dd8ad7c
desperate optimizations
i even used a profiler
2017-11-23 18:23:30 +02:00
Andrei Alexeyev
3413bd92e7
many vfs improvements
* There's no distinction between "temp" and "perm" nodes anymore.
    All nodes are allocated with 1 reference belonging to the
    vfs_alloc() caller.

    * VFSNode pointers retrieved by any API that returns one (most
    notably vfs_locate) are guaranteed to have exactly one reference
    belonging to the caller. What this means is that you must always
    decref them when you're done using them.

    If you're implementing such an API (e.g. a custom locate), remember
    to incref any persistent nodes you return.

    * Passing a VFSNode* to anything that successfully consumes one (for
    example, vfs_mount) transfers ownership of the reference to the
    consumer. In other words, consumers do not incref your nodes, but
    they will decref them once they don't need them anymore. If you want
    to keep the node around, then you must incref it first.

    * Bunch of other stuff.

"Ownership" is an abstract concept in this context. Basically it just
means "cleanup responsibility".
2017-11-10 21:49:54 +02:00
Andrei Alexeyev
1a455930c1
new replay format version
- support for continues
    - support for 32 arbitrary bitflags per stage + 32 global ones
        - 3 globals and 3 stageflags are currently used, see replay.h
    - limited player name length to 255 bytes

other minor changes:
    - continues now register with 1 frame of latency in order for them
    to work properly with replays
    - continuing now resets Power to 0. you can still pick up the huge
    bunch of power items that spawns when you continue; they are exactly
    enough to get to Full Power.
2017-10-30 00:45:24 +02:00
Andrei Alexeyev
bd910c3444
update credits, fix stuff 2017-10-23 13:48:30 +03:00
Andrei Alexeyev
1992a62592 desperate attempt at refactoring plrmodes 2017-10-10 08:23:36 +03:00
Andrei Alexeyev
05478cd543
another desperate attempt at an accurate fps limiter 2017-10-04 08:07:04 +03:00
Andrei Alexeyev
ef67a16867
WIP event system rewrite. text input missing 2017-10-01 00:43:18 +03:00
Andrei "Akari" Alexeyev
261ab0d7af
reorganize directory structure, fix minor vfs bugs 2017-09-27 14:16:16 +03:00
Andrei "Akari" Alexeyev
c199ce6fa6
use desktop mode fullscreen by default
also fixed the userevent in resources to use the correct id
2017-09-18 14:19:50 +03:00
Andrei "Akari" Alexeyev
8a0e98e0b6
get version info from git via cmake
also improved the osx bundle Info.plist a little bit
2017-09-16 18:55:55 +03:00
Andrei "Akari" Alexeyev
7c9e54a71d
update copyright and credits 2017-09-12 04:28:15 +03:00
Andrei "Akari" Alexeyev
d7bc2df02f
vfs: improve setup routine, move it into a separate file 2017-05-10 20:46:37 +03:00
Andrei "Akari" Alexeyev
250c4c0821 Merge branch 'master' into vfs 2017-05-05 19:37:33 +03:00
Andrei "Akari" Alexeyev
15822de2f8 prioritize other video drivers over x11 if possible 2017-05-05 04:36:27 +03:00
Andrei "Akari" Alexeyev
1ac5e45ebd Merge branch 'master' into vfs 2017-04-30 14:11:00 +03:00