Skip to content

Commit

Permalink
Finish v6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hsandt committed Aug 30, 2021
2 parents 6e1ff84 + d0b71bd commit c4302ed
Show file tree
Hide file tree
Showing 57 changed files with 2,692 additions and 1,060 deletions.
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [6.1] - 2021-08-30
### Added
- Start cinematic: when pressing Start in title menu, before loading stage intro, play a full cinematic showing emeralds scattering on the island and Sonic jumping there to hunt them. Can be skipped by pressing either O or X. Ends with fade out either way.
- Stage visual: added tiles for leaves oriented left and right for transition between first wooden wall and forest background (background leaves), and in various places a horizontal transition between full leaves tiles and void (foreground leaves)

### Changed
- Credits: added "komehara" as developer alias, rearranged lines to fit
- Title menu: player can also press X (instead of just O) to immediately show menu

## [6.0] - 2021-08-17
### Added
- Character physics: spin dash (includes crouching)
Expand All @@ -20,17 +29,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Application: upgraded to PICO-8 0.2.2c with full binary patching and upgraded custom web template to integrate latest improvements
- UI: press O on title menu before menu appears to make it appear immediately
- Credits: add mention of SAGE and itch.io URL
- Camera: use small vertical window even on ground to avoid moving when character just moves by 1px up and down (due to new bumps)
- Stage physics: fixed last descending slope tile connecting slope and loop having no collision
- Stage physics/visual: reworked rock sprites to be smaller
- Stage physics/visual: offset last emerald (orange) by 5px to the right
- Stage physics/visual: replaced very low slopes with 1px bumps that are still considered flat ground to avoid slowing down character when running on them, while keeping the funny up-and-down motion
- Camera: use small vertical window even on ground to avoid moving when character just moves by 1px up and down (due to new bumps)
- Stage visual: hide emerald behind leaves to make harder to find
- Stage visual: improved forest hole lightshaft in background (now sprite instead of procedurally generated)
- Stage visual: fixed one-way platform grass appearing in front of character
- Stage visual: fixed background parallax to only move when camera moves by an integer pixel, not pixel fractions
- Character physics: fixed detecting flat ground when running down slopes where some columns of the collision mask are empty
- Character physics & Optimization: big overhaul with switch to "big steps" method instead of the expensive "pixel step" method. This applies to both grounded and airborne motion. First move by the full motion you'd expect on a single frame, ignoring obstacles. Then detect wall, ground and ceiling, if meaningful considering the current speed (with an extra final wall check if grounded). This effectively reduced complexity from O(speed) to O(1) and allows the game to run at 60 FPS consistently (with only a few 30 FPS drops when reloading memory e.g. to change region)
- Character physics & Optimization: big overhaul with switch to "big steps" method instead of the expensive "pixel step" method. This applies to both grounded and airborne motion. First move by the full motion you'd expect on a single frame, ignoring obstacles. Then detect wall, ground and ceiling (depending on motion direction), and escape from those colliders if inside, as in the original games (we also have an extra final wall check if grounded and changed quadrant to avoid getting stuck). This effectively reduced complexity from O(speed) to O(1) and allows the game to run at 60 FPS consistently (with only a few 30 FPS drops when reloading memory e.g. to change region). This also fixed the various bugs where character would get stuck in curves and loops when moving at high speed.
- Optimization: optimized the sprite rotation method to use efficient code specific for 90-degree rotations, instead of general trigonometry with backward approach (particularly slow due to iterating on all pixels inside the bounding box containing a given disc).
- Compressed characters: various refactoring and replacement of every constant with hardcoded strings/values (as pre-build step) to reduce compressed characters size and allow exporting cartridge again despite adding new features
- Debug: fix and improve debug rays (development only)
Expand Down Expand Up @@ -276,7 +285,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Game: in-game: debug character flies X/Y on directional input, go back to title menu on reach goal
- Test: all busted unit tests in separator folder tests

[Unreleased]: https://github.com/hsandt/sonic-pico8/compare/v6.0...HEAD
[Unreleased]: https://github.com/hsandt/sonic-pico8/compare/v6.1...HEAD
[6.1]: https://github.com/hsandt/sonic-pico8/compare/v6.0...v6.1
[6.0]: https://github.com/hsandt/sonic-pico8/compare/v5.3...v6.0
[5.3]: https://github.com/hsandt/sonic-pico8/compare/v5.2...v5.3
[5.2]: https://github.com/hsandt/sonic-pico8/compare/v5.1...v5.2
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Works with PICO-8 0.2.2.

## Features

Version: 5.3
Version: 6.0

### Physics

Expand All @@ -44,19 +44,21 @@ Version: 5.3
* Character preserves momentum on jumping and landing
* One-way platforms
* Spring bounce (vertical and horizontal)
* Spin dash

### Rendering

* Character sprites: *idle*, *walk* cycle, *run* cycle, *spin* cycle, *brake* animation, spring *jump*
* Foreground plane: grass and leaves, loop entrance
* Midground plane: general collision tiles, loop exit, some decorations
* Background planes: sky, ocean, trees and forest holes moving with parallax
* Background planes: waterfalls, sky, ocean, trees and forest holes moving with parallax
* Camera window and smoothing system
* Custom camera forward extension system to show more elements ahead of Sonic when he runs fast or faces a direction for some time

### UI

* Title logo, animated background and menu
* Wait in front of title menu to start the attract mode
* Zone splash screen on stage start
* Ingame HUD: list of picked emeralds shown in top-left corner
* Result screen on stage clear
Expand All @@ -72,16 +74,14 @@ Version: 5.3
### Notable features missing

