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
Thank you for saying so ^_^
Gary Deer
@gdeer81

last night I added ai for my tic-tac-toe game and I got the fighter tutorial https://github.com/arcadia-unity/fighter-tutorial working with the latest arcadia release and unity 2020.

As usual, it's not pretty because I had to create a namespace to paste in all of the missing sugar calls and get the spec calls working but it was an interesting exercise and I think I have a better understanding of roles.

sogaiu
@sogaiu
cool that you got it working!
Jason Chandler
@jason-chandler_gitlab
Really like hearing about the progress, Gary! Nice job!
Gary Deer
@gdeer81

Thanks!
last night I played with rigging up a sprite because my girlfriend wanted me to add a panda to the fighter tutorial.
I had to rewrite the movement logic because pandas and spaceships move a little differently so I was reminded how nice it is to be able to fiddle with functions while the game is running.
Turns out it wasn't my logic that was causing my poor panda to fall through space, I just forgot to set the gravity to zero on his rigid body
I guess I could've done in the code but I've learned to let unity handle the uninteresting parts of the prefabs

The interesting part was when I set up the animations I had an "idle" animation and a "running" animation so when it's just standing around it's breathing heavy and when you move it, the legs move, and then when you stop pressing the wasd keys it stops and goes back into the idle animation.

so I was able to use with-cmpt to grab it's animator and use interop to call the SetBool for the boolean value I set up in unity's animator ui. So yeah, my clojure code can toggle the animation.

I'm going to start documenting all my progress in a blog somewhere so I don't keep dumping a wall of text here every day. Maybe I'll stumble backwards into one of my original goals when I first joined the community and help document the API and provide interesting usage examples.

TL;DR: I got another thing working and went into a lot of detail about it, I vowed to never do this again in gitter and instead put implementation details in a blog

Saikyun
@Saikyun
looking forward to reading the blog bost :)
sogaiu
@sogaiu
yes!
and more pandas please!
sogaiu
@sogaiu
i don't know if it's a problem to see what you're up to here - at least i have been enjoying what you share :)
Gary Deer
@gdeer81
okay as per usual, I wasted way too much time fiddling with the design, but now I have a place to document the verbose details of me trying to make games: https://gdeer81.github.io/
sogaiu
@sogaiu
fwiw a link there: https://gdeer81.github.io/portfolio 404s for me
sogaiu
@sogaiu

@gdeer81 i think at some point cursive got socket repl support: https://cursive-ide.com/userguide/repl.html#remote-repls

don't know if that helps at all, but that's an alternative way of having a connection between arcadia and cursive (other than the usual nrepl) -- may be you've already tried or already doing so?

Gary Deer
@gdeer81
@sogaiu whoops thanks for the headsup, the navbar link to it works (https://gdeer81.github.io/pages-output/portfolio/) but the link in the homepage body didn't get generated properly for some reason
and I never knew about tubular (which I learned about from reading that link you posted) but my attention budget is getting stretched so I'll have to put it on the old todo since the repl i'm using works for now, it just makes a lot of noise
Victor Bjelkholm
@victorb
Maybe more of a CLR question rather than Arcadia, but trying to set what seems to be union types, for Rigidbody.constraints. Unity docs says m_Rigidbody.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotationZ but I'm unable to figure out how to express that in CLR
Victor Bjelkholm
@victorb
Since docs mention "You can use the bitwise OR operator to combine multiple constraints" I gave it a try to use bit-or from clojure-land, but that returns System.Int64 instead of required UnityEngine.RigidbodyConstraints
fdamirv
@fdamirv
Set it up in Unity Editor and use prefab.
Ramsey Nasser
@nasser
@victorb ClojureCLR has enum-or that does what you want in this case
try (enum-or RigidbodyConstraints/FreezePositionZ RigidbodyConstraints/FreezeRotationZ)
Victor Bjelkholm
@victorb
@fdamirv sounds like a hassle, much rather do it in code if possible :) But thanks for the suggestion
@nasser oh, that looks like it could work, thanks a lot!
fdamirv
@fdamirv

@fdamirv sounds like a hassle, much rather do it in code if possible :) But thanks for the suggestion

Yes. There was a moment I thought, that I no need prefabs any, because I use Clojure. But later I was so lazy - I just set up prefabs and instantiated gameobject.

Maybe, in my future project, I will think about it one more time.
arundilipan
@arundilipan
Hey everyone, I was experimenting with Arcadia for a Unity project, and I was wondering what the idiomatic way of instantiating a prefab to basically create projectiles/bullets in Arcadia? This is my first time really getting into Unity and so I looked around online as to how people would do it in C#, and it seems like there are instance variables attached to a MonoBehavior script that can be attached using the Unity Editor itself, but it seems like instantiate in arcadia.core only works for objects already on the scene graph? I was wondering what the best way to go about creating bullets using Arcadia would be?
Damon Kwok
@damon-kwok
But so, I found that it always happens at the beginning of the line.
Jason Chandler
@jason-chandler_gitlab

