This commit is contained in:
wan-may 2025-03-16 21:15:04 -03:00
parent cf7011da1f
commit 6a23bf6570
19 changed files with 361 additions and 67 deletions

View File

@ -1,10 +0,0 @@
[Desktop Entry]
Name=
Comment=Circumpolar Puzzle Game
MimeType=application/x-love-game;
Exec= %f
Type=Application
Categories=Development;Game;
Terminal=false
Icon=.png
NoDisplay=true

107
build/Info.plist Normal file
View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>23C71</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>love</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>GameIcon</string>
<key>CFBundleTypeName</key>
<string>LÖVE Project</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>org.love2d.love-game</string>
</array>
<key>LSTypeIsPackage</key>
<integer>1</integer>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>None</string>
</dict>
<dict>
<key>CFBundleTypeIconFile</key>
<string>Document</string>
<key>CFBundleTypeName</key>
<string>Document</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>love</string>
<key>CFBundleIconFile</key>
<string>OS X AppIcon</string>
<key>CFBundleIconName</key>
<string>OS X AppIcon</string>
<key>CFBundleIdentifier</key>
<string>AKULIVIK</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AKULIVIK</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>11.5a</string>
<key>CFBundleSignature</key>
<string>LoVe</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string></string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>14.2</string>
<key>DTSDKBuild</key>
<string>23C53</string>
<key>DTSDKName</key>
<string>macosx14.2</string>
<key>DTXcode</key>
<string>1520</string>
<key>DTXcodeBuild</key>
<string>15C500b</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>LSMinimumSystemVersion</key>
<string>10.11</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>© 2025 wan-may</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<false/>
</dict>
</plist>

View File

@ -2,6 +2,7 @@ rm -r build/win/
rm -r build/out/ rm -r build/out/
rm -r build/linux/ rm -r build/linux/
rm -r build/macos/ rm -r build/macos/
rm -r build/web/
mkdir -p build/ mkdir -p build/
mkdir -p build/out/ mkdir -p build/out/
@ -9,17 +10,22 @@ cd src
zip -9 -r "../build/out/AKULIVIK.love" . zip -9 -r "../build/out/AKULIVIK.love" .
cd ../build/ cd ../build/
echo WINDOWS #echo WEB
#npx love.js -m 100000000 -t "ᐊᑯᓕᕕᒃ" -c out/AKULIVIK.love web/
echo ===WINDOWS===
echo
mkdir -p win/ mkdir -p win/
cp -r /home/frc/Bureau/frc/dev/love/love-11.5-win64/. win/ cp -r /home/frc/Bureau/frc/dev/love/love-11.5-win64/. win/
cat licence.txt win/license.txt > win/license.txt cat licence.txt >> win/license.txt
cat "win/love.exe" "out/AKULIVIK.love" > win/ᐊᑯᓕᕕᒃ.exe cat "win/love.exe" "out/AKULIVIK.love" > win/ᐊᑯᓕᕕᒃ.exe
rm win/love.exe rm win/love.exe
cd win/ cd win/
zip -9 -r "../out/ᐊᑯᓕᕕᒃ-win.zip" . zip -9 -r "../out/ᐊᑯᓕᕕᒃ-win.zip" .
cd .. cd ..
echo LINUX echo ===LINUX===
echo
mkdir -p linux/ mkdir -p linux/
cp -r /home/frc/Bureau/frc/dev/love/linux/ . cp -r /home/frc/Bureau/frc/dev/love/linux/ .
cat "linux/bin/love" "out/AKULIVIK.love" > "linux/bin/AKULIVIK" cat "linux/bin/love" "out/AKULIVIK.love" > "linux/bin/AKULIVIK"
@ -28,8 +34,16 @@ rm linux/bin/love
rm linux/love.svg rm linux/love.svg
cp AKULIVIK.desktop linux/love.desktop cp AKULIVIK.desktop linux/love.desktop
cp favicon.png linux/AKULIVIK.png cp favicon.png linux/AKULIVIK.png
cat licence.txt linux/license.txt > linux/license.txt cat licence.txt >> linux/license.txt
cp AppRun linux/AppRun cp AppRun linux/AppRun
/home/frc/Bureau/frc/dev/love/appimagetool-x86_64.AppImage linux/ out/AKULIVIK.AppImage /home/frc/Bureau/frc/dev/love/appimagetool-x86_64.AppImage linux/ out/ᐊᑯᓕᕕᒃ.AppImage
echo MACOS echo ===MACOS===
echo
mkdir -p macos/
cp -r /home/frc/Bureau/frc/dev/love/love.app/. macos/AKULIVIK.app
cp out/AKULIVIK.love macos/AKULIVIK.app/Contents/Resources
cp Info.plist macos/AKULIVIK.app/Contents/Info.plist
cd macos/
zip -9 -r -y "../out/ᐊᑯᓕᕕᒃ-mac.zip" AKULIVIK.app
cd ../