* Timer
* Crouching and looking up
* Spin dash
* When you collect all emeralds...
* Looking up

### Notable physics differences

* Preservation of velocity when landing on slopes is more organic and uses vector projection, while the [SPG](https://info.sonicretro.org/SPG:Slope_Physics#Reacquisition_Of_The_Ground) denotes different formulas based on the slope angle and the relationship between horizontal and vertical speed. This is very perceptible when jumping on the first two slopes.
* It is possible to control horizontal acceleration after jumping out of a roll. This was considered to be a better user experience, and actually recommended by the Sonic Physics Guide despite being unlike the original games.
* Late jump: as in modern platforms, the character can jump up to 6 frames after falling off ground, for more permissive jumps from a platform ledge. This can be disabled in the Pause menu for a more "classic" experience.
* Pixel step-by-step approach: currently, character motion is computed pixel by pixel. This is very precise and avoids relying on ground escape, but is also very CPU expensive (the main reason behind FPS dropping to 30) and can get the character stuck if one calculation is wrong. It will probably be replaced with bigger steps and ground escape in the future.
* Collision check: character wall sensor is placed higher than in the original games, esp. when rolling, to allow hitting ground as a wall and stopping mid-loop when moving at high speed (e.g. after spin dash). In addition a second wall check is done after the initial wall and ground check if quadrant changed, as a way to verify if there is still a wall blocking in the new quadrant (and avoid being stuck when moving at high speed in loops, again).

### Notable camera differences

Expand Down Expand Up @@ -114,15 +114,17 @@ Stage gimmicks:

You can play with keyboard or gamepad with those inputs:

| Keyboard | Gamepad | Action |
|-------------------|------------------------|-------------------|
| Left/right arrows | D-pad left/right | Move |
| Down arrow | D-pad down | Roll (during run) |
| Z/C/N | Face button up/down | Jump |
| X/V/M | Face button left/right | Cancel (menu) |
| Enter | Start | Open pause menu |
| Keyboard | Gamepad | Action |
|--------------------------|------------------------|---------------------------------|
| Left/right arrows | D-pad left/right | Move |
| Down arrow | D-pad down | Crouch, Roll (during run) |
| Z/C/N | Face button up/down | Jump, Spin Dash (during Crouch) |
| X/V/M | Face button left/right | Cancel (menu) |
| Enter | Start | Open pause menu |
| Alt+Enter | | Toggle fullscreen |
| Ctrl+R (standalone only) | | Restart current cartridge |

If you gamepad mapping is not correct, you can customize it with [SDL2 Gamepad Tool](https://www.generalarcade.com/gamepadtool) and copy-paste the configuration line into sdl_controllers.txt in PICO-8's [configuration directory](https://pico-8.fandom.com/wiki/Configuration). For instance, the Logicool Gamepad F310 had Open PICO-8 menu mapped to Right Trigger, so I remapped it to Start instead.
If you gamepad mapping is not correct when playing with the native PC binaries, you can customize it with [SDL2 Gamepad Tool](https://www.generalarcade.com/gamepadtool) and copy-paste the configuration line into sdl_controllers.txt in PICO-8's [configuration directory](https://pico-8.fandom.com/wiki/Configuration). For instance, the Logicool Gamepad F310 had Open PICO-8 menu mapped to Right Trigger, so I remapped it to Start instead.

### Pause menu

Expand All @@ -136,7 +138,6 @@ In the pause menu (toggled with Enter/Start), if you are in-game, you can select
## Known technical issues

* The player cannot control the character until the stage intro is over
* The game slows down in some areas, reaching 30 FPS instead of 60 FPS
* The game pauses to switch to another cartridge, esp. at the end of the stage intro (only memory reload has been patched on PICO-8 to be instant)
* Web version: high-pitched sounds in BGM do not convey the same as in desktop/cartridge versions

Expand Down
4 changes: 4 additions & 0 deletions build_single_cartridge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ else
# add symbol #normal_mode to distinguish playable ingame from attract_mode,
# as both define #ingame
symbols+=",normal_mode"
elif [[ $cartridge_suffix == 'titlemenu' ]]; then
# titlemenu now uses new engine feature sprite_data:render parameter scale,
# but ingame doesn't need it so we strip it unless #sprite_scale
symbols+=",sprite_scale"
fi
builtin_data_suffix="$cartridge_suffix"
fi
Expand Down
2 changes: 1 addition & 1 deletion data/builtin_data_ingame.p8
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
__gff__
0000000000000000000000000000000000000000000000000000000000000000000000434340000000000000000000004141414141414141414141414141414141414141414141414141212180808000414040414141414141410000000041414141414141414141414101010000414141414141414141414141000041418080
0000000000000000000000000000000000000000000000000000808040000000000000434340000000008080400000004141414141414141414141414141414141414141414141414141212180808000414040414141414141410000808041414141414141414141414101018080818141414141414141414141000041418080
0000000000000000000000000000000000000000000000000000000000000000414141414500414040408080800100004141414100004140401000800080101041414141001010404010018080801010414141410041414040104141808080804040404043430000000080418080800041414141434300000000004040008000
__map__
000000000000000000006e6f6e6f6e6f6e6f6f6e6f6e6f6e6f6e6f6e6f6e49466e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f497e7f7e7f7e7f7e7f7e7f7e7f7e7f7e7f7e7f7e7f000000000000000000007c7d7c7d7c7d7c7d1e1f1e1f1e1f1e1f5e5f5e5f5f
Expand Down
Loading

0 comments on commit c4302ed

Please sign in to comment.