Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Saikyun
@Saikyun
it starts a prepl-server that evals on the main thread, so you could use unity functions
you could probably do something similar but host a nrepl-server instead, if you want to use cider
here are the most important parts for running code on the main thread: https://github.com/Saikyun/miracle.arcadia.prepl/blob/master/prepl.clj#L23-L72
it's essentially copy pasted from arcadia
Daniel Gerson
@dmg46664
@Saikyun Thanks for the direction, I guess I'll have to give it a spin. :-)
Saikyun
@Saikyun
@dmg46664 no problem :) don't hesitate to ask me questions.
(Bahadir Cambel)
@bahadircambel_twitter

Hey peeps, got a question here related to hooks. I am using Arcadia 1.0.14, Unity2018.4.14f1 (free edition) I got pretty much stuck, and getting exceptions in the console

(defn happy-logger [&_ ]
   (log "heelo"))

(hook+ (object-named "Cube1") :update :move-fast #'game.core/happy-logger)

When I run, I got the exception

ArityException: Wrong number of args (2) passed to: Unbound: #'game.core/happy-logger
clojure.lang.AFn.invoke (System.Object arg1, System.Object arg2) (at <fb1204dbf0b848beaab1559f81f1b22c>:0)
ArcadiaBehaviour.RunFunctions () (at Assets/Arcadia/Components/ArcadiaBehaviour.cs:500)
UpdateHook.Update () (at Assets/Arcadia/Components/UpdateHook.cs:9)

Context: key: :orbit; fn: #'game.core/happy-logger; GameObject: Cube; GameObject id: -59878
UnityEngine.Debug:LogError(Object, Object)
ArcadiaBehaviour:PrintContext(Int32) (at Assets/Arcadia/Components/ArcadiaBehaviour.cs:480)
ArcadiaBehaviour:RunFunctions() (at Assets/Arcadia/Components/ArcadiaBehaviour.cs:499)
UpdateHook:Update() (at Assets/Arcadia/Components/UpdateHook.cs:9)

Anybody has an idea why this is happening ?

I was following the @Saikyun tutorials btw. Thanks @Saikyun it was a nice really nice beginner tutorial
Saikyun
@Saikyun
hi @bahadircambel_twitter happy to hear you like them. :) and also great that you found your way here
the error message means that for some reason, the runtime isn't aware of a function game.core/happy-logger existing. you excluded the namespace in your code, but I assume it's game.core? :) next I'm unsure if [&_ ] actually works, might be that you're getting a compiler error earlier? you should change that to [& _] either way :)
(Bahadir Cambel)
@bahadircambel_twitter
it's a typo that I made here..
isn't this actually the exception when the arg number is mismatching?
Saikyun
@Saikyun
well, it might sound like it, but it says "Unbound: #'game.core/happy-logger" which means that the var #'game.core/happy-logger isn't bound to anything
the error could definitely be a lot clearer :P
(Bahadir Cambel)
@bahadircambel_twitter
is there any simple examples to add components (such as Physics/Rigidbody) to an primitive that you can point out to be ? All the game examples I saw so far are done with the previous versions of Arcadia
(Bahadir Cambel)
@bahadircambel_twitter
*you can point out to me.
Saikyun
@Saikyun
@bahadircambel_twitter hmm, not on the top of my head. you can check the api docs though: https://github.com/arcadia-unity/Arcadia/wiki/arcadia.core#cmpt-1
(Bahadir Cambel)
@bahadircambel_twitter
alright, thanks a lot for the help! Much appreciated
Saikyun
@Saikyun
if you have :import [UnityEngine.Rigidbody] then you can just do (cmpt+ go-obj Rigidbody)
no problem :)
sorry, I think it was just UnityEngine.Rigidbody
not currently using arcadia, so those kinds of details aren't quite up to speed in my memory ^^;
(Bahadir Cambel)
@bahadircambel_twitter
no worries, I managed to get that working at least! :)
I am pretty new to Unity thus the progress is quite slow
Murilo Pereira
@mpereira
@Saikyun thanks for Miracle, it works great
Murilo Pereira
@mpereira
your Emacs configs for Arcadia are very interesting too. I might try to make some of those things work with Miracle
(the inf-clojure helpers)
Murilo Pereira
@mpereira
does anyone know if it is possible to make GameObjects with Arcadia defmutable state attached to them be shown as editable fields in the inspector window?
Saikyun
@Saikyun
@bahadircambel_twitter take your time :) unity is a beast. albeit a useful beast
@mpereira happy to hear it :) I haven't done much with miracle so most thanks should go to the author of Monroe. either way I'm glad you find it useful.
afaik there's no way to edit state in the inspector windows. not sure what defmutable does though tbh
Murilo Pereira
@mpereira
I see, thanks for the info. I left a comment in this issue, which seems to be related: https://github.com/arcadia-unity/Arcadia/issues/128#issuecomment-572051195
regarding Miracle, I detailed my workflow in the README for a project I'm working on, if anyone is interested: https://github.com/mpereira/felucca#connect-to-the-nrepl
Saikyun
@Saikyun
awesome :) sounds like a fun project
if you want inspiration wrt how to get networking going with arcadia I made this: https://github.com/Saikyun/arcadia-network-example
it's super dumb but it works :) I guess they'll deprecate the high level api soon though (if they haven't already), so specifics might have to be changed
Murilo Pereira
@mpereira
thanks for the pointer!
any reason you wrote some of the code in c# instead of clojure? just curious
I wrote a simple game server that communicates via websockets and persists state to Redis. as soon as the game itself is a bit more fleshed out I'll start with the network programming... https://github.com/mpereira/felucca-server
Saikyun
@Saikyun
yeah, I haven't managed to create classes properly from clojure, so I opted to create those parts in c#. I never modify them though, so it's not really a practical problem
cool :)
my current project uses react native + cljs as a frontend, and clj jvm as a backend
Murilo Pereira
@mpereira
makes sense
is your current project a game? I checked your github but didn't see any
Saikyun
@Saikyun
yeah. it's planned to be commercial, so probably not going to open source it. if nothing else the code isn't something I'd want to plague others with :^)
it's a digital duelling card game, where instead of beating your opponent down, you win by building a great city :)
Jason-Chandler
@Jason-Chandler

Another hint on that ArityException: Wrong number of args (2) passed to: Unbound: #'game.core issue, in case it helps anyone

(object-named "x")
(def test (object-named "x"))

I have a bad habit of writing test definitions and finders like object-named in the same file as my hook functions. Just random things I'll execute and then keep modifying to see what answers it pretty prints before I wrap it properly like the tutorial says. I've been using Arcadia for a couple of months now without issue, but the past couple of days none of my hooks have been working with the error the others have had.

I found that this is because in my new file I had been writing these "test" finders ABOVE my hooks instead of below. It's a dumb mistake on my part to leave dead code in the file while it's running, but I just wanted to give people the heads up in case they're as confused as I was if everything stopped working all of a sudden. Arcadia/Unity stops reading entirely once it finds out that you've used a "finder" function outside of a starter hook - don't leave them lying around like I do or nothing else will run.

With that wall of text out of the way, I also want to say thank you to you guys for posting such helpful information all the time. It seems like my questions are always already answered on here.
Saikyun
@Saikyun
@Jason-Chandler ah yeah, that's true. if you have a single error in a file the rest of the file won't be read. can be extra tricky since it's possible to write code that works when you run eval-buffer, but breaks when unity loads it, or when you run load-file