-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
1,178 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.* | ||
!.git* | ||
/lua51* | ||
/profiling | ||
savedir | ||
/log* | ||
import | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
|
||
-- luacheck: globals love | ||
|
||
local SWITCHER = require 'infra.switcher' | ||
local Class = require 'steaming.extra_libs.hump.class' | ||
|
||
local Profiler = Class{} | ||
|
||
local SAMPLES = 10 | ||
|
||
function Profiler:init() | ||
self.profiling = {} | ||
self.last_state = nil | ||
self.output = io.open("profiling", "w") | ||
end | ||
|
||
function Profiler:update(dt) | ||
local GS = require 'gamestates' | ||
local state = self.last_state | ||
self.last_state = SWITCHER.current() | ||
if state then | ||
local name = "???" | ||
for k,v in pairs(GS) do | ||
if v == state then | ||
name = k | ||
break | ||
end | ||
end | ||
if dt > 0.2 then | ||
local warning = ("%.2f lag on state %s at frame %d\n"):format( | ||
dt, name, GS[name].frame or -1 | ||
) | ||
self.output:write(warning) | ||
print(warning) | ||
for mark, slice in pairs(self.slices) do | ||
self.output:write(("%16s: %.3f\n"):format(mark, 1000*slice)) | ||
end | ||
end | ||
local sample = self.profiling[name] or { times = {} , n = 1 } | ||
sample.times[sample.n] = dt | ||
sample.n = (sample.n % SAMPLES) + 1 | ||
self.profiling[name] = sample | ||
end | ||
self:start() | ||
end | ||
|
||
function Profiler:start() | ||
self.started_at = love.timer.getTime() | ||
self.slices = {} | ||
end | ||
|
||
function Profiler:mark(name) | ||
if not self.slices then return end | ||
local t = love.timer.getTime() | ||
local dt = t - self.started_at | ||
self.started_at = t | ||
self.slices[name] = (self.slices[name] or 0) + dt | ||
end | ||
|
||
local function average(sample) | ||
local sum = 0 | ||
for _,time in ipairs(sample.times) do | ||
sum = sum + time | ||
end | ||
return sum / math.max(#sample.times, SAMPLES) | ||
end | ||
|
||
function Profiler:draw() | ||
local g = love.graphics | ||
g.push() | ||
g.origin() | ||
g.setColor(1,1,1) | ||
local i = 0 | ||
for name,sample in pairs(self.profiling) do | ||
g.print(("%s: %.2f"):format(name, 1 / average(sample)), 32, 32+i*32) | ||
i = i + 1 | ||
end | ||
g.pop() | ||
end | ||
|
||
return Profiler() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"behavior":"player", | ||
"extends":"brawler", | ||
"initial_buffer":[{ | ||
"amount":8, | ||
"card":"strike" | ||
}], | ||
"traits":[], | ||
"signature":false, | ||
"collection":false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"ani":2, | ||
"arc":-2, | ||
"behavior":"idle", | ||
"cor":2, | ||
"initial_buffer":[], | ||
"name":"Tutorial", | ||
"traits":[], | ||
"extends":false, | ||
"signature":false, | ||
"collection":false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"appearance":"demobody", | ||
"drops":[], | ||
"efc":-2, | ||
"faction":"agressive", | ||
"fin":-2, | ||
"name":"Obstacle", | ||
"res":2, | ||
"extends":false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"appearance":"slime", | ||
"drops":[], | ||
"efc":2, | ||
"extends":"slime", | ||
"faction":"agressive", | ||
"name":"Old Slime", | ||
"res":-2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"bootstrap":{ | ||
"h":20, | ||
"mh":0, | ||
"mw":0, | ||
"w":20 | ||
}, | ||
"fixed_layout":{ | ||
"drops":[], | ||
"encounters":[{ | ||
"body-specname":"npc-welcome", | ||
"pos":[6,7], | ||
"actor-specname":false | ||
},{ | ||
"body-specname":"npc-veteran-3", | ||
"pos":[11,12], | ||
"actor-specname":false | ||
},{ | ||
"body-specname":"npc-farewell", | ||
"pos":[10,4], | ||
"actor-specname":false | ||
}], | ||
"map":{ | ||
"data":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,1,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,3,3,3,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,1,1,3,3,3,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,1,1,3,3,3,3,2,3,3,3,3,2,2,2,3,3,3,3,3,3,1,1,3,3,2,2,2,2,2,3,3,2,2,2,3,3,3,3,3,3,1,1,3,3,2,2,2,2,2,3,3,2,2,2,3,3,3,3,3,3,1,1,3,3,2,2,4,2,2,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1], | ||
"height":20, | ||
"width":20 | ||
}, | ||
"offset":[0,0], | ||
"player-pos":[5,14] | ||
}, | ||
"theme":false | ||
} |
Oops, something went wrong.