Commit graph

57 commits

Author SHA1 Message Date
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
dcf6425a04
move SystemTime stuff into a more appropriate place 2019-05-01 07:03:22 +03:00
Andrei Alexeyev
330e259022
store score at the end of each stage in replays 2019-04-12 00:42:47 +03: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
fc41ebf89c
Replace RNG with xoshiro256+; update replay format
Support for writing older replay versions has been removed.
2019-03-09 18:19:42 +02:00
Andrei Alexeyev
8fc5abb78a
The Powersurge game mechanic and scoring system (#159) 2019-02-22 01:56:03 +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
5a83aa177e
Improve filename timestamps (screenshots, replays)
* Get rid of timezone information.
    * If possible, add milliseconds precision. This is useful when
    taking several screenshots in quick succession.
2018-05-28 12:03:14 +03:00
Andrei Alexeyev
513d613387
Consistent indentation: indent with tabs, align with spaces (#104)
I would've preferred to just go with 4-spaces for indent and no tabs,
but lao is a bit conservative about it. :^)

Still, this is a ton better than mixing different styles all over the
place, especially within the same file.
2018-01-12 20:26:07 +02:00
Andrei Alexeyev
6b5e52d4db
make graze counter persist between stages [replay version bump] 2018-01-09 03:28:04 +02:00
Andrei Alexeyev
485c9a8ed6
Happy New Year! 2018-01-04 19:14:31 +02:00
Andrei Alexeyev
29acd5f58a meson: intel intrinsics, various improvements 2017-12-21 03:58:54 +01:00
Andrei Alexeyev
db8dd8ad7c
desperate optimizations
i even used a profiler
2017-11-23 18:23:30 +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
makise-homura
2b35177cb4 Removed excess and added missing newlines at end of files 2017-10-10 21:10:35 +03:00
laochailan
03a2426012
update to use #pragma once 2017-09-27 14:14:53 +02:00
Andrei "Akari" Alexeyev
790aa3cc0b
fix comment 2017-09-27 12:19:17 +03:00
Andrei "Akari" Alexeyev
03cec65981
update replay struct version and fallback game version 2017-09-27 11:08:27 +03:00
Andrei "Akari" Alexeyev
76205422b3
include game version info in replays
the game can still read old v1.1 replays, and currently writes in that
version by default, too. it should be defaulted to the new format when
the first gameplay change from v1.1 is made.
2017-09-26 23:09:00 +03:00
Andrei "Akari" Alexeyev
d2ed6b8571
less replay debug spam 2017-09-26 02:59:33 +03:00
Andrei "Akari" Alexeyev
d9611b0831
player input, gamepad, and replay improvements
may break existing replays
2017-09-20 00:32:58 +03:00
Andrei "Akari" Alexeyev
7c9e54a71d
update copyright and credits 2017-09-12 04:28:15 +03:00
Andrei "Akari" Alexeyev
471f30083e WIP virtual filesystem 2017-04-20 05:02:22 +03:00
Andrei "Akari" Alexeyev
77c6790051 fix replays 2017-04-04 12:10:54 +03:00
Andrei "Akari" Alexeyev
263c112e8a Basic support for life/bomb fragments. Not yet used by the game. 2017-03-21 12:10:38 +02:00
Andrei "Akari" Alexeyev
d8ac035f29 Record fps stats in replays. Display the player's name and fps when watching 2017-03-21 04:28:35 +02:00
Andrei "Akari" Alexeyev
0c320a0a8e updated the replay struct version (removed the fire field) 2017-03-06 17:18:54 +02:00
Andrei "Akari" Alexeyev
591b5258fc Improved player input handling. Smooth focus transitions at all times.
Note that the focus change may desync some old replays (particularly,
the MarisaA ones)
2017-03-06 16:24:57 +02:00
Andrei "Akari" Alexeyev
db0cfa43bc "straightforward" my ass 2017-02-22 22:52:25 +02:00
Andrei "Akari" Alexeyev
30db5c8fd6 Support for viewing replays specified on the command line
$ taisei replay /path/to/replay.tsr
$ curl http://example.com/replay.tsr | taisei replay /dev/stdin
2017-02-21 22:31:46 +02:00
Andrei "Akari" Alexeyev
1e6011433c Initial support for single-spell stages
Adapted all of the current spellcards into spellstages, which will
later be used in a spell practice mode a-la IN.
For now they are only accessible through the stage select menu or
by specifying their ID on the command line; both available only
if you built with -DTAISEI_DEBUG=1
2017-02-19 03:28:00 +01:00
Andrei "Akari" Alexeyev
0be20dab0d Improved replay consistency 2017-02-15 19:34:47 +02:00
Andrei "Akari" Alexeyev
9a7a874783 Use the standard bool type instead of that stupid enum
Also removed all of the annoying trailing tabs/whitespaces
2017-02-11 05:56:47 +02:00
Andrei "Akari" Alexeyev
0bbf1a619e Further refinements to replay API and structures
Compatibility preserved.

The replay API functions are now completely independent of the global state.
2017-02-10 01:24:19 +02:00
Andrei "Akari" Alexeyev
4246ed2cfa Fixed/finished the prev. commit and refactored the replay menu to use it 2017-02-09 08:01:38 +02:00
Andrei "Akari" Alexeyev
31ac12f6e7 Improved replay structure and API
All events are now stored at the end of the file, after the metadata of all stages.
It's now possible to load a replay partially to examine the metadata, and optionally load the input events later if needed.
This is not used yet. The replay menu code will be updated to make use of this feature soon.
2017-02-09 06:06:46 +02:00
Andrei "Akari" Alexeyev
b0da5a407c Added a simple checksum for stage metadata to fail quickly if garbage is detected 2017-02-09 02:55:01 +02:00
Andrei "Akari" Alexeyev
f2386657f5 Updated replay structure, added checks to load routine to make sure that corrupted or garbage data in the replay won't crash the game 2017-02-09 02:13:06 +02:00
Andrei "Akari" Alexeyev
d0377bd537 Eliminated floating point values from replays for portability
Player power is now internally an integer. There is no good reason to use floating point math there. Stored as an uint16 in replays.
Player coordinates are now floored when a stage starts. This is unnoticable to the player. Stored as a pair of uint16s in replays.
2017-02-08 21:59:43 +02:00
Andrei "Akari" Alexeyev
cb2cf24233 basic replay desync detection 2017-02-05 04:58:27 +02:00
Andrei "Akari" Alexeyev
3662daaff0 Fixed playback of gamepad events from replays (with hacks) 2017-02-05 04:04:31 +02:00
Andrei "Akari" Alexeyev
ff3986c6cb New binary replay format 2017-02-05 03:25:17 +02:00
Andrew "Akari" Alexeyew
63108d58f5 Adjustable sensitivity in free axis mode 2012-08-15 18:03:53 +03:00
Andrew "Akari" Alexeyew
4754e6c76e Optional free axis mode 2012-08-15 17:36:39 +03:00
Andrew "Akari" Alexeyew
f2cf436ffa Hopefully fixed the replay desync disaster. I'm going to have nightmares about it. Needs more testing. 2012-08-07 03:45:38 +03:00
Andrew "Akari" Alexeyew
78c8c970fc save fire/focus stats in the replay 2012-08-07 08:01:57 +03:00
Andrew "Akari" Alexeyew
7776443935 multistage replays 2012-08-07 06:28:41 +03:00
Andrew "Akari" Alexeyew
a322371b5f Introduced playername option, fancied up the replayview menu, etc 2012-07-29 23:39:52 +03:00
Andrew "Akari" Alexeyew
d1f4aa03e3 s/lastframeplayed/playpos/ 2012-07-29 16:54:49 +03:00