View File

@ -0,0 +1,79 @@
local lg = assert( love.graphics )
local math = math
local mat = require( "mat4" )
local DETAIL = 15
local CURVE = 45
local vertices = {}
local function radius( y )
return math.max( 0,
0.6 * math.pow( (1-y), 1/3 ) +
0.1 * math.exp( -5*y ))
end
local loops = {}
for i = 1, CURVE do loops[i] = {} end
do
local c, s = math.cos( 2*math.pi / DETAIL ), -math.sin( 2*math.pi / DETAIL )
local n = 1
local y = 0
for i, loop in ipairs( loops ) do
local x, z = 1, 0
y = y + 1 / #loops
local r = radius( y )
for j = 1, DETAIL + 1 do
--need the extra vertex so the texture wraps correctly
local u = 5 * ( j - 1 ) / DETAIL
local v = 3 * (1.0 - y) - 0.85
vertices[ n ] = { r * x, y, r * z, u, v }
loop[j] = n
n = n + 1
x, z = c*x+s*z, c*z-s*x
end
end
end
local function constructVertexMap()
local map = {}
local k = 1
for i, loop in ipairs( loops ) do
local nextLoop = loops[i+1]
if not nextLoop then return map end
for j, n in ipairs( loop ) do
map[k] = n
map[k+1] = nextLoop[j]
k=k+2
end
end
end
local bellMesh = lg.newMesh(
{--attributes
{"VertexPosition", "float", 3},
{"VertexTexCoord", "float", 2},
},
vertices,
"strip",
"static"
)
do
local c, s = math.cos( 2*math.pi / 7 ), -math.sin( 2*math.pi / 7 )
local instanceMesh = {}
local x, z = 1, 0
local r = 15
for i = 1, 7 do
instanceMesh[i] = { i / 2, r * x, r * z, (i-1)/6 }
x, z = c*x+s*z, c*z-s*x
end
bellMesh:attachAttribute( "bellInstance",
lg.newMesh({{"bellInstance","float",4}}, instanceMesh, nil, "static" ),
"perinstance" )
end
bellMesh:setVertexMap( constructVertexMap() )
return bellMesh

View File

@ -10,15 +10,15 @@ return lg.newMesh(
{-25, 0, -25, 1, {-25, 0, -25, 1,
1, 1, 1, 1, 1, 1,
0, 0, }, 0, 0, },
{25, 0, -25, 1, { -25, 0, 25, 1,
1, 1, 1, 1, 1, 1,
25, 0, }, 0, 25, },
{25, 0, 25, 1, {25, 0, 25, 1,
1, 1, 1, 1, 1, 1,
25, 25, }, 25, 25, },
{ -25, 1, 25, 1, {25, 0, -25, 1,
1, 1, 1, 1, 1, 1,
0, 25, }, 25, 0, },
}, },
"fan", "fan",
"static" "static"

View File

