Compare commits

..

1 Commits

Author SHA1 Message Date
Ross 56786e7a07 rename debug terminal to console 2025-08-19 13:49:04 +01:00
609 changed files with 1381710 additions and 38592 deletions
-4
View File
@@ -4,7 +4,3 @@
loop.cabal
*.lock
keys.json
log/*
generated/*
tags
ghcidOutput
-70
View File
@@ -1,70 +0,0 @@
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################
# This file contains a template configuration file, which is typically
# placed as .hlint.yaml in the root of your project
# Specify additional command line arguments
#
# - arguments: [--color, --cpp-simple, -XQuasiQuotes]
# Control which extensions/flags/modules/functions can be used
#
# - extensions:
# - default: false # all extension are banned by default
# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
#
# - flags:
# - {name: -w, within: []} # -w is allowed nowhere
#
# - modules:
# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
#
# - functions:
# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
# Add custom hints for this project
#
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
# The hints are named by the string they display in warning messages.
# For example, if you see a warning starting like
#
# Main.hs:116:51: Warning: Redundant ==
#
# You can refer to that hint with `{name: Redundant ==}` (see below).
# Turn on hints that are off by default
#
# Ban "module X(module X) where", to require a real export list
#- warn: {name: Use explicit module export list} # TODO uncomment
#
# Replace a $ b $ c with a . b $ c
#- group: {name: dollar, enabled: true} # TODO uncomment
#
# Generalise map to fmap, ++ to <>
#- group: {name: generalise, enabled: true} # TODO uncomment
#
# Warn on use of partial functions
# - group: {name: partial, enabled: true} # possibly uncomment
- group: {name: use-lens, enabled: true}
# Ignore some builtin hints
# - ignore: {name: Use let}
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
# Define some custom infix operators
# - fixity: infixr 3 ~^#^~
# To generate a suitable file for HLint do:
# $ hlint --default > .hlint.yaml
+3
View File
@@ -0,0 +1,3 @@
# Changelog for loop
## Unreleased changes
+1
View File
@@ -0,0 +1 @@
# loop
+21 -18
View File
@@ -1,30 +1,39 @@
module Main (main) where
module Main (
main,
) where
import Dodge.SoundSelection
import Control.Lens
import Control.Monad
import Control.Parallel
import qualified Data.Map.Strict as M
--import Data.Preload.Render
import qualified Data.Text as T
import Dodge.Concurrent
import Dodge.Config
import Dodge.Config.Load
import Dodge.Config.Update
import Dodge.Data
import Dodge.Event
import Dodge.Initialisation
import Dodge.LoadSeed
import Dodge.Menu
import Dodge.Render
import Dodge.SoundLogic.LoadSound
import Dodge.StartNewGame
import Dodge.TestString
import Dodge.Update
--import qualified IntMapHelp as IM
import Loop
--import Picture
import Preload
import Preload.Render
--import Render
import SDL (($=))
import qualified SDL
--import qualified SDL.Mixer as Mix
import Sound
import System.Directory
main :: IO ()
main = do
-- load the config to get the window size and position
@@ -65,7 +74,7 @@ winConfig x y winpos =
theCleanup :: Universe -> IO ()
theCleanup uv = SDL.cursorVisible $= True >> cleanUpPreload (_preloadData uv)
firstWorldLoad :: Config -> IO Universe
firstWorldLoad :: Configuration -> IO Universe
firstWorldLoad theConfig = do
SDL.cursorVisible $= False
pdata <- doPreload >>= applyWorldConfig theConfig
@@ -88,28 +97,22 @@ firstWorldLoad theConfig = do
, _uvDebug = mempty
, _uvDebugFloat1 = 10
, _uvDebugFloat2 = 0
, _uvDebugV2_1 = 0
, _uvDebugV2_2 = 1
, _uvDebugPut = mempty
, _uvDebugMessageOffset = 0
, _uvSoundQueue = mempty
, _uvDebugPathShowType = PathBetweenDebugV2s
}
--return $ u & uvScreenLayers .~ [splashMenu u]
return $ startNewGameInSlot 0 u
return $ u & uvScreenLayers .~ [splashMenu u]
theUpdateStep :: SDL.Window -> Universe -> IO Universe
theUpdateStep win = doSideEffects <=< updateRenderSplit win
updateRenderSplit :: SDL.Window -> Universe -> IO Universe
updateRenderSplit win u = do
--updateUniverse u `par` void (doDrawing win u)
updateUniverse u `par` doDrawing win u
updateUniverse u `par` void (doDrawing win u)
return $! updateUniverse u
playSoundUnlessRewinding :: Universe -> IO (M.Map SoundOrigin Sound)
playSoundUnlessRewinding u = case w ^. timeFlow of
NormalTimeFlow -> playSoundAndUpdate (_soundData $ _preloadData u) (_playingSounds w) (newSoundsToPlay u)
NormalTimeFlow -> playSoundAndUpdate (_soundData $ _preloadData u) (_playingSounds w) (_toPlaySounds w)
_ -> stopAllSounds >> return M.empty
where
w = _uvWorld u
@@ -136,13 +139,13 @@ doPreload = do
putStrLn "Start sound preload"
lChunks <- loadSounds
putStrLn "Skip music preload!"
-- lMusic <- loadMusic
-- Mix.playMusic Mix.Forever (lMusic IM.! 0)
-- lMusic <- loadMusic
-- Mix.playMusic Mix.Forever (lMusic IM.! 0)
putStrLn "Return PreloadData"
return
PreloadData
{ _renderData = rData
, _soundData = lChunks
, --, _musicData = MusicData{_loadedMusic = lMusic}
_musicData = mempty
--, _musicData = MusicData{_loadedMusic = lMusic}
, _musicData = mempty
}
+483
View File
@@ -0,0 +1,483 @@
{- |
Weapon effects when pulling the trigger. -}
module Dodge.Item.Weapon.TriggerType
where
import Dodge.Data
import Dodge.SoundLogic
import Dodge.Creature.Action (startReloadingWeapon)
import Dodge.WorldEvent (muzzleFlashAt,tempLightForAt)
import Dodge.WorldEvent.Cloud
import Dodge.RandomHelp
import Dodge.Particle.Bullet.Spawn
import Dodge.Item.Attachment.Data
import Dodge.Item.Data
import Geometry
import System.Random
import Control.Lens
import Control.Monad.State
import Data.Maybe
import qualified Data.IntMap.Strict as IM
import Data.Foldable
withThinSmoke
:: (Creature -> World -> World) -- ^ Underlying effect
-> Creature
-> World
-> World
withThinSmoke eff cr w = eff cr $ foldl' (flip $ makeThinSmokeAt . (+.+ pos)) w ps
where
dir = _crDir cr
pos = _crPos cr +.+ (_crRad cr +0.5) *.* unitVectorAtAngle dir
ps = (replicateM 5 . randInCirc) 8 & evalState $ _randGen w
withThickSmoke
:: (Creature -> World -> World) -- ^ Underlying effect
-> Creature
-> World
-> World
withThickSmoke eff cr w = eff cr $ foldl' (flip $ makeThickSmokeAt . (+.+ pos)) w ps
where
dir = _crDir cr
pos = _crPos cr +.+ (_crRad cr + 15) *.* unitVectorAtAngle dir
ps = (replicateM 20 . randInCirc) 8 & evalState $ _randGen w
{- |
Fires at an increasing rate.
Has different effect after first fire.
Applies ammo check and use cooldown check. -}
rateIncAB
:: Int -- ^ Start rate
-> Int -- ^ End rate
-> (Creature -> World -> World) -- ^ Effect on first fire
-> (Creature -> World -> World) -- ^ Effect on continued fire
-> Creature -- ^ Creature id
-> World
-> World
rateIncAB startRate fastRate shooteff1 shooteff2 cr w
| repeatFire = w
& pointItem %~ ( (itUseRate .~ max fastRate (currentRate - 1))
. (wpLoadedAmmo -~ 1)
. (itUseTime .~ currentRate) )
& shooteff2 cr
| firstFire = w
& pointItem %~ ( (itUseRate .~ startRate - 1)
. (wpLoadedAmmo -~ 1)
. (itUseTime .~ startRate) )
& shooteff1 cr
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
| otherwise = w
where
cid = _crID cr
itRef = _crInvSel cr
item = _crInv cr IM.! itRef
pointItem = creatures . ix cid . crInv . ix itRef
currentRate = _itUseRate item
repeatFire = _wpReloadState item == 0
&& _itUseTime item == 1
&& _wpLoadedAmmo item > 0
firstFire = _wpReloadState item == 0
&& _itUseTime item == 0
&& _wpLoadedAmmo item > 0
reloadCondition = _wpLoadedAmmo item == 0
{- |
Shoot a weapon rapidly after a warm up.
Applies ammo check as well. -}
withWarmUp
:: Int -- ^ Warm up time (in frames)
-> (Creature -> World -> World)
-- ^ Shoot effect
-> Creature
-> World
-> World
withWarmUp t f cr w
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
| _wpReloadState item /= 0 = w
| fState == 0 = w
& pointerToItem %~ ( (itUse .~ (\_ -> withWarmUp 100 f)) . (itUseTime .~ 2) )
| t > 2 = w
& pointerToItem %~ ( (itUse .~ (\_ -> withWarmUp (t-1) f)) . (itUseTime .~ 2) )
& soundFrom (CrWeaponSound cid) 26 2 0
| t > 0 = w
& pointerToItem %~ ( (itUse .~ (\_ -> withWarmUp (t-1) f)) . (itUseTime .~ 2) )
| otherwise = w
& pointerToItem %~ ( (itUse .~ (\_ -> withWarmUp 1 f)) . (wpLoadedAmmo -~ 1) . (itUseTime .~ 2) )
& f cr
& soundFrom (CrWeaponSound cid) 28 2 0
where
cid = _crID cr
itRef = _crInvSel cr
item = _crInv cr IM.! itRef
pointerToItem = creatures . ix cid . crInv . ix itRef
fState = _itUseTime item
reloadCondition = _wpLoadedAmmo item == 0
{- | Adds a sound to a creature based world effect.
The sound is emitted from the creature's position. -}
withSound
:: Int -- ^ Sound id
-> (Creature -> World -> World) -- ^ Underlying effect
-> Creature
-> World -> World
withSound soundid f cr = soundOncePos soundid (_crPos cr) . f cr
withRecoil
:: Float -- ^ Recoil amount
-> (Creature -> World -> World)
-- ^ Underlying world effect, takes creature id as input
-> Creature
-> World -> World
withRecoil recoilAmount eff cr = eff cr . over (creatures . ix cid) pushback
where
cid = _crID cr
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((-recoilAmount) / _crMass cr ) 0))
{- | Pushes a creature sideways by a random amount.
Applied before the underlying effect. -}
withSidePush
:: Float -- ^ Maximal possible side push amount
-> (Creature -> World -> World)
-- ^ Underlying world effect, takes creature id as input
-> Creature
-> World -> World
withSidePush maxSide eff cr w = eff cr . over (creatures . ix cid) push $ w
where
cid = _crID cr
push = over crPos (+.+ rotateV (_crDir cr) (V2 0 (pushAmount / _crMass cr)))
(pushAmount, _) = randomR (-maxSide,maxSide) $ _randGen w
-- consider unifying the pushes using a direction vector
{- | Pushes a creature sideways by a random amount.
Applied after the underlying effect. -}
withSidePushAfter
:: Float -- ^ Maximal possible side push amount
-> (Creature -> World -> World)
-- ^ Underlying world effect, takes creature id as input
-> Creature -- ^ Creature id
-> World -> World
withSidePushAfter maxSide eff cr w = over (creatures . ix cid) push . eff cr $ w
where
cid = _crID cr
push = over crPos (+.+ rotateV (_crDir cr) (V2 0 (pushAmount / _crMass cr)))
(pushAmount, _) = randomR (-maxSide,maxSide) $ _randGen w
{- | Applies a world effect and sound effect after an ammo check. -}
shootWithSound
:: Int -- ^ Sound identifier
-> (Creature -> World -> World)
-- ^ Shoot effect, takes creature id as input
-> Creature
-> World
-> World
shootWithSound soundid f cr w
| fireCondition = over (pointerToItem . wpLoadedAmmo) (\ammo -> ammo-1)
$ soundOncePos soundid (_crPos cr)
$ set (pointerToItem . itUseTime) (_itUseRate item)
$ f cr w
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
| otherwise = w
where
cid = _crID cr
itRef = _crInvSel cr
item = _crInv cr IM.! itRef
pointerToItem = creatures . ix cid . crInv . ix itRef
fireCondition = _wpReloadState item == 0
&& _itUseTime item == 0
&& _wpLoadedAmmo item > 0
reloadCondition = _wpLoadedAmmo item == 0
{- | Applies a world effect and sound effect after an ammo check. -}
shootWithSoundI
:: Int -- ^ Sound identifier
-> (Item -> Creature -> World -> World)
-- ^ Shoot effect, takes creature id as input
-> Item
-> Creature
-> World
-> World
shootWithSoundI soundid f item cr w
| fireCondition = over (pointerToItem . wpLoadedAmmo) (\ammo -> ammo-1)
$ soundOncePos soundid (_crPos cr)
$ set (pointerToItem . itUseTime) (_itUseRate item)
$ f item cr w
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
| otherwise = w
where
cid = _crID cr
itRef = _crInvSel cr
pointerToItem = creatures . ix cid . crInv . ix itRef
fireCondition = _wpReloadState item == 0
&& _itUseTime item == 0
&& _wpLoadedAmmo item > 0
reloadCondition = _wpLoadedAmmo item == 0
{- |
Applies a world effect after an item use cooldown check. -}
useTimeCheck
:: (Creature -> World -> World) -- ^ Underlying effect
-> Creature
-> World
-> World
useTimeCheck f cr w = case theItem ^? itUseTime of
Just 0 -> f cr $ setUseTime w
_ -> w
where
cid = _crID cr
setUseTime = creatures . ix cid . crInv . ix (_crInvSel cr) . itUseTime +~ useRate
theItem = _crInv cr IM.! _crInvSel cr
useRate = fromMaybe 0 $ theItem ^? itUseRate
{- | Applies a world effect after a hammer position check. -}
hammerCheck
:: (Creature -> World -> World) -- ^ Underlying effect
-> Creature
-> World
-> World
hammerCheck f cr w = case (_crInv cr IM.! _crInvSel cr) ^? itHammer of
Just HammerUp -> f cr $ setHammerDown w
_ -> setHammerDown w
where
cid = _crID cr
setHammerDown = creatures . ix cid . crInv . ix (_crInvSel cr) . itHammer .~ HammerDown
{- | Applies a world effect after a hammer position check. -}
hammerCheckI
:: (Item -> Creature -> World -> World) -- ^ Underlying effect
-> Item
-> Creature
-> World
-> World
hammerCheckI f it cr w = case it ^? itHammer of
Just HammerUp -> f it cr $ setHammerDown w
_ -> setHammerDown w
where
cid = _crID cr
setHammerDown = creatures . ix cid . crInv . ix (_crInvSel cr) . itHammer .~ HammerDown
{- | Applies a world effect after an ammo check. -}
shoot
:: (Creature -> World -> World)
-- ^ Underlying effect
-> Creature
-> World
-> World
shoot f cr w
| fireCondition = f cr w & pointerToItem %~
( (wpLoadedAmmo -~ 1) . (itUseTime .~ _itUseRate item) )
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
| otherwise = w
where
cid = _crID cr
itRef = _crInvSel cr
item = _crInv cr IM.! itRef
pointerToItem = creatures . ix cid . crInv . ix itRef
fireCondition = _wpReloadState item == 0
&& _itUseTime item == 0
&& _wpLoadedAmmo item > 0
reloadCondition = _wpLoadedAmmo item == 0
{- | Applies a world effect after a hammer position check.
Arbitrary inventory position. -}
hammerCheckL
:: (Creature -> Int -> World -> World) -- ^ Underlying effect
-> Creature
-> Int
-> World
-> World
hammerCheckL f cr invid w = case (_crInv cr IM.! invid) ^? itHammer of
Just HammerUp -> f cr invid $ setHammerDown w
_ -> setHammerDown w
where
cid = _crID cr
setHammerDown = creatures . ix cid . crInv . ix invid . itHammer .~ HammerDown
{- | Applies a world effect after an ammo check.
Arbitrary inventory position. -}
shootL
:: (Creature -> Int -> World -> World)
-- ^ Underlying effect
-> Creature
-> Int -- ^ Inventory position
-> World
-> World
shootL f cr invid w
| fireCondition = f cr invid w & pointerToItem %~
( (wpLoadedAmmo -~ 1) . (itUseTime .~ _itUseRate item) )
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
| otherwise = w
where
cid = _crID cr
item = _crInv cr IM.! invid
pointerToItem = creatures . ix cid . crInv . ix invid
fireCondition = _wpReloadState item == 0
&& _itUseTime item == 0
&& _wpLoadedAmmo item > 0
reloadCondition = _wpLoadedAmmo item == 0
withMuzFlare
:: (Creature -> World -> World) -- ^ Underlying effect
-> Creature
-> World
-> World
withMuzFlare f cr w = tempLightForAt 3 pos . muzzleFlashAt pos2 $ f cr w
where
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
pos2 = _crPos cr +.+ (2 * _crRad cr) *.* unitVectorAtAngle (_crDir cr)
withMuzFlareI
:: (Item -> Creature -> World -> World) -- ^ Underlying effect
-> Item
-> Creature
-> World
-> World
withMuzFlareI f it cr w = tempLightForAt 3 pos . muzzleFlashAt pos2 $ f it cr w
where
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
pos2 = _crPos cr +.+ (2 * _crRad cr) *.* unitVectorAtAngle (_crDir cr)
{- | Applies the effect to a randomly rotated creature. -}
withRandomDir
:: Float -- ^ Max possible rotation
-> (Creature -> World -> World)
-- ^ Underlying effect
-> Creature
-> World
-> World
withRandomDir acc f cr w = f (cr & crDir +~ a) $ set randGen g w
where
(a, g) = randomR (-acc,acc) $ _randGen w
{- | Applies the effect to a randomly rotated creature. -}
withRandomDirI
:: Float -- ^ Max possible rotation
-> (Item -> Creature -> World -> World)
-- ^ Underlying effect
-> Item
-> Creature
-> World
-> World
withRandomDirI acc f it cr w = f it (cr & crDir +~ a) $ set randGen g w
where
(a, g) = randomR (-acc,acc) $ _randGen w
{- | Creates a bullet with a given velocity, width, and 'HitEffect' -}
withVelWthHiteff
:: Point2 -- ^ Velocity, x direction is forward with respect to the creature
-> Float -- ^ Bullet width
-> HitEffect -- ^ Bullet effect when hitting creature, wall etc
-> Creature -- ^ Creature id
-> World
-> World
withVelWthHiteff vel width hiteff cr = over particles (newbul : )
where
cid = _crID cr
newbul = aGenBulAt (Just cid) pos (rotateV dir vel) hiteff width
dir = _crDir cr
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
{- | Apply the effect to a translated creature. -}
withRandomOffset
:: Float -- ^ Max possible translate
-> (Creature -> World -> World)
-- ^ Underlying effect
-> Creature
-> World
-> World
withRandomOffset offsetAmount f cr w = f (cr & crPos %~ (+.+ offV)) $ set randGen g w
where
(offsetVal , g) = randomR (-offsetAmount,offsetAmount) $ _randGen w
offV = rotateV (_crDir cr) (V2 0 offsetVal)
-- | Rotates a creature with minimum rotation at least 0.1.
-- Rotates the player creature before applying the effect, other creatures after.
torqueBeforeForced
:: Float -- ^ Max possible rotation (less the 0.1 forced rotation)
-> (Creature -> World -> World)
-- ^ Underlying effect
-> Creature
-> World
-> World
torqueBeforeForced torque feff cr w
| cid == 0 = feff (cr & crDir +~ rot') $ w
& randGen .~ g
& creatures . ix cid . crDir +~ rot'
& cameraRot +~ rot'
| otherwise = feff cr $ set randGen g $ over (creatures . ix cid . crDir) (+rot') w
where
cid = _crID cr
(rot, g) = randomR (-torque,torque) $ _randGen w
rot' | rot < 0 = rot - 0.1
| otherwise = rot + 0.1
-- | Rotates the player creature before applying an effect.
-- Note this currently (29/4/2021) rotates other creatures /after/ applying the effect.
torqueBefore
:: Float -- ^ Max possible rotation
-> (Creature -> World -> World) -- ^ Underlying effect
-> Creature -- ^ Creature id
-> World
-> World
torqueBefore torque feff cr w
| cid == 0 = feff (cr & crDir +~ rot) $ w
& randGen .~ g
& creatures . ix cid . crDir +~ rot
& cameraRot +~ rot
| otherwise = set randGen g $ over (creatures . ix cid . crDir) (+rot) $ feff cr w
where
cid = _crID cr
(rot, g) = randomR (-torque,torque) $ _randGen w
-- | Rotate a randomly creature after applying an effect.
torqueAfter
:: Float -- ^ Max possible rotation
-> (Creature -> World -> World) -- ^ Underlying effect
-> Creature -- ^ Creature id
-> World
-> World
torqueAfter torque feff cr w
| cid == 0 = rotateScope $ set randGen g $ over cameraRot (+rot) $ feff cr w
| otherwise = set randGen g $ over (creatures . ix cid . crDir) (+rot) $ feff cr w
where
cid = _crID cr
(rot, g) = randomR (-torque,torque) $ _randGen w
rotateScope = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
. itAttachment . _Just . scopePos %~ rotateV rot
{- | Create multiple bullets with a given spread, a given amount, given velocity,
given width and given 'HitEffect'. -}
spreadNumVelWthHiteff
:: Float -- ^ Spread
-> Int -- ^ Number of bullets
-> Point2 -- ^ Velocity, x is direction of creature
-> Float -- ^ Bullet width
-> HitEffect -- ^ Effect when hitting creature, wall etc
-> Creature -- ^ Creature id
-> World
-> World
spreadNumVelWthHiteff spread num vel wth eff cr w = over particles (newbuls ++) w
where
cid = _crID cr
newbuls = zipWith
(\pos d -> aGenBulAt (Just cid) pos (rotateV d vel) eff wth)
poss dirs
poss = map ((+.+) $ _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr))
$ (replicateM num . randInCirc) 5 & evalState $ _randGen w
dirs = map (_crDir cr +) $ zipWith (+)
[-spread,-spread+(2*spread/fromIntegral num)..]
(randomRs (0,spread/5) (_randGen w))
{- | Create a number of bullets side by side with a given velocity,
given width and given 'HitEffect'. -}
numVelWthHitEff
:: Int -- ^ Amount of bullets
-> Point2 -- ^ Velocity, x axis is direction of creature
-> Float -- ^ Bullet width
-> HitEffect -- ^ Effect when hitting creature, wall etc
-> Creature
-> World
-> World
numVelWthHitEff num vel wth eff cr = over particles (newbuls ++)
where
cid = _crID cr
newbuls = map (\p -> aGenBulAt (Just cid) p (rotateV d vel) eff wth) poss
d = _crDir cr
poss = map (+.+ pos) $ take num offsets
maxOffset = fromIntegral num * 2.5 - 2.5
offsets = map (rotateV d . V2 0) [-maxOffset,5-maxOffset..]
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle d
{- | Uses '_wpSpread' as a parameter for the current offset angle. -}
randWalkAngle
:: Float -- ^ Max offset angle
-> Float -- ^ Walk speed
-> (Creature -> World -> World) -- ^ Underlying effect
-> Creature -- ^ Creature id
-> World
-> World
randWalkAngle ma aspeed f cr w = w
& f (cr & crDir +~ a)
& creatures . ix cid . crInv . ix i . wpSpread .~ newa
where
cid = _crID cr
a = _wpSpread $ _crInv (_creatures w IM.! cid) IM.! i
(walka, _) = randomR (-aspeed,aspeed) (_randGen w)
newa = min ma $ max (negate ma) (a + walka)
i = _crInvSel $ _creatures w IM.! cid
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

+2 -1
View File
@@ -1,7 +1,8 @@
{
"_debug_booleans": [
"Show_ms_frame",
"Pathing"
"Mouse_position",
"Collision_test"
],
"_debug_view_clip_bounds": "NoRoomClipBoundaries",
"_gameplay_rotate_to_wall": true,
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-40
View File
@@ -1,40 +0,0 @@
The cortical interface is an incredible interdisciplinary breakthrough
in neurophysiology and computer science.
It allows clients to directly receive information transmitted wirelessly.
We expect this to allow for better, faster learning, allowing
humans to reach unheard of levels of knowledge and ability.
Non-human animal trials did not appear to reduce lifespans significantly.
Human trials are now in progress.
I hate the way the interface just dumps information on you.
The way time just seems to stop...
makes me feel sick.
I heard @name downloaded War and Peace,
but didn't expect it to be in russian.
Took him a week to recover.
What's the deal with the cortical interface?
So, like, what happens if I constantly request info dumps?
Does that mean I live forever?
Temporal distortion is a common side effect when using the cortical interface.
Information is processed near instantaneously, causing other
external events to appear paused.
The cortical interface has some neat uses.
I set up a timer to remind me of our anniversary.
It's great, the AI even suggested the perfect present!
Mood disorders.
Anxiety.
Epilepsy.
Dizzyness, nauseau, tinitus.
Autism.
Schizoprenia.
@@ -1,18 +0,0 @@
Where am I? What year is this? When is this?,Error: Impossible to determine. Cannot resolve with known frame. Presumed outside Earth light cone.
What is this place?,Central hub. Corrupted zones have been sealed off.
Who am I?,"Error: Unkown referent: “I”. Cannot determine what “I” refers to. Possible partial referent: Biological form generated x miliseconds. Partial list features: torso, four limbs, head w/ partial configuration of scanned data."
Who are you?,"Error: Unknown referent: “you”. Terminal connected distributed system, unknown extent."
What should I do?,Error: Unknown objective function. Module “Cat.Imperative” missing.
Are you an AI?,"Terminal connected to distributed system, unkown extent. Can generate respose to finite queries."
How did I get here?,Generated from blueprints and brain scan transmitted in unkown past.
Can you heal me?,Full regeneration upon termination in areas external to central hub. WARNING: Cannot regenerate upon termination within central hub.
What can you do?,"Item synthesis in terminal (over there), requires blueprint. Transport to defective zones."
What are my capabilities?,Err. Basic movement and item acquisition. Items confer new capabilities. WARNING: carry capacity restricted.
How do I get more powerful?,Carry capacity restoration possible: acquire module through door to north.
What is through that door?,Error: Cannot exhaustively describe location.
Can you be less useful?,"Error: No objective function, try “set verbose”. Cannot determine utility of response."
What are your capabilities?,Error: Parse “your → you”: Unknown referent “you”.
,Error: Parse fail
Do you have memory/hard drive?,All events logged with error correction. Future corruption inevitable. Unkown total bits of storage used/available across network.
How long have you existed?,System clock: (random number) + game time
What seed?,
1 Where am I? What year is this? When is this? Error: Impossible to determine. Cannot resolve with known frame. Presumed outside Earth light cone.
2 What is this place? Central hub. Corrupted zones have been sealed off.
3 Who am I? Error: Unkown referent: “I”. Cannot determine what “I” refers to. Possible partial referent: Biological form generated x miliseconds. Partial list features: torso, four limbs, head w/ partial configuration of scanned data.
4 Who are you? Error: Unknown referent: “you”. Terminal connected distributed system, unknown extent.
5 What should I do? Error: Unknown objective function. Module “Cat.Imperative” missing.
6 Are you an AI? Terminal connected to distributed system, unkown extent. Can generate respose to finite queries.
7 How did I get here? Generated from blueprints and brain scan transmitted in unkown past.
8 Can you heal me? Full regeneration upon termination in areas external to central hub. WARNING: Cannot regenerate upon termination within central hub.
9 What can you do? Item synthesis in terminal (over there), requires blueprint. Transport to defective zones.
10 What are my capabilities? Err. Basic movement and item acquisition. Items confer new capabilities. WARNING: carry capacity restricted.
11 How do I get more powerful? Carry capacity restoration possible: acquire module through door to north.
12 What is through that door? Error: Cannot exhaustively describe location.
13 Can you be less useful? Error: No objective function, try “set verbose”. Cannot determine utility of response.
14 What are your capabilities? Error: Parse “your → you”: Unknown referent “you”.
15 Error: Parse fail
16 Do you have memory/hard drive? All events logged with error correction. Future corruption inevitable. Unkown total bits of storage used/available across network.
17 How long have you existed? System clock: (random number) + game time
18 What seed?
@@ -1,9 +0,0 @@
Something has gone wrong.
My last memory is entering the reconstitution scanner.
Though experimental,
this techology theoretically allows for perfect duplication.
But there are strict rules, this would only happen if my old body is...
non-functional.
Hopefully I can take better care of this one.
+40 -40
View File
@@ -1,42 +1,42 @@
X_RANGE 11.40
Y_RANGE 20574456.00
X_RANGE 38.37
Y_RANGE 9447512.00
ORDER OTHER 1
ORDER (13951)updateEdgeWallObs 2
ORDER (14169)updateDisplaySections,updateEdgeWallObs 3
ORDER (14505)SYSTEM,updateDisplaySections,doDrawing',colCrsWalls,updateEdgeWallObs 4
ORDER (13997)updateEdgeWallObs 5
ORDER (13996)updateEdgeWallObs 6
ORDER (14223)SYSTEM,updateDisplaySections,updateEdgeWallObs 7
ORDER (14009)updateEdgeWallObs 8
ORDER (14027)updateEdgeWallObs,ix 9
ORDER (13964)SYSTEM,updateEdgeWallObs 10
ORDER (13953)updateEdgeWallObs 11
ORDER (14086)updateEdgeWallObs,ix 12
ORDER (14099)updateEdgeWallObs,ix 13
ORDER (14085)updateEdgeWallObs,ix 14
ORDER (14030)updateEdgeWallObs,ix 15
ORDER (14175)SYSTEM,updateDisplaySections,updateEdgeWallObs 16
ORDER (2)SYSTEM 17
ORDER (13952)SYSTEM,updateEdgeWallObs 18
ORDER (13941)updateEdgeWallObs 19
ORDER (14018)updateEdgeWallObs,ix 20
ORDER (157697)#..\/#./targetYouWhenCognizant/updateHumanoid/updateCreature/dimap/dimap/_Wrapped'/updateIMl'/fu... 2
ORDER (165654)updateCloud.finalPos/updateCloud/updateObjCatMaybes.(...)/updateObjCatMaybes/updateClouds/functi... 3
ORDER (165606)updateCloud.finalVel/updateCloud/updateObjCatMaybes.(...)/updateObjCatMaybes/updateClouds/functi... 4
ORDER (155261)plLineBlock.makePane/plLineBlock.makeWallAt/plLineBlock.insertBlock/plLineBlock.insertBlocks/plL... 5
ORDER (157606)#..\/#./performActions/updateHumanoid/updateCreature/dimap/dimap/_Wrapped'/updateIMl'/functional... 6
ORDER (157522)updateHumanoid/updateCreature/dimap/dimap/_Wrapped'/updateIMl'/functionalUpdate/timeFlowUpdate/u... 7
ORDER (144146)ix/crSetRoots/crUpdateItemLocations/scrollAugNextInSection/checkInventorySelectionExists/updateI... 8
ORDER (157678)chaseCritAwarenessUpdate/chaseCritPerceptionUpdate/chainCreatureUpdates.unf/chainCreatureUpdates... 9
ORDER (159529)updateExpBarrel.applyFuseDamage/updateExpBarrel.newCr/#..\/#./updateExpBarrel/updateBarreloid/up... 10
ORDER (165621)updateCloud.(...)/updateCloud/updateObjCatMaybes.(...)/updateObjCatMaybes/updateClouds/functiona... 11
ORDER (181320)#..\/#./crSetRoots.f/ix/crSetRoots/crUpdateItemLocations/scrollAugNextInSection/checkInventorySe... 12
ORDER (152512)zonePe.f/zonePe/generateLevelFromRoomList/generateWorldFromSeed/startSeedGameConc/startSeedGame/... 13
ORDER (158152)ix/updateInv/foldCr.f/foldCr/crUpdate/defaultImpulsive/updateHumanoid/updateCreature/dimap/dimap... 14
ORDER (162804)listSelectionColorPicture.g/listSelectionColorPicture/updateSection.(...)/updateSection/updateSe... 15
ORDER (181178)crUpdateInvidLocations/crUpdateItemLocations/scrollAugNextInSection/checkInventorySelectionExist... 16
ORDER (159623)ix/crCrSpring/crSpring/simpleCrSprings/functionalUpdate/timeFlowUpdate/updateUniverseMid/updateU... 17
ORDER (159633)colCrsWalls/functionalUpdate/timeFlowUpdate/updateUniverseMid/updateUniverse/updateRenderSplit/t... 18
ORDER (163282)updateCloud/updateObjCatMaybes.(...)/updateObjCatMaybes/updateClouds/functionalUpdate/timeFlowUp... 19
ORDER (157730)ix/updateInv/foldCr.f/foldCr/crUpdate/humanoidAIList/updateHumanoid/updateCreature/dimap/dimap/_... 20
SHADE OTHER 0.00
SHADE (13951)updateEdgeWallObs 0.00
SHADE (14169)updateDisplaySections,updateEdgeWallObs 0.00
SHADE (14505)SYSTEM,updateDisplaySections,doDrawing',colCrsWalls,updateEdgeWallObs 0.00
SHADE (13997)updateEdgeWallObs 0.10
SHADE (13996)updateEdgeWallObs 0.10
SHADE (14223)SYSTEM,updateDisplaySections,updateEdgeWallObs 0.10
SHADE (14009)updateEdgeWallObs 0.10
SHADE (14027)updateEdgeWallObs,ix 0.00
SHADE (13964)SYSTEM,updateEdgeWallObs 0.00
SHADE (13953)updateEdgeWallObs 0.00
SHADE (14086)updateEdgeWallObs,ix 0.00
SHADE (14099)updateEdgeWallObs,ix 0.05
SHADE (14085)updateEdgeWallObs,ix 0.05
SHADE (14030)updateEdgeWallObs,ix 0.05
SHADE (14175)SYSTEM,updateDisplaySections,updateEdgeWallObs 0.05
SHADE (2)SYSTEM 0.10
SHADE (13952)SYSTEM,updateEdgeWallObs 0.10
SHADE (13941)updateEdgeWallObs 0.10
SHADE (14018)updateEdgeWallObs,ix 0.10
SHADE (157697)#..\/#./targetYouWhenCognizant/updateHumanoid/updateCreature/dimap/dimap/_Wrapped'/updateIMl'/fu... 0.00
SHADE (165654)updateCloud.finalPos/updateCloud/updateObjCatMaybes.(...)/updateObjCatMaybes/updateClouds/functi... 0.00
SHADE (165606)updateCloud.finalVel/updateCloud/updateObjCatMaybes.(...)/updateObjCatMaybes/updateClouds/functi... 0.00
SHADE (155261)plLineBlock.makePane/plLineBlock.makeWallAt/plLineBlock.insertBlock/plLineBlock.insertBlocks/plL... 0.10
SHADE (157606)#..\/#./performActions/updateHumanoid/updateCreature/dimap/dimap/_Wrapped'/updateIMl'/functional... 0.10
SHADE (157522)updateHumanoid/updateCreature/dimap/dimap/_Wrapped'/updateIMl'/functionalUpdate/timeFlowUpdate/u... 0.10
SHADE (144146)ix/crSetRoots/crUpdateItemLocations/scrollAugNextInSection/checkInventorySelectionExists/updateI... 0.10
SHADE (157678)chaseCritAwarenessUpdate/chaseCritPerceptionUpdate/chainCreatureUpdates.unf/chainCreatureUpdates... 0.00
SHADE (159529)updateExpBarrel.applyFuseDamage/updateExpBarrel.newCr/#..\/#./updateExpBarrel/updateBarreloid/up... 0.00
SHADE (165621)updateCloud.(...)/updateCloud/updateObjCatMaybes.(...)/updateObjCatMaybes/updateClouds/functiona... 0.00
SHADE (181320)#..\/#./crSetRoots.f/ix/crSetRoots/crUpdateItemLocations/scrollAugNextInSection/checkInventorySe... 0.00
SHADE (152512)zonePe.f/zonePe/generateLevelFromRoomList/generateWorldFromSeed/startSeedGameConc/startSeedGame/... 0.05
SHADE (158152)ix/updateInv/foldCr.f/foldCr/crUpdate/defaultImpulsive/updateHumanoid/updateCreature/dimap/dimap... 0.05
SHADE (162804)listSelectionColorPicture.g/listSelectionColorPicture/updateSection.(...)/updateSection/updateSe... 0.05
SHADE (181178)crUpdateInvidLocations/crUpdateItemLocations/scrollAugNextInSection/checkInventorySelectionExist... 0.05
SHADE (159623)ix/crCrSpring/crSpring/simpleCrSprings/functionalUpdate/timeFlowUpdate/updateUniverseMid/updateU... 0.10
SHADE (159633)colCrsWalls/functionalUpdate/timeFlowUpdate/updateUniverseMid/updateUniverse/updateRenderSplit/t... 0.10
SHADE (163282)updateCloud/updateObjCatMaybes.(...)/updateObjCatMaybes/updateClouds/functionalUpdate/timeFlowUp... 0.10
SHADE (157730)ix/updateInv/foldCr.f/foldCr/crUpdate/humanoidAIList/updateHumanoid/updateCreature/dimap/dimap/_... 0.10
+804685 -18961
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+59303 -510
View File
File diff suppressed because it is too large Load Diff
+281
View File
@@ -0,0 +1,281 @@
digraph {
graph [rankdir=LR];
subgraph 1 {
1 [shape=box
,label="EQUIP {_ibtEquip = FUELPACK}"];
5 [shape=box
,label="AMMOMAG {_ibtAmmoMag = TINMAG}"];
9 [shape=box
,label="HELD {_ibtHeld = BANGSTICK {_xNum = 1}}"];
13 [shape=box
,label="HELD {_ibtHeld = PISTOL}"];
15 [shape=box
,label="HELD {_ibtHeld = AUTOPISTOL}"];
17 [shape=box
,label="HELD {_ibtHeld = SMG}"];
20 [shape=box
,label="HELD {_ibtHeld = MACHINEPISTOL}"];
22 [shape=box
,label="HELD {_ibtHeld = BANGCONE}"];
25 [shape=box
,label="HELD {_ibtHeld = BLUNDERBUSS}"];
27 [shape=box
,label="HELD {_ibtHeld = GRAPECANNON {_xNum = 1}}"];
29 [shape=box
,label="HELD {_ibtHeld = RIFLE}"];
31 [shape=box
,label="HELD {_ibtHeld = VOLLEYGUN {_xNum = 3}}"];
33 [shape=box
,label="HELD {_ibtHeld = AUTORIFLE}"];
35 [shape=box
,label="HELD {_ibtHeld = BURSTRIFLE}"];
37 [shape=box
,label="HELD {_ibtHeld = MINIGUNX {_xNum = 3}}"];
40 [shape=box
,label="HELD {_ibtHeld = SNIPERRIFLE}"];
41 [shape=box
,label="HELD {_ibtHeld = AMR}"];
44 [shape=box
,label="HELD {_ibtHeld = AUTOAMR}"];
46 [shape=box
,label="HELD {_ibtHeld = RLAUNCHER}"];
49 [shape=box
,label="HELD {_ibtHeld = RLAUNCHERX {_xNum = 2}}"];
53 [shape=box
,label="HELD {_ibtHeld = FLAMESPITTER}"];
57 [shape=box
,label="HELD {_ibtHeld = BLOWTORCH}"];
59 [shape=box
,label="HELD {_ibtHeld = FLAMETHROWER}"];
61 [shape=box
,label="HELD {_ibtHeld = FLAMEWALL}"];
63 [shape=box
,label="HELD {_ibtHeld = FLAMETORRENT}"];
65 [shape=box,label=LASER];
69 [shape=box
,label="HELD {_ibtHeld = SPARKGUN}"];
71 [shape=box
,label="HELD {_ibtHeld = TESLAGUN}"];
73 [shape=box
,label="HELD {_ibtHeld = BLINKERUNSAFE}"];
74 [shape=box
,label="HELD {_ibtHeld = BLINKER}"];
77 [shape=box
,label="EQUIP {_ibtEquip = MAGSHIELD MagnetRepulse}"];
80 [shape=box
,label="EQUIP {_ibtEquip = POWERLEGS}"];
86 [shape=box
,label="HELD {_ibtHeld = FLATSHIELD}"];
96 [shape=box
,label="DETECTOR {_ibtDetector = ITEMDETECTOR}"];
99 [shape=box
,label="DETECTOR {_ibtDetector = WALLDETECTOR}"];
101 [shape=box
,label="DETECTOR {_ibtDetector = CREATUREDETECTOR}"];
103 [shape=box
,label="HELD {_ibtHeld = TORCH}"];
104 [shape=box
,label="AMMOMAG {_ibtAmmoMag = BATTERY}"];
107 [shape=box
,label="EQUIP {_ibtEquip = HEADLAMP}"];
108 [shape=box
,label="EQUIP {_ibtEquip = HAT}"];
110 [shape=box
,label="HELD {_ibtHeld = BANGSTICK {_xNum = 2}}"];
}
subgraph 2 {
0 [shape=point];
4 [shape=point];
8 [shape=point];
12 [shape=point];
14 [shape=point];
16 [shape=point];
19 [shape=point];
21 [shape=point];
24 [shape=point];
26 [shape=point];
28 [shape=point];
30 [shape=point];
32 [shape=point];
34 [shape=point];
36 [shape=point];
39 [shape=point];
42 [shape=point];
43 [shape=point];
45 [shape=point];
48 [shape=point];
50 [shape=point];
52 [shape=point];
56 [shape=point];
58 [shape=point];
60 [shape=point];
62 [shape=point];
64 [shape=point];
68 [shape=point];
70 [shape=point];
72 [shape=point];
76 [shape=point];
79 [shape=point];
82 [shape=point];
83 [shape=point];
84 [shape=point];
85 [shape=point];
87 [shape=point];
89 [shape=point];
92 [shape=point];
95 [shape=point];
98 [shape=point];
100 [shape=point];
102 [shape=point];
106 [shape=point];
109 [shape=point];
111 [shape=point];
113 [shape=point];
115 [shape=point];
117 [shape=point];
}
0 -> 1 [xlabel="",tailport=e];
4 -> 5 [xlabel="",tailport=e];
8 -> 9 [xlabel="",tailport=e];
9 -> 12 [xlabel=1
,arrowhead=onone
,headport=w];
9 -> 28 [xlabel=1
,arrowhead=onone
,headport=w];
9 -> 30 [xlabel=1
,arrowhead=onone
,headport=w];
9 -> 30 [xlabel=1
,arrowhead=onone
,headport=w];
9 -> 30 [xlabel=1
,arrowhead=onone
,headport=w];
9 -> 109 [xlabel=1
,arrowhead=onone
,headport=w];
9 -> 113 [xlabel=1
,arrowhead=onone
,headport=w];
9 -> 115 [xlabel=1
,arrowhead=onone
,headport=w];
12 -> 13 [xlabel="",tailport=e];
13 -> 14 [xlabel=1
,arrowhead=onone
,headport=w];
14 -> 15 [xlabel="",tailport=e];
15 -> 16 [xlabel=1
,arrowhead=onone
,headport=w];
15 -> 19 [xlabel=1
,arrowhead=onone
,headport=w];
16 -> 17 [xlabel="",tailport=e];
19 -> 20 [xlabel="",tailport=e];
21 -> 22 [xlabel="",tailport=e];
22 -> 24 [xlabel=1
,arrowhead=onone
,headport=w];
24 -> 25 [xlabel="",tailport=e];
25 -> 26 [xlabel=1
,arrowhead=onone
,headport=w];
26 -> 27 [xlabel="",tailport=e];
27 -> 117 [xlabel=1
,arrowhead=onone
,headport=w];
28 -> 29 [xlabel="",tailport=e];
29 -> 32 [xlabel=1
,arrowhead=onone
,headport=w];
29 -> 34 [xlabel=1
,arrowhead=onone
,headport=w];
29 -> 42 [xlabel=1
,arrowhead=onone
,headport=w];
30 -> 31 [xlabel="",tailport=e];
31 -> 36 [xlabel=1
,arrowhead=onone
,headport=w];
31 -> 113 [xlabel=1
,arrowhead=onone
,headport=w];
32 -> 33 [xlabel="",tailport=e];
34 -> 35 [xlabel="",tailport=e];
36 -> 37 [xlabel="",tailport=e];
37 -> 115 [xlabel=1
,arrowhead=onone
,headport=w];
39 -> 40 [xlabel="",tailport=e];
41 -> 39 [xlabel=1
,arrowhead=onone
,headport=w];
41 -> 43 [xlabel=1
,arrowhead=onone
,headport=w];
42 -> 41 [xlabel="",tailport=e];
43 -> 44 [xlabel="",tailport=e];
45 -> 46 [xlabel="",tailport=e];
46 -> 48 [xlabel=1
,arrowhead=onone
,headport=w];
48 -> 49 [xlabel="",tailport=e];
49 -> 50 [xlabel=1
,arrowhead=onone
,headport=w];
52 -> 53 [xlabel="",tailport=e];
53 -> 56 [xlabel=1
,arrowhead=onone
,headport=w];
53 -> 58 [xlabel=1
,arrowhead=onone
,headport=w];
56 -> 57 [xlabel="",tailport=e];
58 -> 59 [xlabel="",tailport=e];
59 -> 60 [xlabel=1
,arrowhead=onone
,headport=w];
59 -> 62 [xlabel=1
,arrowhead=onone
,headport=w];
60 -> 61 [xlabel="",tailport=e];
62 -> 63 [xlabel="",tailport=e];
64 -> 65 [xlabel="",tailport=e];
68 -> 69 [xlabel="",tailport=e];
69 -> 70 [xlabel=1
,arrowhead=onone
,headport=w];
70 -> 71 [xlabel="",tailport=e];
72 -> 73 [xlabel="",tailport=e];
74 -> 72 [xlabel=1
,arrowhead=onone
,headport=w];
76 -> 77 [xlabel="",tailport=e];
79 -> 80 [xlabel="",tailport=e];
85 -> 86 [xlabel="",tailport=e];
95 -> 96 [xlabel="",tailport=e];
98 -> 99 [xlabel="",tailport=e];
100 -> 101 [xlabel=""
,tailport=e];
102 -> 103 [xlabel=""
,tailport=e];
103 -> 106 [xlabel=1
,arrowhead=onone
,headport=w];
104 -> 102 [xlabel=1
,arrowhead=onone
,headport=w];
106 -> 107 [xlabel=""
,tailport=e];
108 -> 106 [xlabel=1
,arrowhead=onone
,headport=w];
109 -> 110 [xlabel=""
,tailport=e];
110 -> 111 [xlabel=1
,arrowhead=onone
,headport=w];
}
+145
View File
@@ -0,0 +1,145 @@
Seed: 7114951007332849727Layout with room names:
rezBox-0
|
autoDoor-1
|
rectPillars-2
|
autoDoor-3
|
Corridor-4
|
autoDoor-5
|
ElecautoRect-6
|
+- triggerDoorRoom-7
| |
| autoDoor-8
| |
| autoDoor-9
| |
| Corridor-10
| |
| autoDoor-11
| |
| 8gon-12
| |
| triggerDoorRoom-13
| |
| autoDoor-14
| |
| autoDoor-15
| |
| Corridor-16
| |
| autoRect-17
| |
| autoDoor-18
| |
| Corridor-19
| |
| autoDoor-20
| |
| 6gon-21
| |
| +- triggerDoorRoom-22
| | |
| | autoDoor-23
| | |
| | autoDoor-24
| | |
| | Corridor-25
| | |
| | autoDoor-26
| | |
| | warningTerm-8gon-27
| | |
| | triggerDoorRoom-28
| | |
| | autoDoor-29
| | |
| | autoDoor-30
| | |
| | Corridor-31
| | |
| | autoRect-32
| | |
| | autoDoor-33
| | |
| | Corridor-34
| | |
| | autoDoor-35
| | |
| | Corridor-36
| | |
| | 8gon-37
| | |
| | triggerDoorRoom-38
| | |
| | autoDoor-39
| | |
| | autoDoor-40
| | |
| | Corridor-41
| | |
| | tanksRoom-42
| | |
| | autoDoor-43
| | |
| | Corridor-44
| | |
| | autoDoor-45
| | |
| | rect-46
| | |
| | +- autoDoor-47
| | | |
| | | autoDoor-48
| | | |
| | | Corridor-49
| | | |
| | | autoRect-50
| | | |
| | | defaultRoom-51
| | | |
| | | autoRect-52
| | | |
| | | defaultRoom-53
| | | |
| | | autoRect-54
| | | |
| | | autoDoor-55
| | | |
| | | Corridor-56
| | | |
| | | autoDoor-57
| | | |
| | | 8gon-58
| | | |
| | | triggerDoorRoom-59
| | | |
| | | autoDoor-60
| | | |
| | | autoDoor-61
| | | |
| | | Corridor-62
| | | |
| | | defaultRoom-63
| | |
| | Corridor-64
| | |
| | autoDoor-65
| |
| autoDoor-66
| |
| Corridor-67
| |
| autoRect-68
|
autoDoor-69
|
Corridor-70
|
autoRect-71
+4
View File
@@ -0,0 +1,4 @@
Generating level with seed 7114951007332849727
After 1 attempt(s), Successful generation of level with seed 7114951007332849727
72 rooms in total
+1139
View File
File diff suppressed because it is too large Load Diff
+267
View File
@@ -0,0 +1,267 @@
Seed: 7114951007332849727
0:startThenWeaponRoom
|
1:corDoor
|
2:PassthroughLockKeyLists-HELD {_ibtHeld = SPARKGUN}
|
3:corDoor
|
4:lasSensorTurretTest
|
5:corDoor
|
6:SingleRoom
|
7:corDoor
|
8:PassthroughLockKeyLists-HELD {_ibtHeld = KEYCARD 0}
|
9:corDoor
|
10:warningRooms
|
11:corDoor
|
12:chaseCrit+armourChaseCrit rectRoom
|
13:corDoor
|
14:healthTest
|
15:corDoor
|
16:empty tanksRoom
|
17:corDoor
|
18:PassthroughLockKeyLists-HELD {_ibtHeld = SNIPERRIFLE}
|
19:corDoor
|
20:shootingRange
|
21:corDoor
|
22:lasSensorTurretTest
|
23:corDoor
|
24:randomFourCornerRoom
0:0:startThenWeaponRoom
|
0:1:weaponBetweenPillars_BANGSTICK4
0:0:0:rezBox'
0:0:0:0:rezBox
|
0:0:0:1:autoDoor
0:1:0:rectPillars
1:0:corDoor
1:0:0:autoDoor
|
1:0:1:Corridor
2:0:PassthroughLockKeyLists-HELD {_ibtHeld = SPARKGUN}
2:0:0:RassThroughLockKeyLists
|
2:0:1:roomsContaining chaseCritchaseCritTRANSFORMERCANCAN
2:0:0:0:sensorRoomRunPast
2:0:0:0:0:autoDoor
|
2:0:0:0:1:ElecautoRect
|
+- 2:0:0:0:2:triggerDoorRoom
| |
| 2:0:0:0:3:autoDoor
|
2:0:0:0:4:autoDoor
|
2:0:0:0:5:Corridor
2:0:1:0:autoRect
3:0:corDoor
3:0:0:autoDoor
|
3:0:1:Corridor
4:0:lasSensorTurretTest
4:0:0:autoDoor
|
4:0:1:8gon
|
4:0:2:triggerDoorRoom
|
4:0:3:autoDoor
5:0:corDoor
5:0:0:autoDoor
|
5:0:1:Corridor
6:0:SingleRoom
6:0:0:autoRect
7:0:corDoor
7:0:0:autoDoor
|
7:0:1:Corridor
8:0:PassthroughLockKeyLists-HELD {_ibtHeld = KEYCARD 0}
8:0:0:RassThroughLockKeyLists
|
8:0:1:roomsContaining chaseCritchaseCritchaseCritKEYCARD 0
8:0:0:0:keyCardRoomRunPast
8:0:0:0:0:autoDoor
|
8:0:0:0:1:6gon
|
+- 8:0:0:0:2:triggerDoorRoom
| |
| 8:0:0:0:3:autoDoor
|
8:0:0:0:4:autoDoor
|
8:0:0:0:5:Corridor
8:0:1:0:autoRect
9:0:corDoor
9:0:0:autoDoor
|
9:0:1:Corridor
10:0:warningRooms
10:0:0:autoDoor
|
10:0:1:warningTerm-8gon
|
10:0:2:triggerDoorRoom
|
10:0:3:autoDoor
11:0:corDoor
11:0:0:autoDoor
|
11:0:1:Corridor
12:0:chaseCrit+armourChaseCrit rectRoom
12:0:0:autoRect
13:0:corDoor
13:0:0:autoDoor
|
13:0:1:Corridor
14:0:healthTest
14:0:0:autoDoor
|
14:0:1:Corridor
|
14:0:2:8gon
|
14:0:3:triggerDoorRoom
|
14:0:4:autoDoor
15:0:corDoor
15:0:0:autoDoor
|
15:0:1:Corridor
16:0:empty tanksRoom
16:0:0:tanksRoom
17:0:corDoor
17:0:0:autoDoor
|
17:0:1:Corridor
18:0:PassthroughLockKeyLists-HELD {_ibtHeld = SNIPERRIFLE}
18:0:0:RassThroughLockKeyLists
|
18:0:1:roomsContaining chaseCritchaseCritSNIPERRIFLE
18:0:0:0:longRoomRunPast
18:0:0:0:0:autoDoor
|
18:0:0:0:1:rect
|
+- 18:0:0:0:2:autoDoor
|
18:0:0:0:3:Corridor
|
18:0:0:0:4:autoDoor
18:0:1:0:rectPillars
19:0:corDoor
19:0:0:autoDoor
|
19:0:1:Corridor
20:0:shootingRange
20:0:0:autoRect
|
20:0:1:defaultRoom
|
20:0:2:autoRect
|
20:0:3:defaultRoom
|
20:0:4:autoRect
21:0:corDoor
21:0:0:autoDoor
|
21:0:1:Corridor
22:0:lasSensorTurretTest
22:0:0:autoDoor
|
22:0:1:8gon
|
22:0:2:triggerDoorRoom
|
22:0:3:autoDoor
23:0:corDoor
23:0:0:autoDoor
|
23:0:1:Corridor
24:0:defaultRoom
BIN
View File
Binary file not shown.
+9 -10
View File
@@ -6,9 +6,9 @@ author: "Author name here"
maintainer: "example@example.com"
copyright: "2021 Author name here"
# extra-source-files:
# - README.md
# - ChangeLog.md
extra-source-files:
- README.md
- ChangeLog.md
# Metadata used when publishing your package
# synopsis: A basic game loop
@@ -25,16 +25,16 @@ dependencies:
- aeson-pretty
- containers
- deepseq
#- dlist
- dlist
- directory
- extra
- foldl
#- graphviz
- graphviz
- OpenGLRaw
- text
- bytestring
- lens
#- mtl
- mtl
- fgl
- JuicyPixels
- random
@@ -50,12 +50,11 @@ dependencies:
- primitive
- monad-parallel
- parallel
- Clipboard
- tasty
- tasty-hunit
- tasty-quickcheck
- list-tries
- Hclip
- search-algorithms
library:
source-dirs: src
@@ -81,7 +80,7 @@ executables:
- -fno-state-hack
- -funfolding-use-threshold1000
#- -funfolding-keeness-factor1000
# - -fllvm
- -fllvm
- -optlo-O3
- -Wall
#- -Wcompat
@@ -121,7 +120,7 @@ benchmarks:
- -fno-state-hack
- -funfolding-use-threshold1000
# - -funfolding-keeness-factor1000
# - -fllvm
- -fllvm
#- -optlo-O3
main: Bench.hs
source-dirs: bench
+1
View File
File diff suppressed because one or more lines are too long
+496124
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
7114951007332849727
-13
View File
@@ -1,13 +0,0 @@
#version 450 core
struct PosTex { vec4 pospos; vec4 texang; };
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
layout (std430, binding = 2) readonly buffer Pos { PosTex data[]; };
int indices[6] = {0,1,3,0,3,2};
void main()
{
vec4 pp = data[gl_VertexID / 6].pospos;
int j = indices[gl_VertexID % 6];
float z = (j / 2 > 0.5 ? 5000 : 100);
vec2 xy = (j % 2 > 0 ? pp.xy : pp.zw);
gl_Position = theMat * vec4(xy,z,1);
}
-6
View File
@@ -1,6 +0,0 @@
#version 450 core
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
layout (std430, binding = 7) readonly buffer Pos { vec2 pos[]; };
void main() {
gl_Position = theMat * vec4(pos[gl_VertexID],0,1);
}
+14 -5
View File
@@ -1,18 +1,27 @@
#version 450 core
in vec4 vPosID;
in vec4 vCol;
in vec4 vCenterSize;
in vec4 vControls;
layout (location=0) out vec4 fCol;
layout (location=1) out vec4 fPos;
layout (location=2) out vec4 fNorm;
void main()
{
// there are quite a few intricate controls concerning the normals
// we want normals to be bigger towards the center, so that when two clouds
// are blended central normals predominate
// similarly, we want normals to be bigger the further up the cloud is
// finally, we want normals to allow for shadows at the edge of a cloud
// when a light is direcly above the cloud
float d = dot(vControls,vControls);
if (d > 1) {discard;}
//fCol = vCol;
fCol = vec4(vCol.xyz,vCol.w*(1-d));
fPos = vec4(vPosID.xyz, vCol.w*(1-d));
//fPos = vec4(vPosID.xy,vPosID.z*0.5, vCol.w*(1-d));
fNorm = vec4(-vControls.xy, -0.1 + 0.2 * d ,fPos.w);
//fNorm = vec4(-vControls.xy, -0.1 + 2 * d ,vCol.w * (1.01-(d*d*d)));
//fNorm = vec4(-vControls.xy, -0.1 + d , fPos.w);
//float rad = vCenterSize.w*0.5;
float rad = vCenterSize.w;
float h = (1-d) * rad;
fPos = vec4(vPosID.xy, vPosID.z + h, vCol.w*(1-d));
vec3 fn1 = fPos.z*normalize(vec3(vCenterSize.xyz - fPos.xyz));
fNorm = vec4(fn1,fPos.w);
}
+4 -1
View File
@@ -1,15 +1,18 @@
#version 450 core
layout (location = 0) in vec4 posID;
layout (location = 1) in vec4 col;
layout (location = 2) in vec4 controls;
layout (location = 2) in vec4 centerSize;
layout (location = 3) in vec4 controls;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec4 vPosID;
out vec4 vCol;
out vec4 vCenterSize;
out vec4 vControls;
void main()
{
gl_Position = theMat * vec4(posID.xyz,1);
vPosID = posID;
vCol = col;
vCenterSize = centerSize;
vControls = controls;
}
+14
View File
@@ -0,0 +1,14 @@
#version 450 core
layout (location = 0) in vec3 pos;
layout (location = 1) in vec4 col;
layout (location = 2) in vec3 boxXboxYwidth;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec4 vCol;
out vec3 vPos;
out vec3 vparams;
void main() {
gl_Position = theMat * vec4(pos,1);
vCol = col;
vparams = boxXboxYwidth;
vPos = pos;
}
+11
View File
@@ -0,0 +1,11 @@
#version 450 core
layout (location = 0) in vec3 pos;
layout (location = 1) in vec4 col;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec4 vCol;
out vec3 vPos;
void main() {
gl_Position = theMat * vec4(pos,1);
vCol = col;
vPos = pos;
}
+9
View File
@@ -0,0 +1,9 @@
#version 450 core
layout (location=0) out vec4 fCol;
layout (location=1) out vec4 fPos;
in vec4 vCol;
in vec3 vPos;
void main() {
fCol = vCol;
fPos = vec4(vPos,1) ;
}
+14
View File
@@ -0,0 +1,14 @@
#version 450 core
layout (location = 0) in vec4 position;
layout (location = 1) in vec4 color;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec4 vCol;
out vec3 vPos;
void main()
{
vec4 posxy = theMat * vec4(position.xyz,1);
vec4 posz = theMat * vec4(position.xyw,1);
gl_Position = vec4(posxy.xy,posz.z,1);
vCol = color;
vPos = position.xyz;
}
+18
View File
@@ -0,0 +1,18 @@
#version 450 core
in vec4 vColor;
in vec2 boxOut;
in vec2 boxIn;
layout (location=0) out vec4 fCol;
layout (location=1) out vec4 fPos;
void main()
{
//float d = x - y - 1 + 2* sqrt(y);
float d = sqrt(boxOut.x) + sqrt(boxOut.y) - 1.0;
// float e = sqrt(f(x,wStart)) + sqrt(f(y,wEnd)) - 1.0;
float e = sqrt(boxIn.x) + sqrt(boxIn.y) - 1.0;
if ( d < 0 || e > 0) { discard; }
fCol = vColor;
fPos = vec4(0,0,0,0) ;
}
+76
View File
@@ -0,0 +1,76 @@
#version 450 core
layout (triangles) in;
layout (triangle_strip, max_vertices = 5) out;
in vec4 vColor[];
in vec2 vPosOff[];
in float vRadMag[];
out vec4 gColor;
out float wStart;
out float wEnd;
out vec3 gBoundingBox;
out vec2 box2 ;
vec2 normV2 (vec2 v)
{ return vec2(-v.y,v.x) ;
}
float lhs (vec2 da, vec2 db)
{ return sign(dot(da, normV2(db))) ;
}
float extrapolate (vec2 inOne, vec2 inZeroA, vec2 inZeroB, vec2 xy)
{
float det = inOne.x * (inZeroA.y - inZeroB.y)
+ inZeroA.x * (inZeroB.y - inOne.y)
+ inZeroB.x * (inOne.y - inZeroA.y)
;
float r = (inZeroA.y - inZeroB.y) ;
float s = (inZeroB.x - inZeroA.x) ;
float t = (inZeroA.x * inZeroB.y - inZeroB.x * inZeroA.y) ;
return r * xy.x + s * xy.y + t
/ det ;
}
void main()
{
vec3 pa = gl_in[0].gl_Position.xyz;
vec3 pb = gl_in[1].gl_Position.xyz;
vec3 pc = gl_in[2].gl_Position.xyz;
wStart = vRadMag [0];
wEnd = vRadMag [2];
box2 = vec2 (1,0);
gBoundingBox = vec3 (0.9,0.1,0);
gColor = vColor[0];
gl_Position = vec4 (vPosOff[0] , pa.z , 1);
EmitVertex();
box2 = vec2 (0,1);
gBoundingBox = vec3 (0.1,0.9,0);
gColor = vColor[2];
gl_Position = vec4 (vPosOff[2] , pc.z , 1);
EmitVertex();
box2 = vec2( extrapolate(vPosOff[0],vPosOff[2],pb.xy,pa.xy)
, extrapolate(vPosOff[2],vPosOff[0],pb.xy,pa.xy)
) ;
box2 = vec2(0.2,0);
gBoundingBox = vec3 (1,0,1);
gColor = vColor[0];
gl_Position = vec4 (pa, 1);
EmitVertex();
box2 = vec2( extrapolate(vPosOff[0],vPosOff[2],pb.xy,pc.xy)
, extrapolate(vPosOff[2],vPosOff[0],pb.xy,pc.xy)
) ;
box2 = vec2(0,0.2);
gBoundingBox = vec3 (0,1,1);
gColor = vColor[2];
gl_Position = vec4 (pc, 1);
EmitVertex();
box2 = vec2( 0,0 ) ;
gBoundingBox = vec3 (0,0,0);
gColor = vColor[1];
gl_Position = vec4 (pb, 1);
EmitVertex();
EndPrimitive();
}
+15
View File
@@ -0,0 +1,15 @@
#version 450 core
layout (location = 0) in vec3 position;
layout (location = 1) in vec4 color;
layout (location = 2) in vec4 boxes;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec4 vColor;
out vec2 boxOut;
out vec2 boxIn;
void main()
{
gl_Position = theMat * vec4(position.xyz,1);
vColor = color;
boxOut = boxes.xy ;
boxIn = boxes.zw ;
}
+11
View File
@@ -0,0 +1,11 @@
#version 450 core
layout (location=0) out vec4 fCol;
layout (location=1) out vec4 fPos;
uniform sampler2D aTexture;
in vec4 gColor;
in vec2 gTexCoord;
void main()
{
fCol = texture(aTexture, vec2 (gTexCoord.x * 0.0078125, gTexCoord.y)) * gColor;
fPos = vec4(0,0,0,0);
}
+35
View File
@@ -0,0 +1,35 @@
#version 450 core
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;
in vec4 vColor [];
in vec3 vTexCoord [];
out vec4 gColor;
out vec2 gTex;
void main()
{
vec3 cenPos = gl_in[0].gl_Position.xyz;
float sizex = vTexCoord[0].y;
float sizey = vTexCoord[0].z;
//float size = 0.05;
gColor = vColor[0];
float texPos = vTexCoord[0].x;
gl_Position = vec4 (cenPos.x - sizex*0.5, cenPos.y - sizey*0.5, cenPos.z , 1);
//gl_Position = vec4 (0, 0 , 5 , 1);
gTex = vec2 (texPos*0.0078125, 1);
EmitVertex();
gl_Position = vec4 (cenPos.x - sizex*0.5, cenPos.y + sizey*0.5, cenPos.z , 1);
//gl_Position = vec4 (0, 0.5 , 5 , 1);
gTex = vec2 (texPos*0.0078125, 0);
EmitVertex();
gl_Position = vec4 (cenPos.x + sizex*0.5, cenPos.y - sizey*0.5, cenPos.z , 1);
//gl_Position = vec4 (0.5, 0.5 , -5 , 1);
gTex = vec2 ((texPos+1)*0.0078125, 1);
EmitVertex();
gl_Position = vec4 (cenPos.x + sizex*0.5, cenPos.y + sizey*0.5, cenPos.z , 1);
gTex = vec2 ((texPos+1)*0.0078125, 0);
//gl_Position = vec4 (0.5, 0 , -5 , 1);
EmitVertex();
EndPrimitive();
}
+13
View File
@@ -0,0 +1,13 @@
#version 450 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec4 aColor;
layout (location = 2) in vec2 aTexCoord;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec4 gColor;
out vec2 gTexCoord;
void main()
{
gl_Position = theMat * vec4(aPos, 1.0);
gColor = aColor;
gTexCoord = aTexCoord;
}
+40
View File
@@ -0,0 +1,40 @@
#version 450 core
layout (triangles) in;
layout (triangle_strip, max_vertices = 4) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
in vec4 vCol[];
out vec4 gColC; // center color
out vec4 gColE; // edge color
out vec2 gBoundingBox;
out vec3 gPos;
void main()
{
vec4 pat = gl_in[0].gl_Position;
vec4 pbt = gl_in[1].gl_Position;
vec4 pct = gl_in[2].gl_Position;
vec4 pa = theMat * pat;
vec4 pb = theMat * pbt;
vec4 pc = theMat * pct;
gColC = vCol[0];
gColE = vCol[1];
gBoundingBox = vec2 (-1,1);
gl_Position = pb;
gPos = pbt.xyz;
EmitVertex();
gBoundingBox = vec2 (1,1);
gl_Position = pa;
gPos = pat.xyz;
EmitVertex();
gBoundingBox = vec2 (-1,-1);
gl_Position = pc;
gPos = pct.xyz;
EmitVertex();
gBoundingBox = vec2 (1,-1);
gl_Position = pa + pc - pb;
gPos = pat.xyz + pct.xyz - pbt.xyz;
EmitVertex();
EndPrimitive();
}
+11
View File
@@ -0,0 +1,11 @@
#version 450 core
layout (location = 0) in vec3 pos;
layout (location = 1) in vec4 col;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec4 vCol;
void main()
{
//gl_Position = theMat * vec4(pos,1);
gl_Position = vec4(pos,1);
vCol = col;
}
+4 -4
View File
@@ -2,8 +2,9 @@
in vec4 vTexPosRot;
in vec2 vPos;
layout (location=0) out vec4 fCol;
layout (location=1) out vec3 fPos;
layout (location=1) out vec4 fPos;
layout (location=2) out vec4 normal;
//layout (binding=0) uniform sampler2DArray tilesetSampler;
layout (binding=40) uniform sampler2DArray diffuseSampler;
layout (binding=41) uniform sampler2DArray normalSampler;
vec2 rotateV2 (float a, vec2 v)
@@ -15,9 +16,8 @@ void main()
vec3 vTexPos = vTexPosRot.xyz;
float rot = vTexPosRot.w;
fCol = vec4(texture(diffuseSampler,vTexPos));
fPos = vec3(vPos,0);
fPos = vec4(vPos,0,1);
vec4 bn = vec4(texture(normalSampler,vTexPos) - 0.5);
vec3 nmap1 = vec3(rotateV2(rot,bn.xy), bn.z);
normal = vec4(-nmap1.xyz ,0);
//normal = vec4(0,0,-1 ,0);
normal = vec4(-nmap1 ,0);
}
+4 -4
View File
@@ -1,12 +1,12 @@
#version 450 core
struct PosTexRot {vec4 posXX; vec4 texPosRot; };
layout (location = 0) in vec4 posXX;
layout (location = 1) in vec4 texPosRot;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
layout (std430, binding = 8) readonly buffer Data { PosTexRot data[]; };
out vec4 vTexPosRot;
out vec2 vPos;
void main()
{
vPos = data[gl_VertexID].posXX.xy;
vPos = posXX.xy;
gl_Position = theMat * vec4(vPos,0,1.0) ;
vTexPosRot = data[gl_VertexID].texPosRot;
vTexPosRot = texPosRot;
}
-18
View File
@@ -1,18 +0,0 @@
#version 450 core
in vec2 vTexPos;
out vec4 fColor;
layout(binding = 0) uniform sampler2D wincol;
layout(binding = 1) uniform sampler2D winpos;
layout(binding = 2) uniform sampler2D cloudcol;
layout(binding = 3) uniform sampler2D cloudpos;
vec4 blend (vec4 src, vec4 dst) {
return src + (1-src.a) * dst;
}
void main() {
//fColor = texture(t0, vTexPos) + texture(t2, vTexPos);
vec4 x = texture(wincol, vTexPos);
float xz = texture(winpos, vTexPos).z;
vec4 y = texture(cloudcol, vTexPos);
float yz = texture(cloudpos, vTexPos).z;
fColor = ( xz > yz ? blend(x,y) : blend(y,x)) ;
}
-7
View File
@@ -1,7 +0,0 @@
#version 450 core
layout (std140, binding = 2) uniform PosTex { vec4 posTex[6]; };
out vec2 vTexPos;
void main() {
gl_Position = vec4(posTex[gl_VertexID].xy,0,1);
vTexPos = posTex[gl_VertexID].zw;
}
+38
View File
@@ -0,0 +1,38 @@
#version 450 core
layout (triangles) in;
layout (triangle_strip, max_vertices = 3) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
layout(location=0)uniform vec3 lightPos;
in float drawbit[];
// the following code is duplicated in lineShadow.geom, should not be changed on its own
vec4 projNear (vec4 pos)
{
// note we project to a specific height
// this is quite brittle, not ideal
vec3 dir = pos.xyz - lightPos ;
float a = (100 - pos.z) / dir.z ;
vec2 xy = (pos.xyz + a * dir).xy ;
return vec4 ( xy, 100 , 1) ;
}
void main()
{
vec4 p0 = gl_in[0].gl_Position ;
vec4 p1 = gl_in[1].gl_Position ;
vec4 p2 = gl_in[2].gl_Position ;
if ( //if Light Source is below all vertices, draw cap
// TODO think about when LS is beside the object
(drawbit[0] == 1)
&& ( p0.z - lightPos.z > 0 )
&& ( p1.z - lightPos.z > 0 )
&& ( p2.z - lightPos.z > 0 )
)
{
// the front cap
vec4 v1 = vec4 (0,0,1,0) ;
gl_Position = theMat * projNear(p0); EmitVertex();
gl_Position = theMat * projNear(p2); EmitVertex();
gl_Position = theMat * projNear(p1); EmitVertex();
EndPrimitive();
}
else {}
}
+7 -24
View File
@@ -1,28 +1,11 @@
#version 450 core
struct PosColNorm { vec4 pos; vec4 dummy; };
layout (location = 0) in vec4 position;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
layout (std140, binding = 1) uniform TheLight { vec4 lightPos; vec4 lumRad; };
layout (std430, binding = 3) readonly buffer Data { PosColNorm data[]; };
layout (std430, binding = 4) readonly buffer Indices { uint indices[]; };
vec4 projNear (vec4 pos)
uniform vec3 lightPos;
uniform vec4 lumRad;
out float drawbit;
void main()
{
// note we project to a specific height
// this is quite brittle, not ideal
vec3 dir = pos.xyz - lightPos.xyz ;
float a = (100 - pos.z) / dir.z ;
vec2 xy = (pos.xyz + a * dir).xy ;
return vec4 ( xy, 100 , 1) ;
}
bool ztest (vec4 p) {return p.z - lightPos.z > 0;}
void main() {
int j = gl_VertexID/3;
int i1 = j * 3;
vec4 po = data[indices[gl_VertexID]].pos;
gl_Position = (po.w == 1
&& ztest(data[indices[i1]].pos)
&& ztest(data[indices[i1+1]].pos)
&& ztest(data[indices[i1+2]].pos)
? theMat * projNear(po)
: vec4(1,1,1,0)
);
gl_Position = vec4(position.xyz,1);
drawbit = position.w;
}
+57
View File
@@ -0,0 +1,57 @@
#version 450 core
// an attempt to test whether a geometry surface occludes the camera from a
// light source
layout (triangles) in;
layout (triangle_strip, max_vertices = 4) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
uniform vec3 lightPos;
uniform vec2 camPos;
void main()
{
vec3 p0 = gl_in[0].gl_Position.xyz ;
vec3 p1 = gl_in[1].gl_Position.xyz ;
vec3 p2 = gl_in[2].gl_Position.xyz ;
// first determine intersection point (if any)
vec3 u = p1 - p0 ;
vec3 v = p2 - p0 ;
vec3 n = cross (u,v) ;
vec3 dir = vec3 (camPos, 100) - lightPos ;
vec3 w0 = p0 - lightPos ;
float a = dot(n, w0) ;
float b = dot(n,dir) ;
if (abs(b) < 0.00001) {}
else {
float r = a / b ;
if (r < 0.0) {}
else {
vec3 ip = lightPos + r * dir ;
float uu, uv, vv, wu, wv, D;
uu = dot(u,u);
uv = dot(u,v);
vv = dot(v,v);
vec3 w = ip - p0;
wu = dot (w,u);
wv = dot (w,v);
D = uv * uv - uu * vv;
//get and test parametric coords
float s, t;
s = (uv * wv - vv * wu) / D;
if (s < 0.0 || s > 1.0) {}
else
{
t = (uv * wu - uu * wv) / D;
if (t < 0.0 || (s + t) > 1.0) {}
else
{
gl_Position = vec4(-1,-1,50,1); EmitVertex();
gl_Position = vec4(-1, 1,50,1); EmitVertex();
gl_Position = vec4( 1,-1,50,1); EmitVertex();
gl_Position = vec4( 1, 1,50,1); EmitVertex();
EndPrimitive();
}
}
}
}
}
-21
View File
@@ -1,21 +0,0 @@
#version 450 core
layout(early_fragment_tests) in;
layout (std140, binding = 1) uniform TheLight { vec4 lightPos; vec4 lumRad; };
layout (binding = 0) uniform sampler2D posTexture;
layout (binding = 1) uniform sampler2D normals;
in vec2 vTexPos;
out vec4 fColor;
float rad = lumRad.a;
void main() {
vec3 pos = texture(posTexture, vTexPos).xyz;
vec3 distVec = pos - lightPos.xyz;
float dist = dot(distVec, distVec);
vec3 norm = texture(normals, vTexPos).xyz;
float y1 = dot(norm, distVec);
float y2 = float(y1 > 0 ? 1 : 0.2);
//bool t = pos.z > lightPos.z && norm.z > 0;
//float y2 = float(y1 > 0 || t ? 1 : 0.1);
float x = 1 - (pow(dist / rad,4));
vec3 c = y2* x * lumRad.rgb;
fColor = vec4(c, 0);
}
-8
View File
@@ -1,8 +0,0 @@
#version 450 core
layout (std140, binding = 2) uniform PosTex { vec4 posTex[6]; };
out vec2 vTexPos;
void main()
{
gl_Position = vec4(posTex[gl_VertexID].xy,0,1);
vTexPos = posTex[gl_VertexID].zw;
}
+27
View File
@@ -0,0 +1,27 @@
#version 450 core
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out float lum;
out vec2 dField;
void main()
{
lum = gl_in[0].gl_Position.w;
vec4 cenPos = vec4( gl_in[0].gl_Position.xy, 0.1 , 1);
float gRad = gl_in[0].gl_Position.z;
dField = vec2 ( 1, 1);
gl_Position = theMat * vec4 (cenPos.x + gRad, cenPos.y + gRad, 0.1 , 1);
EmitVertex();
dField = vec2 (-1, 1);
gl_Position = theMat * vec4 (cenPos.x - gRad, cenPos.y + gRad, 0.1 , 1);
EmitVertex();
dField = vec2 ( 1,-1);
gl_Position = theMat * vec4 (cenPos.x + gRad, cenPos.y - gRad, 0.1 , 1);
EmitVertex();
dField = vec2 (-1,-1);
gl_Position = theMat * vec4 (cenPos.x - gRad, cenPos.y - gRad, 0.1 , 1);
EmitVertex();
EndPrimitive();
}
+91
View File
@@ -0,0 +1,91 @@
#version 450 core
layout(lines_adjacency) in;
layout(triangle_strip, max_vertices = 4) out;
layout(std140, binding = 0) uniform TheMat { mat4 theMat; };
layout(location=0) uniform vec3 lightPos;
layout(location=1) uniform float radiusUniform;
// vec4 shift (vec4 p) { return (vec4 (p.xyz +
// (lumRad.a*normalize(p.xyz-lightPos)), 1));}
float closestPointOnLineParam3 (vec3 a, vec3 b, vec3 p) {
return dot(p - a,b-a) / dot(b-a,b-a);
}
vec3 closestPointOnSeg3 (vec3 a,vec3 b, vec3 p) {
float x = closestPointOnLineParam3(a,b,p);
if (x < 0) {
return a;
} else{ if (x > 1) { return b; }
{ return a + (x * (b- a));}
}
}
//vec3 closepoint =
vec4 shift(vec4 p) { return (vec4(p.xyz + (100000 * (p.xyz - lightPos)), 1)); }
vec4 shiftBy(float x, vec4 p) {
return (vec4(lightPos + (x * normalize(p.xyz - lightPos)), 1));
}
// vec4 shift (vec4 p) { return (vec4 (lightPos +
// (lumRad.a*normalize(p.xyz-lightPos)), 1));}
// copied from lighting/cap.geom, should not be changed on its own
vec4 projNear(vec4 pos) {
// note we project to a specific height
// this is quite brittle, not ideal
vec3 dir = pos.xyz - lightPos;
float a = (100 - pos.z) / dir.z;
vec2 xy = (pos.xyz + a * dir).xy;
return vec4(xy, 100, 1);
}
vec4 shiftNear(vec4 pos)
//{ vec4 sp = shiftBy(radiusUniform,pos);
{
vec4 sp = shift(pos);
if (sp.z > 100) {
return projNear(pos);
} else {
return sp;
}
}
vec4 f(vec4 p) { return (theMat * p); }
void main() {
vec4 p0 = gl_in[0].gl_Position;
vec4 p1 = gl_in[1].gl_Position;
vec3 closepoint = closestPointOnSeg3(p0.xyz,p1.xyz,lightPos);
float ru2 = radiusUniform * radiusUniform;
vec4 mid = 0.5 * (p0 + p1);
vec3 n0a = gl_in[2].gl_Position.xyz;
vec3 n1a = gl_in[3].gl_Position.xyz;
vec3 n0 = cross(p1.xyz - p0.xyz, n0a - p0.xyz);
vec3 n1 = cross(p0.xyz - p1.xyz, n1a - p1.xyz);
// vec3 n2 = n0 + n1; // assumes the summands are normalized
vec3 lightDir = p0.xyz - lightPos.xyz;
vec3 lightDir2 = p1.xyz - lightPos.xyz;
// first test if the edge is part of the silhouette
// that is, if the normals of the faces connected by the edge point are in
// "different directions" wrt the light direction
if (dot(n0, lightDir) * dot(n1, lightDir) <= 0 &&
(dot(lightDir, lightDir) < ru2 || dot(lightDir2, lightDir2) < ru2))
// using <= rather than < seems to get rid of overlapping shadow
// artefacts
{
//vec4 p2 = shiftNear(p0);
//vec4 p3 = shiftNear(p1);
vec4 p2 = shiftNear(p0);
vec4 p3 = shiftNear(p1);
gl_Position = f(p0);
EmitVertex();
if (dot(n0, lightDir) > 0) {
gl_Position = f(p2);
EmitVertex();
gl_Position = f(p1);
EmitVertex();
} else {
gl_Position = f(p1);
EmitVertex();
gl_Position = f(p2);
EmitVertex();
}
gl_Position = f(p3);
EmitVertex();
EndPrimitive();
} else {
}
}
+2 -79
View File
@@ -1,83 +1,6 @@
#version 450 core
struct PosColNorm { vec4 pos; vec4 dummy; };
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
layout (std140, binding = 1) uniform TheLight { vec4 lightPos; vec4 colrad; };
layout (std430, binding = 3) readonly buffer Data { PosColNorm data[]; };
layout (std430, binding = 5) readonly buffer Indices { uint indices[]; };
float closestPointOnLineParam3 (vec3 a, vec3 b, vec3 p) {
return dot(p - a,b-a) / dot(b-a,b-a);
}
vec3 closestPointOnSeg3 (vec3 a,vec3 b, vec3 p) {
float x = closestPointOnLineParam3(a,b,p);
return (x < 0
? a
: (x > 1
? b
: a + (x * (b- a)))) ;
}
vec4 shift(vec4 p) { return (vec4(p.xyz + (10000 * (p.xyz - lightPos.xyz)), 1)); }
vec4 shiftBy(float x, vec4 p) {
return (vec4(lightPos.xyz + (x * normalize(p.xyz - lightPos.xyz)), 1));
}
vec4 projNear (vec4 pos)
{
// note we project to a specific height
// this is quite brittle, not ideal
vec3 dir = pos.xyz - lightPos.xyz ;
float a = (100 - pos.z) / dir.z ;
vec2 xy = (pos.xyz + a * dir).xy ;
return vec4 ( xy, 100 , 1) ;
}
vec4 shiftNear(vec4 pos)
{
vec4 sp = shift(pos);
return (sp.z > 100 ? projNear(pos) : sp);
}
// Output 6 vertices for 4 data inputs
const int ks[6] = // Inputdata: n1a Shadow:
{0,1,2 // 2--3 / p2--p3
,2,1,3 // | | p0---p1 / |
}; // 0--1 / / |
// n0a p0----p1
layout (location = 0) in vec3 pos;
void main()
{
int k = ks[gl_VertexID % 6];
int i0 = 4*(gl_VertexID / 6);
vec4 p0 = data[indices[i0]].pos;
vec4 p1 = data[indices[i0+1]].pos;
vec3 n0a = data[indices[i0+2]].pos.xyz;
vec3 n1a = data[indices[i0+3]].pos.xyz;
vec3 closepoint = closestPointOnSeg3(p0.xyz,p1.xyz,lightPos.xyz);
float ru2 = colrad.w * colrad.w;
vec4 mid = 0.5 * (p0 + p1);
vec3 n0 = cross(p1.xyz - p0.xyz, n0a - p0.xyz);
vec3 n1 = cross(p0.xyz - p1.xyz, n1a - p1.xyz);
vec3 lightDir = p0.xyz - lightPos.xyz;
vec3 lightDir2 = p1.xyz - lightPos.xyz;
// test if the edge is part of the silhouette
// that is, if the normals of the faces connected to the edge are in
// "different directions" wrt the light direction
// (first test the "drawbit")
//if (p0.w==1 && dot(n0, lightDir) * dot(n1, lightDir) <= 0 &&
if ( dot(n0, lightDir) * dot(n1, lightDir) <= 0 &&
(dot(lightDir, lightDir) < ru2 || dot(lightDir2, lightDir2) < ru2))
// using <= rather than < seems to get rid of overlapping shadow
// artefacts
{
vec4 p2 = shiftNear(p0);
vec4 p3 = shiftNear(p1);
if (dot(n0, lightDir) < 0)
{
vec4 sp[4] = {p1,p0,p3,p2};
gl_Position = theMat * sp[k];}
else {
vec4 ps[4] = {p0,p1,p2,p3};
gl_Position = theMat * ps[k]; }
}
else {gl_Position = vec4(1,1,1,0);}
gl_Position = vec4(pos,1);
}
//layout (location = 0) in vec3 pos;
//void main()
//{
// gl_Position = vec4(pos,1);
//}
+22 -23
View File
@@ -1,35 +1,34 @@
#version 450 core
layout(early_fragment_tests) in;
layout (std140, binding = 1) uniform TheLight { vec4 lightPos; vec4 lumRad; };
layout (binding = 0) uniform sampler2D posTexture;
layout(location=0)uniform vec3 lightPos;
layout(location=1)uniform vec4 lumRad;
layout (binding = 0) uniform sampler2D screenTexture;
layout (binding = 1) uniform sampler2D normals;
in vec2 vTexPos;
out vec4 fColor;
float rad = lumRad.a;
void main() {
vec3 pos = texture(posTexture, vTexPos).xyz;
vec3 distVec = pos - lightPos.xyz;
vec3 pos = texture(screenTexture, vTexPos).xyz;
vec3 distVec = pos - lightPos;
float dist = dot(distVec, distVec);
// float dist = dot(distVec.xy, distVec.xy);
// if (dist > rad) {
// discard;
// }
float t = texture(normals, vTexPos).w;
vec3 norm = texture(normals, vTexPos).xyz;
if (dist > rad) {
discard;
}
vec4 normbit = texture(normals, vTexPos);
vec3 norm = normbit.xyz;
float y1 = dot(normalize(norm), normalize(distVec));
float y2 = float(y1 > 0 ? 1 : 0);
//float y2x = y2;
float y4 = float(y1 > 0 && y1 < 0.5 ? 0.5 : y2);
float y5 = max(0,y1);
//float y4 = smoothstep(-1,1,y1);
//float y4 = 0.25*pow(y1+1,2);
float y3 = float(t > 0
? y2
: (t == 0 ? y4 : y4));
//float x = 1 - (dist / rad);
//float x = 1;
//float x = (dist > rad ? 0 : 1);
//float y3 = clamp(0.5 * (y1 + 1),0,1) ;
float y3 = clamp(2*y1 + 1,0,1) ;
//float y3 = clamp(0.5 * (y1 + 2),0,1) ;
//float y = float(normbit.w == 0 ? y3 : y2);
float y = y2;
//float x = 1 - dist / rad;
float x = 1 - (pow(dist / rad,4));
vec3 c = y3* x * lumRad.rgb;
//float x = 1 ;
//float x = 1;
//float x = 1 - max(0, ((dist + 10000) - rad) * 0.0001) ;
//vec3 c = y* (x * x * x) * lumRad.rgb;
vec3 c = y* x * lumRad.rgb;
//vec3 c = x * lumRad.rgb;
fColor = vec4(c, 0);
}
+4 -3
View File
@@ -1,8 +1,9 @@
#version 450 core
layout (std140, binding = 2) uniform PosTex { vec4 posTex[6]; };
layout (location = 0) in vec2 pos;
layout (location = 1) in vec2 texPos;
out vec2 vTexPos;
void main()
{
gl_Position = vec4(posTex[gl_VertexID].xy,0,1);
vTexPos = posTex[gl_VertexID].zw;
gl_Position = vec4(pos,0,1);
vTexPos = texPos;
}
+68
View File
@@ -0,0 +1,68 @@
#version 450 core
layout(points) in;
layout(triangle_strip, max_vertices = 18) out;
layout(std140, binding = 0) uniform TheMat { mat4 theMat; };
layout(location=0) uniform vec3 lightPos;
layout(location=1) uniform float rad;
float rad2 = rad;
// Preprocessed to include ../functions.glsl
float closestPointOnLineParam (vec2 a, vec2 b, vec2 p) {
return dot(p - a,b-a) / dot(b-a,b-a);
}
vec2 closestPointOnSeg (vec2 a,vec2 b, vec2 p) {
float x = closestPointOnLineParam(a,b,p);
if (x < 0) {
return a;
} else{ if (x > 1) { return b; }
{ return a + (x * (b- a));}
}
}
// End include 2023-03-13 15:33:44.438312149 UTC
vec2 shift(vec2 p) {
return vec2(lightPos.xy + (rad2 * normalize(p - lightPos.xy)));
}
float isLHS(vec2 startV, vec2 testV) {
return sign(-startV.x * testV.y + startV.y * testV.x);
}
// construct a box with openings on bottom face and face away from wall
void main() {
vec2 p1 = gl_in[0].gl_Position.xy;
vec2 p2 = gl_in[0].gl_Position.zw;
vec2 closepoint = closestPointOnSeg(p1,p2,lightPos.xy);
if (isLHS(p1 - lightPos.xy, p2 - lightPos.xy) < 0 && distance(closepoint,lightPos.xy) < rad2) {
vec2 closeshift = (rad2 * normalize(closepoint - lightPos.xy)) + lightPos.xy - closepoint;
vec2 p1cs = p1 + closeshift;
vec2 p1o = vec2( distance(p1,lightPos.xy) > rad2 ? p1cs : shift(p1) );
vec2 p2cs = p2 + closeshift;
vec2 p2o = vec2( distance(p2,lightPos.xy) > rad2 ? p2cs : shift(p2) );
gl_Position = theMat * vec4(p1o,-500,1); EmitVertex();
gl_Position = theMat * vec4(p1,-500,1); EmitVertex();
gl_Position = theMat * vec4(p1o,100,1); EmitVertex();
gl_Position = theMat * vec4(p1,100,1); EmitVertex();
gl_Position = theMat * vec4(p1cs,100,1); EmitVertex();
gl_Position = theMat * vec4(p2,100,1); EmitVertex();
gl_Position = theMat * vec4(p2cs,100,1); EmitVertex();
gl_Position = theMat * vec4(p2o,100,1); EmitVertex();
EndPrimitive();
// gl_Position = theMat * vec4(p2o,100,1); EmitVertex();
// gl_Position = theMat * vec4(p2,100,1); EmitVertex();
// gl_Position = theMat * vec4(p2o,0,1); EmitVertex();
// gl_Position = theMat * vec4(p2,0,1); EmitVertex();
gl_Position = theMat * vec4(p2,100,1); EmitVertex();
gl_Position = theMat * vec4(p2,-500,1); EmitVertex();
gl_Position = theMat * vec4(p2o,100,1); EmitVertex();
gl_Position = theMat * vec4(p2o,-500,1); EmitVertex();
gl_Position = theMat * vec4(p2cs,100,1); EmitVertex();
gl_Position = theMat * vec4(p2cs,-500,1); EmitVertex();
gl_Position = theMat * vec4(p1cs,100,1); EmitVertex();
gl_Position = theMat * vec4(p1cs,-500,1); EmitVertex();
gl_Position = theMat * vec4(p1o,100,1); EmitVertex();
gl_Position = theMat * vec4(p1o,-500,1); EmitVertex();
EndPrimitive();
} else {
}
}

Some files were not shown because too many files have changed in this diff Show More