Skip to content

Releases: AlecTroemel/junk-drawer

v0.3.4 FSM Hotfix

29 Dec 03:04
0121328
Compare
Choose a tag to compare

#49
fixes bug where transition methods in FSM would remain on the root table even after leaving that state.
Also fixes example in the FSM create function docstring

v0.3.3: ECS hotfix

23 Dec 17:43
8ea84fa
Compare
Choose a tag to compare

fixes but in ECS that occurred after removing entities

v0.3.2: digraph enhancments + QOL

12 Dec 23:09
6bcdb83
Compare
Choose a tag to compare
  • converts edge and node macros to plain old functions. This is conceptually simpler, and allows for forms to be used as values. Check out the new tests to see examples of this
  • ECS def-system now passes the name to the inner functions, which makes debugging easier
  • FSM has a new get-current-state function
  • fixes bug in directed-graph find-path function

v0.3.1 Envelopes and Tweens fixes

18 Nov 16:47
Compare
Choose a tag to compare
  • replaced the "begin, release, reset" transitions with "trigger, release". You can (re)trigger or release from all the expected states.
  • Built an envelope visualizer example
  • Fixed bug where tween interpolate function was calculating values incorrectly.

v0.3.0 Envelopes

12 Nov 21:06
00b8309
Compare
Choose a tag to compare

Adds Envelopes module, which are basically "multistage tweens".

(use junk-drawer)

(defn print-bar [v]
  (for j 0 (math/round v) (prin "="))
  (print ""))

(var *adsr* (envelopes/adsr
               :attack-target 50 :attack-duration 20 :attack-tween tweens/in-cubic
               :decay-target 25 :decay-duration 15
               :release-duration 15 :release-tween tweens/in-out-quad))

(:begin *adsr*)
(for i 0 40 (print-bar (:tick *adsr*)))
(:release *adsr*)
(for i 0 15 (print-bar (:tick *adsr*)))

Check out the examples and test for more!

v0.2.0 Directed graphs and vectors module

28 Oct 21:15
777f189
Compare
Choose a tag to compare
  • Adds directed graph module, and re-implements FSM and Gamestates to use it. Check out the examples/ folder for the new syntax
# Graph syntax
(var *graph*
     (digraph/create
      (digraph/node :a :x 0 :y 0) (digraph/node :b :x 1 :y 0) (digraph/node :c :x 2 :y 0)

      (digraph/edge :a :b)
      (digraph/edge :b :c 8)))
(:find-path *graph* :a :c)

# new FSM syntax
(fsm/define
 colored-warnings
 (fsm/state :green
    :enter (fn green-enter [self from] (print "entering green"))
    :leave (fn green-leave [self to] (print "leaving green")))
 (fsm/transition :warn :green :yellow)

 (fsm/state :yellow
    :enter (fn yellow-enter [self from name]
             (printf "entering yellow, %s be careful!" name)))
 (fsm/transition :panic :yellow :red)
 (fsm/transition :clear :yellow :green)

 (fsm/state :red
    :leave (fn red-leave [self to] (print "leaving red")))
 (fsm/transition :calm :red :yellow))

# New Gamestate syntax 
(def *GS* (gamestate/init))
(gamestate/def-state
 menu
 :init (fn menu-init [self] (print "menu init"))
 :enter (fn menu-enter [self prev & args] (printf "menu enter %q" args))
 :update (fn menu-update [self dt] (print "menu game state dt: " dt)))
(:add-state *GS* menu)
(:goto *GS* :menu)
  • Adds Vector module, with lots of useful 2d vector functions
(var a (vector/new 0 0))
(var a (vector/from-tuple [2 2]))
(:distance a b)
# and lots of other things
  • Adds def-component-alias macro so you can re-use components with different names
(def-component-alias position vector/from-named)
(position :x 1 :y 2)

v0.1.1 Fix imports

16 Sep 20:09
Compare
Choose a tag to compare

fixes local imports within modules

v0.1.0 Docs, Tests, Bug Fixes, Better tweens

16 Sep 19:29
Compare
Choose a tag to compare
  • #31 Components have been completely refactored to use spork/schema for more feature rich typing. add-componet and add-entity could then be refactored to be plain fn's and greatly simplified! Additionally you can set components to variables before using them in add-entity.
# only syntax that ever worked
(add-entity world (position :x 100.0 :y 100.0))

# This would not work, but is now possible with this refactor!
(let [pos (position :x 100.0 :y 100.0)] 
  (add-entity world pos))

# you can even do this!
(defn centered-position [v] (position :x v :y v))
(add-entity world (centered-position 100.0)) # this entitty will have the component "position" 
  • #34 Refactored tweens to be components, which allows adding any number of them to a single entity!
(def-component example-cmp
    :a :number            # can only tween numbers
    :b (props :c :number) # nested objects of numbers are tweened recursively
    :d :string)           # anything other then numbers are ignored

(tweens/create wld ent :example-cmp
    :to {:a 10 :b {:c 34}} # could also use the component fn, but defining unused string seemed wrong.
    :with tweens/in-cubic
    :duration 10)          # take 10 Ticks of the ecs to complete
  • #30 + #33 Tests for all the things, plus a gitlab pipeline to run them
  • #26 detailed doc strings for all the modules and their public functions
  • fixed an off by 1 error in querying the db when there is only 1 entity with a component
  • deleting an entity no longer clears ever key in the cache
  • A fun logo in the readme

V0.0.9 Sparse set ECS

24 Aug 00:31
Compare
Choose a tag to compare

The ECS has been completely reworked to use the sparse set data structure. Take a look at the PR for a discussion on performance improvements (they're pretty big) #21

v0.0.8

10 Jul 20:07
Compare
Choose a tag to compare
  • replace os/time with os/clock for finer resolution in messages created field
  • uses gensyms for world variable in ecs/add-component, ecs/add-entity and messages/send macros.
  • allow additional args to be passed into the enter function in fsm through goto