@ -1,17 +1,40 @@
local lg = love.graphics local lg = love.graphics
local mesh = lg.newMesh( local mesh = lg.newMesh(
{{ "VertexPosition", 3}}, {{"VertexPosition", "float", 3}},
{ {
{-1,-1,9-1}, {-1,-1,-1}, --A
{-1,-1,1}, {-1,-1, 1}, --B
{-1,1,-1}, {-1, 1,-1}, --H
{-1,1,1}, {-1, 1, 1}, --G
{1,-1,-1}, { 1,-1,-1}, --D
{1,-1,1}, { 1,-1, 1}, --C
{1,1,-1}, { 1, 1,-1}, --E
{1,1,1} { 1, 1, 1}, --F
}, },
"strip", "triangles",
"static") "static")
mesh:setVertexMap{ 4,3,7,8,5,3,1,4,2,7,6,5,2,1 } mesh:setVertexMap{
return mesh 1, 2, 3,
2, 3, 4,
3, 4, 7,
4, 7, 8,
7, 5, 8,
5, 8, 6,
8, 4, 6,
4, 6, 2,
6, 2, 5,
2, 5, 1,
5, 1, 7,
1, 7, 3,
}
local cubemap = love.graphics.newCubeImage(
{
"tex/cubemap_0.png",
"tex/cubemap_1.png",
"tex/cubemap_2.png",
"tex/cubemap_3.png",
"tex/cubemap_4.png",
"tex/cubemap_5.png",
},
{mipmaps = true} )
return { mesh = mesh, tex = cubemap }

View File

@ -2,6 +2,9 @@
local math = assert( math ) local math = assert( math )
local mat = require( "mat4" ) local mat = require( "mat4" )
local maxPitch = math.pi / 2
local speed = 2
local function logistic( x ) local function logistic( x )
return 1.0 / ( 1.0 + math.exp( x ) ) return 1.0 / ( 1.0 + math.exp( x ) )
end end
@ -32,6 +35,11 @@ function player:updateDesiredDirection( forward, left, right, back )
self.desx, self.desz = x * c + z * s, -x * s + z * c self.desx, self.desz = x * c + z * s, -x * s + z * c
end end
--[[function player:getViewDirection()
local cy, sy, cp, sp = math.cos(self.yaw), math.sin(self.yaw), math.cos( self.pitch ), math.sin( self.yaw )
return cy, sp, 1
end]]
function player:setFOV( fov ) function player:setFOV( fov )
self.proj = mat.projection( 0.05, 100, math.rad( fov or 90 ) ) self.proj = mat.projection( 0.05, 100, math.rad( fov or 90 ) )
end end
@ -42,12 +50,13 @@ end
function player:turn( dx, dy ) function player:turn( dx, dy )
self.yaw = self.yaw + dx * self.turnRate self.yaw = self.yaw + dx * self.turnRate
self.pitch = self.pitch + dy * self.turnRate self.pitch = math.min( maxPitch, math.max( -maxPitch,
self.pitch + dy * self.turnRate ))
end end
function player:update() function player:update()
self.vx = self.desx self.vx = self.desx * speed
self.vz = self.desz self.vz = self.desz * speed
self.x = self.x + self.vx * self.rate self.x = self.x + self.vx * self.rate
self.z = self.z + self.vz * self.rate self.z = self.z + self.vz * self.rate

View File

