optimisation + freeplay song auto detect

This commit is contained in:
Yoshman29
2023-01-10 03:28:12 +01:00
parent 4e5a316001
commit 7bec745a1d
17 changed files with 158 additions and 256 deletions
-150
View File
@@ -1,150 +0,0 @@
# Changelog
All notable changes will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Changed
- ASSET LOADING OVERHAUL, WAY FASTER LOAD TIMES ON WEB!!! (THANKS TO GEOKURELI WOKE KING)
### Fixed
- That one random note on Bopeebo
## [0.2.7.1] - 2021-02-14
### Added
- Easter eggs
- readme's in desktop versions of the game
### Changed
- New icons, old one was placeholder since October woops!
- Made the transitions between the story mode levels more seamless.
- Offset of the Newgrounds logo on boot screen.
- Made the changelog txt so it can be opened easier by normal people who don't have a markdown reader (most normal people);
### Fixed
- Fixed crashes on Week 6 story mode dialogue if spam too fast ([Thanks to Lotusotho for the Pull Request!](https://github.com/ninjamuffin99/Funkin/pull/357))
- Should show intro credits on desktop versions of the game more consistently
- Layering on Week 4 songs with GF and the LIMO LOL HOW TF I MISS THIS
- Chart's and chart editor now support changeBPM, GOD BLESS MTH FOR THIS ONE I BEEN STRUGGLIN WIT THAT SINCE OCTOBER LMAO ([GOD BLESS MTH](https://github.com/ninjamuffin99/Funkin/pull/382))
- Fixed sustain note trails ALSO THANKS TO MTH U A REAL ONE ([MTH VERY POWERFUL](https://github.com/ninjamuffin99/Funkin/pull/415))
- Antialiasing on the skyscraper lights
## [0.2.7] - 2021-02-02
### Added
- PIXEL DAY UPDATE LOL 1 WEEK LATER
- 3 New songs by Kawaisprite!
- COOL CUTSCENES
- WEEK 6 YOYOYOYOY
- Swaggy pixel art by Moawling!
### Changed
- Made it so you lose sliiiightly more health when you miss a note.
- Removed the default HaxeFlixel pause screen when the game window loses focus, can get screenshots of the game easier hehehe
### Fixed
- Idle animation bug with BF christmas and BF hair blow sprites ([Thanks to Injourn for the Pull Request!](https://github.com/ninjamuffin99/Funkin/pull/237))
## [0.2.6] - 2021-01-20
### Added
- 3 NEW CHRISTMAS SONGS. 2 BY KAWAISPRITE, 1 BY BASSETFILMS!!!!! BF WITH DRIP! SANTA HANGIN OUT!
- Enemy icons change when they you are winning a lot ([Thanks to pahaze for the Pull Request!](https://github.com/ninjamuffin99/Funkin/pull/138))
- Holding CTRL in charting editor places notes on both sides
- Q and E changes sustain lengths in note editor
- Other charting editor workflow improvements
- More hair physics
- Heads appear at top of chart editor to help show which side ur charting for
### Changed
- Tweaked code relating to inputs, hopefully making notes that are close together more fair to hit
### Removed
- Removed APE
### Fixed
- Maybe fixed double notes / jump notes. Need to tweak it for balance, but should open things up for cooler charts in the future.
- Old Verison popup screen weirdness ([Thanks to gedehari for the Pull Request!](https://github.com/ninjamuffin99/Funkin/pull/155))
- Song no longer loops when finishing the song. ([Thanks Injourn for the Pull Request!](https://github.com/ninjamuffin99/Funkin/pull/132))
- Screen wipe being cut off in the limo/mom stage. Should fill the whole screen now.
- Boyfriend animations on hold notes, and pressing on repeating notes should behave differently
## [0.2.5] - 2020-12-27
### Added
- MOMMY GF, 3 NEW ASS SONGS BY KAWAISPRITE, NEW ART BY PHANTOMARCADE,WOOOOOOAH!!!!
- Different icons depending on which character you are against, art by EVILSK8R!!
- Autosave to chart editor
- Clear section button to note editor
- Swap button in note editor
- a new boot text or two
- automatic check for when you're on an old version of the game!
### Changed
- Made Spookeez on Normal easier.
- Mouse is now visible in note editor
### Fixed
- Crash when playing Week 3 and then playing a non-week 3 song
- When pausing music at the start, it doesn't continue the song anyways. ([shoutouts gedehari for the Pull Request!](https://github.com/ninjamuffin99/Funkin/pull/48))
- IDK i think backing out of song menu should play main menu songs again hehe ([shoutouts gedehari for the Pull Request!](https://github.com/ninjamuffin99/Funkin/pull/48))
## [0.2.4] - 2020-12-11
### Added
- 3 NEW SONGS BY KAWAISPRITE. Pico, Philly, and Blammed.
- NEW CHARACTER, PICO. Based off the classic Flash game "Pico's School" by Tom Fulp
- NEW LEVEL WOW! PHILLY BABEEEE
### Changed
- Made it less punishing to ATTEMPT to hit a note and miss, rather than let it pass you
### Fixed
- Song desync of you paused and unpaused frequently ([shoutouts SonicBlam](https://github.com/ninjamuffin99/Funkin/issues/37))
- Animation offsets when GF is scared
## [0.2.3] - 2020-12-04
### Added
- More intro texts
### Fixed
- Exploit where you could potentially give yourself a high score via the debug menu
- Issue/bug where you could spam the confirm button on the story menu ([shoutouts lotusotho for the CODE contribution/pull request!](https://github.com/ninjamuffin99/Funkin/pull/19))
- Glitch where if you never would lose health if you missed a note on a fast song (shoutouts [MrDulfin](https://github.com/ninjamuffin99/Funkin/issues/10), [HotSauceBurritos](https://github.com/ninjamuffin99/Funkin/issues/13) and [LobsterMango](https://lobstermango.newgrounds.com))
- Fixed tiny note bleed over thingies (shoutouts [lotusotho](https://github.com/ninjamuffin99/Funkin/pull/24))
## [0.2.2] - 2020-11-20
### Added
- Music playing on the freeplay menu.
- UI sounds on freeplay menu
- Score now shows mid-song.
- Menu on pause screen! Can resume, and restart song, or go back to main menu.
- New music made for pause menu!
### Changed
- Moved all the intro texts to its own txt file instead of being hardcoded, this allows for much easier customization. File is in the data folder, called "introText.txt", follow the format in there and you're probably good to go!
### Fixed
- Fixed soft lock when pausing on song finish ([shoutouts gedehari](https://github.com/ninjamuffin99/Funkin/issues/15))
- Think I fixed issue that led to in-game scores being off by 2 ([shoutouts Mike](https://github.com/ninjamuffin99/Funkin/issues/4))
- Should have fixed the 1 frame note appearance thing. ([shoutouts Mike](https://github.com/ninjamuffin99/Funkin/issues/6))
- Cleaned up some charting on South on hard mode
- Fixed some animation timings, should feel both better to play, and watch. (shoutouts Dave/Ivan lol)
- Animation issue where GF would freak out on the title screen if you returned to it([shoutouts MultiXIII](https://github.com/ninjamuffin99/Funkin/issues/12)).
## [0.2.1.2] - 2020-11-06
### Fixed
- Story mode scores not properly resetting, leading to VERY inflated highscores on the leaderboards. This also requires me to clear the scores that are on the leaderboard right now, sorry!
- Difficulty on storymode and in freeplay scores
- Hard mode difficulty on campaign levels have been fixed
## [0.2.1.1] - 2020-11-06
### Fixed
- Week 2 not unlocking properly
## [0.2.1] - 2020-11-06
### Added
- Scores to the freeplay menu
- A few new intro boot messages.
- Lightning effect in Spooky stages
- Campaign scores, can now compete on scoreboards for campaign!
- Can now change difficulties in Freeplay mode
### Changed
- Balanced out Normal mode for the harder songs(Dadbattle and Spookeez, not South yet). Should be much easier all around.
- Put tutorial in it's own 'week', so that if you want to play week 1, you don't have to play the tutorial.
### Fixed
- One of the charting bits on South and Spookeez during the intro.
## [0.2.0] - 2020-11-01
### Added
- Uhh Newgrounds release lolol I always lose track of shit.
## [0.1.0] - 2020-10-05
### Added
- Uh, everything. This the game's initial gamejam release. We put it out
-57
View File
@@ -1,57 +0,0 @@
package ;
import flixel.system.FlxBasePreloader;
import openfl.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.BlendMode;
import flash.display.Sprite;
import flash.Lib;
import flixel.FlxG;
@:bitmap("art/preloaderArt.png") class LogoImage extends BitmapData { }
class Preloader extends FlxBasePreloader
{
public function new(MinDisplayTime:Float=3, ?AllowedURLs:Array<String>)
{
super(MinDisplayTime, AllowedURLs);
}
var logo:Sprite;
override function create():Void
{
this._width = Lib.current.stage.stageWidth;
this._height = Lib.current.stage.stageHeight;
var ratio:Float = this._width / 2560; //This allows us to scale assets depending on the size of the screen.
logo = new Sprite();
logo.addChild(new Bitmap(new LogoImage(0,0))); //Sets the graphic of the sprite to a Bitmap object, which uses our embedded BitmapData class.
logo.scaleX = logo.scaleY = ratio;
logo.x = ((this._width) / 2) - ((logo.width) / 2);
logo.y = (this._height / 2) - ((logo.height) / 2);
addChild(logo); //Adds the graphic to the NMEPreloader's buffer.
super.create();
}
override function update(Percent:Float):Void
{
if(Percent < 69)
{
logo.scaleX += Percent / 1920;
logo.scaleY += Percent / 1920;
logo.x -= Percent * 0.6;
logo.y -= Percent / 2;
}else{
logo.scaleX = this._width / 1280;
logo.scaleY = this._width / 1280;
logo.x = ((this._width) / 2) - ((logo.width) / 2);
logo.y = (this._height / 2) - ((logo.height) / 2);
}
super.update(Percent);
}
}
-15
View File
@@ -55,27 +55,12 @@
<assets path='mods' rename='mods' embed='false'/>
<assets path='art/readme.txt' rename='do NOT readme.txt' />
<assets path="CHANGELOG.md" rename='changelog.txt'/>
<!-- ______________________________ Haxedefines _____________________________ -->
<!--Enable the Flixel core recording system-->
<!--<haxedef name="FLX_RECORD" />-->
<!--Disable the right and middle mouse buttons-->
<!-- <haxedef name="FLX_NO_MOUSE_ADVANCED" /> -->
<!--Disable the native cursor API on Flash-->
<!--<haxedef name="FLX_NO_NATIVE_CURSOR" />-->
<!--Optimise inputs, be careful you will get null errors if you don't use conditionals in your game-->
<!-- <haxedef name="FLX_NO_MOUSE" if="mobile" /> -->
<!-- <haxedef name="FLX_NO_KEYBOARD" if="mobile" /> -->
<!-- <haxedef name="FLX_NO_TOUCH" if="desktop" /> -->
<!--<haxedef name="FLX_NO_GAMEPAD" />-->
<!--Disable the Flixel core focus lost screen-->
<haxedef name="FLX_NO_FOCUS_LOST_SCREEN" />
<!--Disable the Flixel core debugger. Automatically gets set whenever you compile in release mode!-->
View File

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

+1
View File
@@ -1,4 +1,5 @@
@ECHO OFF
cd ..
echo Building Game...
lime build windows --haxeflag="--macro include('scripting')" --haxeflag="-xml docs/doc.xml"
echo Generating Documentation...
+1 -1
View File
@@ -1 +1 @@
1967
1990
+4 -2
View File
@@ -33,8 +33,10 @@
},
{
"name": "hxCodec",
"type": "haxelib",
"version": null
"type": "git",
"dir": null,
"ref": "master",
"url": "https://www.github.com/polybiusproxy/hxCodec"
},
{
"name": "lime",
+2 -2
View File
@@ -549,8 +549,8 @@ class PlayState extends MusicBeatState
// ADD YOUR HARDCODED SCRIPTS HERE!
default:
for(content in [
Paths.getFolderContent('songs/${SONG.song.toLowerCase()}/scripts', false, true, !fromMods),
Paths.getFolderContent('data/charts/', false, true, !fromMods)]) {
Paths.getFolderContent('songs/${SONG.song.toLowerCase()}/scripts', true, !fromMods),
Paths.getFolderContent('data/charts/', true, !fromMods)]) {
for(file in content) {
var ext = Path.extension(file).toLowerCase();
if (Script.scriptExtensions.contains(ext))
+45 -16
View File
@@ -253,21 +253,50 @@ class FreeplaySonglist {
}
}
private function getSongsFromSource(source:funkin.system.AssetsLibraryList.AssetSource) {
var path:String = Paths.json('freeplaySonglist');
var addOGSongs:Bool = true;
if (Paths.assetsTree.existsSpecific(path, "TEXT", source)) {
try {
var json:FreeplayJSON = Json.parse(Paths.assetsTree.getSpecificAsset(path, "TEXT", source));
addOGSongs = CoolUtil.getDefault(json.addOGSongs, true);
_addJSONSongs(json.songs, false);
} catch(e) {
Logs.trace('Couldn\'t parse Freeplay JSON: ${e.toString()}');
}
} else {
var found:Array<FreeplaySong> = [];
for(s in Paths.getFolderDirectories('songs', false, source)) {
var sMetaPath = Paths.file('songs/${s}/meta.json');
if (Paths.assetsTree.existsSpecific(sMetaPath, "TEXT", source)) {
try {
var meta:FreeplaySong = Json.parse(Paths.assetsTree.getSpecificAsset(sMetaPath, "TEXT", source));
if (meta.name == null)
meta.name = s;
found.push(meta);
} catch(e) {
Logs.trace('Couldn\'t parse metadata for song ${s}: ${e.toString()}');
found.push({
name: s
});
}
} else {
found.push({
name: s
});
}
}
_addJSONSongs(found, false);
}
return addOGSongs;
}
// TODO: REWRITE THIS SHIT UGH
public static function get() {
var songList = new FreeplaySonglist();
var jsonPath = Paths.json("freeplaySonglist");
var baseJsonPath = Paths.getPath('data/freeplaySonglist.json', TEXT, null, true);
try {
var json:FreeplayJSON = Json.parse(Assets.getText(jsonPath));
var addOGSongs = CoolUtil.getDefault(json.addOGSongs, true);
songList._addJSONSongs(json.songs, jsonPath == baseJsonPath);
if (addOGSongs && (jsonPath != baseJsonPath)) {
var json:FreeplayJSON = Json.parse(Assets.getText(baseJsonPath));
songList._addJSONSongs(json.songs, true);
}
}
if (songList.getSongsFromSource(MODS))
songList.getSongsFromSource(SOURCE);
return songList;
}
@@ -280,9 +309,9 @@ typedef FreeplayJSON = {
typedef FreeplaySong = {
public var name:String;
public var icon:String;
public var color:Dynamic;
public var difficulties:Array<String>;
public var ?icon:String;
public var ?color:Dynamic;
public var ?difficulties:Array<String>;
}
class SongMetadata
@@ -300,7 +329,7 @@ class SongMetadata
if (difficulties != null && difficulties.length > 0) {
this.difficulties = difficulties;
} else {
this.difficulties = difficulties = [for(f in Paths.getFolderContent('songs/${song.toLowerCase()}/charts/', false, false, fromSource)) if (Path.extension(f = f.toUpperCase()) == "JSON") Path.withoutExtension(f)];
this.difficulties = difficulties = [for(f in Paths.getFolderContent('songs/${song.toLowerCase()}/charts/', false, fromSource)) if (Path.extension(f = f.toUpperCase()) == "JSON") Path.withoutExtension(f)];
if (difficulties.length == 3) {
var hasHard = false, hasNormal = false, hasEasy = false;
for(d in difficulties) {
+2
View File
@@ -35,5 +35,7 @@ interface ModsAssetLibrary {
private function __parseAsset(asset:String):Bool;
public function getFiles(folder:String):Array<String>;
public function getFolders(folder:String):Array<String>;
#end
}
+8 -2
View File
@@ -98,14 +98,20 @@ class ModsFolderLibrary extends AssetLibrary implements ModsAssetLibrary {
return getAssetPath();
}
public function getFiles(folder:String):Array<String> {
public inline function getFolders(folder:String):Array<String>
return __getFiles(folder, true);
public inline function getFiles(folder:String):Array<String>
return __getFiles(folder, false);
public function __getFiles(folder:String, folders:Bool = false) {
if (!folder.endsWith("/")) folder = folder + "/";
if (!__parseAsset(folder)) return [];
var path = getAssetPath();
try {
var result:Array<String> = [];
for(e in FileSystem.readDirectory(path))
if (!FileSystem.isDirectory('$path$e'))
if (FileSystem.isDirectory('$path$e') == folders)
result.push(e);
return result;
} catch(e) {
+17
View File
@@ -161,5 +161,22 @@ class ZipFolderLibrary extends AssetLibrary implements ModsAssetLibrary {
}
return content;
}
public function getFolders(folder:String):Array<String> {
var content:Array<String> = [];
if (!folder.endsWith("/")) folder = folder + "/";
if (!__parseAsset(folder)) return [];
@:privateAccess
for(k=>e in assets) {
if (k.toLowerCase().startsWith(_parsedAsset)) {
var fileName = k.substr(_parsedAsset.length);
if (fileName.contains("/"))
content.push(fileName.split("/")[0]);
}
}
return content;
}
#end
}
+65 -9
View File
@@ -8,22 +8,30 @@ class AssetsLibraryList extends AssetLibrary {
public var libraries:Array<AssetLibrary> = [];
public var base:AssetLibrary;
public var sourceLibsAmount:Int = 0;
public function removeLibrary(lib:AssetLibrary) {
if (lib == null) return lib;
libraries.remove(lib);
return lib;
}
public override function exists(id:String, type:String) {
public function existsSpecific(id:String, type:String, source:AssetSource = BOTH) {
if (!id.startsWith("assets/") && exists('assets/$id', type))
return true;
for(e in libraries)
for(k=>e in libraries) {
if (shouldSkipLib(k, source)) continue;
if (e.exists(id, type))
return true;
}
return false;
}
public override inline function exists(id:String, type:String):Bool
return existsSpecific(id, type, BOTH);
public function getSpecificPath(id:String, source:AssetSource = BOTH) {
for(k=>e in libraries) {
if (shouldSkipLib(k, source)) continue;
public override function getPath(id:String) {
for(e in libraries) {
@:privateAccess
if (e.exists(id, e.types.get(id))) {
var path = e.getPath(id);
@@ -34,9 +42,14 @@ class AssetsLibraryList extends AssetLibrary {
return null;
}
public function getFiles(folder:String):Array<String> {
public override inline function getPath(id:String)
return getSpecificPath(id, BOTH);
public function getFiles(folder:String, source:AssetSource = BOTH):Array<String> {
var content:Array<String> = [];
for(e in libraries) {
for(k=>e in libraries) {
if (shouldSkipLib(k, source)) continue;
var l = e;
if (l is openfl.utils.AssetLibrary) {
@@ -56,14 +69,38 @@ class AssetsLibraryList extends AssetLibrary {
return content;
}
public override function getAsset(id:String, type:String) {
public function getFolders(folder:String, source:AssetSource = BOTH):Array<String> {
var content:Array<String> = [];
for(k=>e in libraries) {
if (shouldSkipLib(k, source)) continue;
var l = e;
if (l is openfl.utils.AssetLibrary) {
@:privateAccess
l = cast(l, openfl.utils.AssetLibrary).__proxy;
}
// TODO: do base folder scanning
#if MOD_SUPPORT
if (l is ModsAssetLibrary) {
var lib = cast(l, ModsAssetLibrary);
for(e in lib.getFolders(folder))
content.push(e);
}
#end
}
return content;
}
public function getSpecificAsset(id:String, type:String, source:AssetSource = BOTH):Dynamic {
try {
#if cpp
cpp.vm.Gc.enable(false);
#end
if (!id.startsWith("assets/")) {
var ass = getAsset('assets/$id', type);
var ass = getSpecificAsset('assets/$id', type, source);
if (ass != null) {
#if cpp
cpp.vm.Gc.enable(true);
@@ -71,7 +108,9 @@ class AssetsLibraryList extends AssetLibrary {
return ass;
}
}
for(e in libraries) {
for(k=>e in libraries) {
if (shouldSkipLib(k, source)) continue;
var asset = e.getAsset(id, type);
if (asset != null) {
#if cpp
@@ -95,6 +134,16 @@ class AssetsLibraryList extends AssetLibrary {
return null;
}
private function shouldSkipLib(k:Int, source:AssetSource) {
return switch(source) {
case BOTH: false;
case SOURCE: k < libraries.length - sourceLibsAmount;
case MODS: k >= libraries.length - sourceLibsAmount;
};
}
public override inline function getAsset(id:String, type:String):Dynamic
return getSpecificAsset(id, type, BOTH);
public function clearCache() {
var libs:Array<AssetLibrary> = [for(lib in libraries) lib];
libs.push(this);
@@ -142,10 +191,17 @@ class AssetsLibraryList extends AssetLibrary {
if (base == null)
base = Assets.getLibrary("default");
addLibrary(this.base = base);
sourceLibsAmount++;
}
public function addLibrary(lib:AssetLibrary) {
libraries.insert(0, lib);
return lib;
}
}
enum abstract AssetSource(Null<Bool>) from Bool from Null<Bool> to Null<Bool> {
var SOURCE = true;
var MODS = false;
var BOTH = null;
}
+2
View File
@@ -166,6 +166,7 @@ class Main extends Sprite
#if USE_SOURCE_ASSETS
trace("Used lime test windows. Switching into source assets.");
Paths.assetsTree.addLibrary(ModsFolder.loadLibraryFromFolder('assets', './../../../../assets/', true));
Paths.assetsTree.sourceLibsAmount++;
#end
var buildNum:Int = Std.parseInt(File.getContent("./../../../../buildnumber.txt"));
@@ -174,6 +175,7 @@ class Main extends Sprite
} else {
#if USE_ADAPTED_ASSETS
Paths.assetsTree.addLibrary(ModsFolder.loadLibraryFromFolder('assets', './assets/', true));
Paths.assetsTree.sourceLibsAmount++;
#end
}
#end
+11 -2
View File
@@ -217,10 +217,19 @@ class Paths
return FlxAtlasFrames.fromSpriteSheetPacker('$key.png', '$key.txt');
}
static public function getFolderContent(key:String, includeSource:Bool = true, addPath:Bool = false, scanSource:Bool = false):Array<String> {
static public function getFolderDirectories(key:String, addPath:Bool = false, source:funkin.system.AssetsLibraryList.AssetSource = BOTH):Array<String> {
if (!key.endsWith("/")) key += "/";
var content = assetsTree.getFolders('assets/$key', source);
if (addPath) {
for(k=>e in content)
content[k] = '$key$e';
}
return content;
}
static public function getFolderContent(key:String, addPath:Bool = false, source:funkin.system.AssetsLibraryList.AssetSource = BOTH):Array<String> {
// designed to work both on windows and web
if (!key.endsWith("/")) key += "/";
var content = assetsTree.getFiles('assets/$key');
var content = assetsTree.getFiles('assets/$key', source);
if (addPath) {
for(k=>e in content)
content[k] = '$key$e';