@arundilipan I can't remember if I picked this up from selfsame's tutorials or if it's in the manual:
You can actually use instantiate on any prefab like this

(instantiate (Resources/Load "sun"))

Where sun is the name of a prefab that I have in my Assets/Resources folder.
If you don't have a Resources folder in your Assets, then make one. Anything you drag into it will automatically become a prefab.

I forgot to mention: you will also need to add Resources to the :import key of your namespace
(:import [UnityEngine Debug Resources GameObject])
arundilipan
@arundilipan
thanks @jason-chandler_gitlab, I was also wondering whether if we're going to potentially have multiple instances of that prefab, whether it helps to do that instantiate or have the prefab already loaded on the scene?
Jason Chandler
@jason-chandler_gitlab

@arundilipan
Any time! Unfortunately, I don't know the answer to that question for sure. I don't think it's intensive to use Resources/Load in that way though.

I seem to remember Selfsame's youtube video using it to make very artsy staircases and the like while in-game and it didn't seem to slow down at all.

Since prefabs are prefabricated after all, it should be alright to not have them in the scene graph as far as I know. Someone please correct me and @ all involved if I am mistaken.
fdamirv
@fdamirv
This is not possible to have multiple instances (meaning C# objects) of a prefab. But you can have multiple GameObjects, that is instantiated from one prefab. Every time you call (Resources/Load "prefabName.prefab") you will get the same C# object. This is how Unity3D optimizes resource loading.
Jason Chandler
@jason-chandler_gitlab
Ah I see. I misunderstood. Thanks!
fdamirv
@fdamirv
You can't store a prefab in Scene-graph. There may be only GameObjects.
Jason Chandler
@jason-chandler_gitlab
Ah, so having a GameObject that is instantiated from a prefab in the scene from the start does not really save any resources then.
fdamirv
@fdamirv
GameObject may be (or not be) an instance of some (only one) prefab. GameObject in Scene-graph references to prefab.
*refers
arundilipan
@arundilipan

Does state+ add state in-place to a GameObject or does it return an immutable representation of a GameObject? I wanted to do something like

(-> fireball
      (state+ :physics {:speed 10})
      (state+ :traits {:damage 10 :effect :burn}))

but I'm not sure whether that would work?

Never mind, it doesn't look like it
Saikyun
@Saikyun
You have update-state as well, where you can use
Saikyun
@Saikyun
-> and assoc :)
Saikyun
@Saikyun
I think you could use doto and state+ as well. :)
fdamirv
@fdamirv

Does state+ add state in-place to a GameObject or does it return an immutable representation of a GameObject? I wanted to do something like

(-> fireball
      (state+ :physics {:speed 10})
      (state+ :traits {:damage 10 :effect :burn}))

but I'm not sure whether that would work?

state+ returns just a value you pass as a last argument.
So you cann't use it in threading macro as you want.
update-state returns new value your state stored (similar to state+).

In your case:
(state+ fireball :physics {:speed 10})
will return
{:speed 10}
On the other hand
(update-state fireball :physics assoc :speed 10)
will also return
{:speed 10}
But if you later do:
(update-state go :physics assoc :angularSpeed 3.14)
then
{:speed 10, :angularSpeed 3.14}
will be returned.

So update-state does not fit to -> threading-macro.

But you can use another threading macro - doto:

(doto go
      (arc/state+ :physics {:speed 10})
      (arc/state+ :traits {:damage 10 :effect :burn}))
fdamirv
@fdamirv
Pay attention: doto will return go.
Saikyun
@Saikyun
I meant one could put threading inside of the update-state call :)
fdamirv
@fdamirv

I think you could use doto and state+ as well. :)

Sorry, i didn't see that. @saikyun already proposed doto

Le-Brut
@Le-Brut
@nasser thanks for the response on the time estimates! Very nice to see your progress on MAGIC.
Guys, am I getting the right vibe from the Arcadia's wiki that miracle is the only repl for emacs capable of the basic features such as completion and jump-to-definition? Also, do any of the repls support syntax checking?
I am also getting a warning that the expected Unity version is 2018 (I am using 2019.3). Any known bugs/incompatibilities for U2019?
@Saikyun Hi! I am trying to set up miracle and ran into a bit of trouble, how do I satisfy the clojure-complete dependency? I tried putting the repo in Assets as clojure_complete, did AOT compile but I am getting this error: https://pastebin.com/0KZP4CkR BTW Thanks for the tutorials, they were a good place to start!
Saikyun
@Saikyun
@Le-Brut hey, thanks for the kind words ^_^ I'm sorry about that awkward dependency, I believe you need to get this specific version: https://github.com/sogaiu/clojure-complete/tree/clr-support