@ -5,6 +5,8 @@ local t = {}
local canvas local canvas
local shaders = { local shaders = {
matte = require( "shaders.matte" ), matte = require( "shaders.matte" ),
bell = require( "shaders.bell" ),
sky = require( "shaders.sky" ),
} }
local meshes = {} local meshes = {}
@ -21,42 +23,76 @@ function t.start()
stencil = false, stencil = false,
depth = true, depth = true,
} }
drawLists.sky = require( "models.sky" )
shaders.sky:send( "cube", drawLists.sky.tex )
end end
function t.debug() function t.debug()
isDebugging = true isDebugging = true
end end
local function sky( view )
love.graphics.push( "all" )
love.graphics.setDepthMode( "always", false )
love.graphics.setMeshCullMode( "none" )
love.graphics.setShader( shaders.sky )
local s = shaders.sky
local rot = { view[1], view[2], view[3], {0, 0, 0, 1} }
s:send( "view", "column", rot )
love.graphics.draw( drawLists.sky.mesh )
love.graphics.pop()
end
local function matte( )
local list = drawLists.matte
local shader = shaders.matte
love.graphics.setShader( shader )
for mesh in pairs( list ) do
shader:send( "mdl", "column", meshes[mesh])
love.graphics.draw( mesh )
end
end
local function bell( )
local list = drawLists.bell
local shader = shaders.bell
love.graphics.setShader( shader )
for mesh in pairs( list ) do
love.graphics.drawInstanced( mesh, 7 )
end
end
--[[function t.setViewDirection( x, y, z )
shaders.sky:send( "viewVec", {x, y, z} )
end]]
function t.draw( view, proj ) function t.draw( view, proj )
if isDebugging then if isDebugging then
end end
love.graphics.setScissor( 0, 0, love.graphics.getDimensions() )
love.graphics.setColor( 1, 1, 1, 1 )
love.graphics.push( "all" ) love.graphics.push( "all" )
love.graphics.setScissor( 0, 0, love.graphics.getDimensions() )
love.graphics.setCanvas( canvas ) love.graphics.setCanvas( canvas )
love.graphics.clear() love.graphics.clear()
love.graphics.setDepthMode( "less", true ) love.graphics.setDepthMode( "less", true )
love.graphics.replaceTransform( tf ) love.graphics.replaceTransform( tf )
love.graphics.setMeshCullMode( "back" )
for name, shader in pairs( shaders ) do for _, s in pairs( shaders ) do
love.graphics.setShader( shader ) s:send( "view", "column", view )
shader:send( "view", "column", view ) s:send( "proj", "column", proj )
shader:send( "proj", "column", proj )
for mesh in pairs( drawLists[ name ] ) do
local modelMatrix = meshes[ mesh ]
shader:send( "mdl", "column", modelMatrix )
love.graphics.draw( mesh )
end
end end
sky( view )
matte()
bell()
love.graphics.pop() love.graphics.pop()
love.graphics.setCanvas() love.graphics.setColor( 1, 1, 1, 1 )
love.graphics.setDepthMode( "always", false )
love.graphics.setShader()
love.graphics.origin()
love.graphics.draw( canvas[1] ) love.graphics.draw( canvas[1] )
if isDebugging then if isDebugging then

View File

@ -25,20 +25,18 @@ function t.play()
spike:setTexture( rockTexture ) spike:setTexture( rockTexture )
renderer.add( spike ) renderer.add( spike )
renderer.update( spike, mat.TRS( 0.3, 12, 0.3, 0, 0, 0, 4, 0, 3) ) renderer.update( spike, mat.TRS( 0.3, 12, 0.3, 0, 0, 0, 4, 0, 3) )
local bellTexture = love.graphics.newImage( "tex/bell-height.png", { mipmaps = true } )
bellTexture:setWrap( "repeat", "clampzero" )
local bell = require( "models/bell" )
bell:setTexture( bellTexture )
renderer.add( bell, "bell" )
local scene = require( "scene" ) local scene = require( "scene" )
return scene.load( t ) return scene.load( t )
end end
function t.draw() function t.draw()
--[[love.graphics.setScissor( )
love.graphics.push( "transform" )
love.graphics.scale( love.graphics.getWidth(), -love.graphics.getHeight() )
love.graphics.translate( 0, -1 )
love.graphics.translate( player.x, player.y )
love.graphics.rotate( player.yaw )
love.graphics.scale( w, h )
love.graphics.draw( playerMesh )
love.graphics.pop()]]
renderer.draw( player.view, player.proj ) renderer.draw( player.view, player.proj )
@ -64,12 +62,15 @@ function t.update( dt )
love.keyboard.isScancodeDown( settings.keyBack.val ) love.keyboard.isScancodeDown( settings.keyBack.val )
) )
updateTimeRemaining = updateTimeRemaining + dt updateTimeRemaining = updateTimeRemaining + dt
while updateTimeRemaining >= player.rate do while updateTimeRemaining >= player.rate do
updateTimeRemaining = updateTimeRemaining - player.rate updateTimeRemaining = updateTimeRemaining - player.rate
player:update() player:update()
end end
--renderer.setViewDirection( player:getViewDirection() )
end end
function t.mousepressed( x, y, button, isTouch, presses ) function t.mousepressed( x, y, button, isTouch, presses )

