From 2cc0610620debd08c8dd28c53a6cdb3fca089a86 Mon Sep 17 00:00:00 2001 From: antimYT Date: Sat, 7 Dec 2024 11:15:44 +0500 Subject: [PATCH] Optimized Bunny.lua - Updated lua stats --- README.md | 10 +-- .../Assets/Scripts/Bunny.lua | 59 +++++++++++------- .../Assets/Scripts/Bunny.lua | 57 ++++++++++------- bunnyMarkLuaPlayerPlus_r163/EBOOT.PBP | Bin 2414054 -> 2414054 bytes .../Assets/Scripts/Bunny.lua | 54 +++++++++------- bunnyMarkLuaPlayerYTv04/EBOOT.PBP | Bin 1046397 -> 1046397 bytes bunnyMarkONEluav4R1/Assets/Scripts/Bunny.lua | 54 +++++++++------- 7 files changed, 140 insertions(+), 94 deletions(-) diff --git a/README.md b/README.md index 0c611f1..aae947f 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ Benchmark for PSP based on [Pixijs's BunnyMark](https://www.goodboydigital.com/p ### [LuaPlayer Euphoria v8](https://www.brewology.com/downloads/download.php?id=11378&mcid=1) | ![ICON0](https://raw.githubusercontent.com/antim0118/bunnyMark-psp/master/bunnyMarkLuaPlayerEuphoria_V8/ICON0.png "ICON0") | 100 BUNNIES | 500 BUNNIES | 1000 BUNNIES | 2500 BUNNIES | 5000 BUNNIES | | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | -| PSP | 60 FPS | 44 FPS | 22-23 FPS | 9 FPS | 4 FPS | -| PPSSPP (Emulator) | 60 FPS | 60 FPS | 46 FPS | 18 FPS | 9 FPS | +| PSP | 60 FPS | 47 FPS | 23-24 FPS | 9-10 FPS | 4-5 FPS | +| PPSSPP (Emulator) | 60 FPS | 60 FPS | 50 FPS | 19-20 FPS | 9-10 FPS | ### [Phoenix Game Engine 0.02](https://archive.org/details/pgelua.7z) | ![ICON0](https://raw.githubusercontent.com/antim0118/bunnyMark-psp/master/bunnyMarkPhoenixGameEngine/ICON0.png "ICON0") | 100 BUNNIES | 500 BUNNIES | 1000 BUNNIES | 2500 BUNNIES | 5000 BUNNIES | @@ -36,15 +36,15 @@ Benchmark for PSP based on [Pixijs's BunnyMark](https://www.goodboydigital.com/p ### [LuaPlayerYT v0.4](https://vk.com/nomoreyuliateam) | ![ICON0](https://raw.githubusercontent.com/antim0118/bunnyMark-psp/master/bunnyMarkLuaPlayerYTv04/ICON0.png "ICON0") | 100 BUNNIES | 500 BUNNIES | 1000 BUNNIES | 2500 BUNNIES | 3700 BUNNIES* | | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | -| PSP | 60 FPS | 20 FPS | 12 FPS | 5-6 FPS | 3-4 FPS | +| PSP | 60 FPS | 20 FPS | 12 FPS | 5 FPS | 3-4 FPS | | PPSSPP (Emulator) | 60 FPS | 60 FPS | 30 FPS | 15 FPS | 10 FPS | `* - Crashes after 3745 bunnies` ### [ONElua v4R1](http://onelua.x10.mx/) | ![ICON0](https://raw.githubusercontent.com/antim0118/bunnyMark-psp/master/bunnyMarkONEluav4R1/ICON0.png "ICON0") | 100 BUNNIES | 500 BUNNIES | 1000 BUNNIES | 2500 BUNNIES | 5000 BUNNIES | | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | -| PSP | 60 FPS | 20 FPS | 12 FPS | 5 FPS | 3 FPS | -| PPSSPP (Emulator) | 60 FPS | 30 FPS | 20 FPS | 10 FPS | 6 FPS | +| PSP | 60 FPS | 20 FPS | 12 FPS | 6 FPS | 3 FPS | +| PPSSPP (Emulator) | 60 FPS | 30 FPS | 23-29 FPS | 12 FPS | 6 FPS | ### Gamemaker 8.1 ([Chovy-GM](https://github.com/LiEnby/chovy-gm)) | ![ICON0](https://raw.githubusercontent.com/antim0118/bunnyMark-psp/master/bunnyMarkGamemaker81/ICON0.png "ICON0") | 100 BUNNIES | 500 BUNNIES | 1000 BUNNIES | 2500 BUNNIES | 4000 BUNNIES* | diff --git a/bunnyMarkLuaPlayerEuphoria_V8/Assets/Scripts/Bunny.lua b/bunnyMarkLuaPlayerEuphoria_V8/Assets/Scripts/Bunny.lua index 1c7595e..f691ced 100644 --- a/bunnyMarkLuaPlayerEuphoria_V8/Assets/Scripts/Bunny.lua +++ b/bunnyMarkLuaPlayerEuphoria_V8/Assets/Scripts/Bunny.lua @@ -1,6 +1,8 @@ Bunny = {} Bunny.__index = Bunny +local random = math.random + function Bunny:create(texture) local r = {} setmetatable(r, Bunny) @@ -8,36 +10,45 @@ function Bunny:create(texture) r.y = 0 r.texture = texture - r.speedX = math.random() * 10 - r.speedY = math.random() * 10 - 5 - - r.w = texture.w - r.h = texture.h + r.speedX = random() * 10 + r.speedY = random() * 10 - 5 + + r.scale = 0.5 + random() * 0.5 + r.w = r.scale * texture.w + r.h = r.scale * texture.h return r end function Bunny:processPhysics(bunny) - bunny.x = bunny.x + bunny.speedX - bunny.y = bunny.y + bunny.speedY - bunny.speedY = bunny.speedY + gravity - - if bunny.x > maxX - bunny.w then - bunny.speedX = bunny.speedX * -1 - bunny.x = maxX - bunny.w - elseif bunny.x < minX then - bunny.speedX = bunny.speedX * -1 - bunny.x = minX + local x = bunny.x + bunny.speedX + local y = bunny.y + bunny.speedY + local speedX = bunny.speedX + local speedY = bunny.speedY + gravity + local w = bunny.w + local h = bunny.h + + if x > maxX - w then + speedX = speedX * -1 + x = maxX - w + elseif x < minX then + speedX = speedX * -1 + x = minX end - if bunny.y > maxY - bunny.h then - bunny.speedY = bunny.speedY * -0.85 - bunny.y = maxY - bunny.h - if math.random() > 0.5 then - bunny.speedY = bunny.speedY - math.random() * 6 + if y > maxY - h then + speedY = speedY * -0.85 + y = maxY - h + if random() > 0.5 then + speedY = speedY - random() * 6 end - elseif bunny.y < minY then - bunny.speedY = 0 - bunny.y = minY + elseif y < minY then + speedY = 0 + y = minY end -end \ No newline at end of file + + bunny.x = x + bunny.y = y + bunny.speedX = speedX + bunny.speedY = speedY +end diff --git a/bunnyMarkLuaPlayerPlus_r163/Assets/Scripts/Bunny.lua b/bunnyMarkLuaPlayerPlus_r163/Assets/Scripts/Bunny.lua index e6ef957..f691ced 100644 --- a/bunnyMarkLuaPlayerPlus_r163/Assets/Scripts/Bunny.lua +++ b/bunnyMarkLuaPlayerPlus_r163/Assets/Scripts/Bunny.lua @@ -1,6 +1,8 @@ Bunny = {} Bunny.__index = Bunny +local random = math.random + function Bunny:create(texture) local r = {} setmetatable(r, Bunny) @@ -8,32 +10,45 @@ function Bunny:create(texture) r.y = 0 r.texture = texture - r.speedX = math.random() * 10 - r.speedY = math.random() * 10 - 5 + r.speedX = random() * 10 + r.speedY = random() * 10 - 5 + + r.scale = 0.5 + random() * 0.5 + r.w = r.scale * texture.w + r.h = r.scale * texture.h + return r end function Bunny:processPhysics(bunny) - bunny.x = bunny.x + bunny.speedX - bunny.y = bunny.y + bunny.speedY - bunny.speedY = bunny.speedY + gravity - - if bunny.x > maxX - bunny.texture.w then - bunny.speedX = bunny.speedX * -1 - bunny.x = maxX - bunny.texture.w - elseif bunny.x < minX then - bunny.speedX = bunny.speedX * -1 - bunny.x = minX + local x = bunny.x + bunny.speedX + local y = bunny.y + bunny.speedY + local speedX = bunny.speedX + local speedY = bunny.speedY + gravity + local w = bunny.w + local h = bunny.h + + if x > maxX - w then + speedX = speedX * -1 + x = maxX - w + elseif x < minX then + speedX = speedX * -1 + x = minX end - if bunny.y > maxY - bunny.texture.h then - bunny.speedY = bunny.speedY * -0.85 - bunny.y = maxY - bunny.texture.h - if math.random() > 0.5 then - bunny.speedY = bunny.speedY - math.random() * 6 + if y > maxY - h then + speedY = speedY * -0.85 + y = maxY - h + if random() > 0.5 then + speedY = speedY - random() * 6 end - elseif bunny.y < minY then - bunny.speedY = 0 - bunny.y = minY + elseif y < minY then + speedY = 0 + y = minY end -end \ No newline at end of file + + bunny.x = x + bunny.y = y + bunny.speedX = speedX + bunny.speedY = speedY +end diff --git a/bunnyMarkLuaPlayerPlus_r163/EBOOT.PBP b/bunnyMarkLuaPlayerPlus_r163/EBOOT.PBP index 15e76b61a65a00ff27e033eddfd79a63c9e21db8..4bad0d368362dbcd308d9abdcbb1e0cca848271f 100644 GIT binary patch delta 124 zcmWN=$qj-~06@Wf6&G+<6mes-P!8`-Vi}&j`--py>d;B1e?3G0-+e;WiU9{W#1Td~ v#tBYwhA}2M#|18Ng=^g47I(PE6c2dB3{RNj883Ln8{VD+-!_l$56Q maxX - bunny.w then - bunny.speedX = bunny.speedX * -1 - bunny.x = maxX - bunny.w - elseif bunny.x < minX then - bunny.speedX = bunny.speedX * -1 - bunny.x = minX + local x = bunny.x + bunny.speedX + local y = bunny.y + bunny.speedY + local speedX = bunny.speedX + local speedY = bunny.speedY + gravity + local w = bunny.w + local h = bunny.h + + if x > maxX - w then + speedX = speedX * -1 + x = maxX - w + elseif x < minX then + speedX = speedX * -1 + x = minX end - if bunny.y > maxY - bunny.h then - bunny.speedY = bunny.speedY * -0.85 - bunny.y = maxY - bunny.h - if math.random() > 0.5 then - bunny.speedY = bunny.speedY - math.random() * 6 + if y > maxY - h then + speedY = speedY * -0.85 + y = maxY - h + if random() > 0.5 then + speedY = speedY - random() * 6 end - elseif bunny.y < minY then - bunny.speedY = 0 - bunny.y = minY + elseif y < minY then + speedY = 0 + y = minY end -end \ No newline at end of file + + bunny.x = x + bunny.y = y + bunny.speedX = speedX + bunny.speedY = speedY +end diff --git a/bunnyMarkLuaPlayerYTv04/EBOOT.PBP b/bunnyMarkLuaPlayerYTv04/EBOOT.PBP index b1112cafbb66cdfbf4c176555a40ebfeb168b54f..ddfcd2eaf52269c1ecc1ab3e68e07fcb755ad093 100644 GIT binary patch delta 59 zcmV~$xeTkNpM0Y{uL;*1Nf KxZ!?#Jl_v(dmM8B diff --git a/bunnyMarkONEluav4R1/Assets/Scripts/Bunny.lua b/bunnyMarkONEluav4R1/Assets/Scripts/Bunny.lua index b8a9056..f691ced 100644 --- a/bunnyMarkONEluav4R1/Assets/Scripts/Bunny.lua +++ b/bunnyMarkONEluav4R1/Assets/Scripts/Bunny.lua @@ -1,6 +1,8 @@ Bunny = {} Bunny.__index = Bunny +local random = math.random + function Bunny:create(texture) local r = {} setmetatable(r, Bunny) @@ -8,10 +10,10 @@ function Bunny:create(texture) r.y = 0 r.texture = texture - r.speedX = math.random() * 10 - r.speedY = math.random() * 10 - 5 + r.speedX = random() * 10 + r.speedY = random() * 10 - 5 - r.scale = 0.5 + math.random() * 0.5 + r.scale = 0.5 + random() * 0.5 r.w = r.scale * texture.w r.h = r.scale * texture.h @@ -19,26 +21,34 @@ function Bunny:create(texture) end function Bunny:processPhysics(bunny) - bunny.x = bunny.x + bunny.speedX - bunny.y = bunny.y + bunny.speedY - bunny.speedY = bunny.speedY + gravity - - if bunny.x > maxX - bunny.w then - bunny.speedX = bunny.speedX * -1 - bunny.x = maxX - bunny.w - elseif bunny.x < minX then - bunny.speedX = bunny.speedX * -1 - bunny.x = minX + local x = bunny.x + bunny.speedX + local y = bunny.y + bunny.speedY + local speedX = bunny.speedX + local speedY = bunny.speedY + gravity + local w = bunny.w + local h = bunny.h + + if x > maxX - w then + speedX = speedX * -1 + x = maxX - w + elseif x < minX then + speedX = speedX * -1 + x = minX end - if bunny.y > maxY - bunny.h then - bunny.speedY = bunny.speedY * -0.85 - bunny.y = maxY - bunny.h - if math.random() > 0.5 then - bunny.speedY = bunny.speedY - math.random() * 6 + if y > maxY - h then + speedY = speedY * -0.85 + y = maxY - h + if random() > 0.5 then + speedY = speedY - random() * 6 end - elseif bunny.y < minY then - bunny.speedY = 0 - bunny.y = minY + elseif y < minY then + speedY = 0 + y = minY end -end \ No newline at end of file + + bunny.x = x + bunny.y = y + bunny.speedX = speedX + bunny.speedY = speedY +end