diff --git a/README.md b/README.md index bdcc17e..0c611f1 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,12 @@ Benchmark for PSP based on [Pixijs's BunnyMark](https://www.goodboydigital.com/p | PSP | 60 FPS | 44 FPS | 22-23 FPS | 9 FPS | 4 FPS | | PPSSPP (Emulator) | 60 FPS | 60 FPS | 46 FPS | 18 FPS | 9 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 | +| ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | +| PSP | 60 FPS | 30 FPS | 20 FPS | 9 FPS | 4-5 FPS | +| PPSSPP (Emulator) | 60 FPS | 60 FPS | 30 FPS | 12 FPS | 7 FPS | + ### [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* | | ------------ | ------------ | ------------ | ------------ | ------------ | ------------ | diff --git a/bunnyMarkPhoenixGameEngine/Assets/Fonts/arialbd.ttf b/bunnyMarkPhoenixGameEngine/Assets/Fonts/arialbd.ttf new file mode 100644 index 0000000..a6037e6 Binary files /dev/null and b/bunnyMarkPhoenixGameEngine/Assets/Fonts/arialbd.ttf differ diff --git a/bunnyMarkPhoenixGameEngine/Assets/Scripts/Bunny.lua b/bunnyMarkPhoenixGameEngine/Assets/Scripts/Bunny.lua new file mode 100644 index 0000000..f691ced --- /dev/null +++ b/bunnyMarkPhoenixGameEngine/Assets/Scripts/Bunny.lua @@ -0,0 +1,54 @@ +Bunny = {} +Bunny.__index = Bunny + +local random = math.random + +function Bunny:create(texture) + local r = {} + setmetatable(r, Bunny) + r.x = 0 + r.y = 0 + + r.texture = texture + 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) + 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 y > maxY - h then + speedY = speedY * -0.85 + y = maxY - h + if random() > 0.5 then + speedY = speedY - random() * 6 + end + elseif y < minY then + speedY = 0 + y = minY + end + + bunny.x = x + bunny.y = y + bunny.speedX = speedX + bunny.speedY = speedY +end diff --git a/bunnyMarkPhoenixGameEngine/Assets/Scripts/Main.lua b/bunnyMarkPhoenixGameEngine/Assets/Scripts/Main.lua new file mode 100644 index 0000000..6147f9b --- /dev/null +++ b/bunnyMarkPhoenixGameEngine/Assets/Scripts/Main.lua @@ -0,0 +1,119 @@ +require("Assets/Scripts/Rect") +require("Assets/Scripts/Bunny") +require('Assets/Scripts/buttonsCommon') + +width = 480 +height = 272 + +wabbitTexture = nil + +bunnys = {} +gravity = 0.5 --1.5 + +maxX = width +minX = 0 +maxY = height +minY = 0 + +startBunnyCount = 2 +isAdding = false +count = 0 + +amount = 10 + +bgColor = pge.gfx.createcolor(255, 255, 255) +font = pge.font.load("Assets/Fonts/arialbd.ttf", 12, PGE_VRAM) + +fontFGColor = pge.gfx.createcolor(0, 255, 255) +fontBGColor = pge.gfx.createcolor(16, 92, 182) + +bunnyTextures = nil +currentTexture = nil +bunnyType = nil + +function spawnBunny() + local bunny = Bunny:create(currentTexture) + table.insert(bunnys, bunny) + count = count + 1 +end + +function onReady() + wabbitTexture = pge.texture.load("Assets/Sprites/bunnys.png", PGE_VRAM) + + bunnyTextures = { + Rect:create(2, 47, 26, 37), + Rect:create(2, 86, 26, 37), + Rect:create(2, 125, 26, 37), + Rect:create(2, 164, 26, 37), + Rect:create(2, 2, 26, 37) + } + + bunnyType = 2 + currentTexture = bunnyTextures[bunnyType] + + for i = 1, startBunnyCount do + spawnBunny() + end +end + + +function onTouchStart() + isAdding = true; +end + +function onTouchEnd() + bunnyType = bunnyType + 1 + bunnyType = (bunnyType % 5) + 1; + currentTexture = bunnyTextures[bunnyType]; + + isAdding = false; +end + + + +local fpsTimer = pge.timer.create() +local FPS = 60 + +onReady() +while true do + pge.controls.update() + pge.gfx.startdrawing() + pge.gfx.clearscreen(bgColor) + + if pge.controls.pressed(PGE_CTRL_CROSS) then + onTouchStart() + end + if pge.controls.released(PGE_CTRL_CROSS) then + onTouchEnd() + end + + if isAdding then + -- add 10 at a time :) + if count < 200000 then + for i = 0, amount do + spawnBunny() + end + end + end + + wabbitTexture:activate() + for i = 1, count do + local bunny = bunnys[i] + Bunny:processPhysics(bunny) + local tex = bunny.texture + wabbitTexture:draw( + bunny.x, bunny.y, bunny.w, bunny.h, + tex.x, tex.y, tex.w, tex.h) + end + + pge.timer.update(fpsTimer) + FPS = math.floor(1 / pge.timer.getdelta(fpsTimer)) + + pge.gfx.drawrect(0, 0, 90, 30, fontBGColor) + font:activate() + font:print(2, 2, fontFGColor, FPS .. " FPS")--, fontFGColor, fontBGColor) + font:print(2, 16, fontFGColor, count .. " BUNNIES")--, fontFGColor, fontBGColor) + + pge.gfx.enddrawing() + pge.gfx.swapbuffers() +end \ No newline at end of file diff --git a/bunnyMarkPhoenixGameEngine/Assets/Scripts/Rect.lua b/bunnyMarkPhoenixGameEngine/Assets/Scripts/Rect.lua new file mode 100644 index 0000000..7ac6260 --- /dev/null +++ b/bunnyMarkPhoenixGameEngine/Assets/Scripts/Rect.lua @@ -0,0 +1,12 @@ +Rect = {} +Rect.__index = Rect + +function Rect:create(x,y,w,h) + local r = {} + setmetatable(r, Rect) + r.x = x + r.y = y + r.w = w + r.h = h + return r + end \ No newline at end of file diff --git a/bunnyMarkPhoenixGameEngine/Assets/Scripts/buttonsCommon.lua b/bunnyMarkPhoenixGameEngine/Assets/Scripts/buttonsCommon.lua new file mode 100644 index 0000000..d6f8b9a --- /dev/null +++ b/bunnyMarkPhoenixGameEngine/Assets/Scripts/buttonsCommon.lua @@ -0,0 +1,11 @@ +function press(button) + return buttons.pressed(buttons[button]) +end + +function held(button) + return buttons.held(buttons[button]) +end + +function release(button) + return buttons.released(buttons[button]) +end diff --git a/bunnyMarkPhoenixGameEngine/Assets/Sprites/bunnys.png b/bunnyMarkPhoenixGameEngine/Assets/Sprites/bunnys.png new file mode 100644 index 0000000..7010eb2 Binary files /dev/null and b/bunnyMarkPhoenixGameEngine/Assets/Sprites/bunnys.png differ diff --git a/bunnyMarkPhoenixGameEngine/EBOOT.PBP b/bunnyMarkPhoenixGameEngine/EBOOT.PBP new file mode 100644 index 0000000..c824d3a Binary files /dev/null and b/bunnyMarkPhoenixGameEngine/EBOOT.PBP differ diff --git a/bunnyMarkPhoenixGameEngine/ICON0.png b/bunnyMarkPhoenixGameEngine/ICON0.png new file mode 100644 index 0000000..881638d Binary files /dev/null and b/bunnyMarkPhoenixGameEngine/ICON0.png differ diff --git a/bunnyMarkPhoenixGameEngine/ICON0.psd b/bunnyMarkPhoenixGameEngine/ICON0.psd new file mode 100644 index 0000000..f8d8456 Binary files /dev/null and b/bunnyMarkPhoenixGameEngine/ICON0.psd differ diff --git a/bunnyMarkPhoenixGameEngine/script.lua b/bunnyMarkPhoenixGameEngine/script.lua new file mode 100644 index 0000000..5fd0f66 --- /dev/null +++ b/bunnyMarkPhoenixGameEngine/script.lua @@ -0,0 +1 @@ +dofile("Assets/Scripts/Main.lua")