32
src/shaders/bell.lua Normal file
View File

@ -0,0 +1,32 @@
return love.graphics.newShader[[
#define fog vec4( 0.85, 0.85, 1.0, 1.0 )
#define fogHigh vec4( 1.0, 1.0, 0.85, 1.0 )
varying float depth;
varying float height;
varying float instanceColor;
#ifdef VERTEX
//per instance: (uniform) scale and xz position
attribute vec4 bellInstance;
uniform mat4 view;
uniform mat4 proj;
vec4 position( mat4 _, vec4 pos ){
instanceColor = bellInstance.a;
pos.xyz *= bellInstance.r;
pos.xz += bellInstance.gb;
height = pos.y;
vec4 eye = view * pos;
depth = -eye.z;
return proj*eye;
}
#endif
#ifdef PIXEL
vec4 effect( vec4 color, Image tex, vec2 texuv, vec2 scruv) {
vec4 bellColor = mix( vec4(1.0,1.0,1.0,1.0), vec4(0.2,0.0,0.0,1.0), instanceColor );
return vec4(
mix( mix( bellColor * color * Texel( tex, texuv ), fog,
clamp( depth / 20.0, 0.0, 1.0)), fogHigh,
clamp( height / 20.0, 0.0, 1.0)).rgb,
1.0 );
}
#endif
]]

0
src/shaders/ground.lua Normal file
View File

View File

@ -1,6 +1,6 @@
return love.graphics.newShader[[ return love.graphics.newShader[[
#define fog vec4( 0.85, 0.85, 1.0, 1.0 ) #define fog vec4( 0.85, 0.85, 1.0, 1.0 )
#define fogHigh vec4( 1.0, 1.0, 0.85, 1.0 ) #define fogHigh vec4( 1.0, 1.0, 0.9, 1.0 )
varying float depth; varying float depth;
varying float height; varying float height;
#ifdef VERTEX #ifdef VERTEX

View File

@ -1,18 +1,21 @@
return love.graphics.newShader[[ return love.graphics.newShader[[
#define fog vec4( 0.85, 0.85, 1.0, 1.0 )
varying vec3 viewDir; varying vec3 viewDir;
#ifdef VERTEX #ifdef VERTEX
uniform mat4 view; uniform mat4 view;
uniform mat4 proj; uniform mat4 proj;
vec4 position( mat4 _, vec4 pos ){ vec4 position( mat4 _, vec4 pos ){
vec4 eye = view * pos; viewDir = pos.xyz;
viewDir = eye.xyz; viewDir.y -= 0.5;
return proj*eye; return proj*view*pos;
} }
#endif #endif
#ifdef PIXEL #ifdef PIXEL
uniform samplerCube cube; uniform samplerCube cube;
vec4 effect( vec4 color, Image _, vec2 __, vec2 ___) { vec4 effect( vec4 color, Image _, vec2 __, vec2 ___) {
return Texel( cube, viewDir ); return mix( fog,
Texel( cube, viewDir ),
dot(viewDir, vec3(0.0, 1.0, 0.0 )));;
} }
#endif #endif
]] ]]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 598 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 579 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 605 KiB