#archived-code-advanced

1 messages · Page 13 of 1

chilly nymph
#

You expand your knowledge and practices.

jolly token
#

I'd say "single responsibility" as "responsibility you can summarize in one sentence, reasonable enough to convince other people and yourself"

#

There is no measuring tool, sadly

chilly nymph
jolly token
#

I'm waiting for the day 😌

#

Day of singularity

chilly nymph
#

I don't really understand what you're asking / saying.

#

public class Bear{ you have 3 of them you need to instance. That's easier than a god class.

jolly token
#

So you want a pattern that 'perfectly fit', not too complex nor too simple, to your team size and application scale. That is normal approach to begin with, but when the application grows it will become 'technical debt'.

undone coral
#

cluttered for whom?

#

unity is cluttered. making games is cluttered.

#

i would understand if you're making an extremely minimalist word based puzzle game, of which there are many, and for aesthetic reasons your editor has to be uncluttered because that kind of game is fundamentally about an organized vibe

#

but you know, you're in a lot of jeopardy over "feeling cluttered" right now

#

anyway in my engineering experience

#

1 scene

#

i've written about this before in this chat so i won't go into details

#

you just deal

#

you have a lot of tools to deal. you can use prefabs. you can use the hide and show eyeball icons in the hierarchy

zinc aurora
# undone coral unity is cluttered. making games is cluttered.

not talking about eliminating clutter in it's entirety, everyone knows that's impossible but have you ever heard of using good practices for organizing development projects? haha, if you haven't, I'd hate to be you when you are looking for things in a project.

undone coral
zinc aurora
#

scenes is just another way i organize

undone coral
#

i don't think it's that big of a deal

#

i don't think you should use scenes

#

scenes are obsolete

astral sky
undone coral
#

nobody should be using them, nested prefabs have obsoleted them

#

you end up doing all this stuff to unwind how annoying scenes are, like don't destroy on load

undone coral
#

and whatever you're going to have to do to make something as extremely basic as a loading screen

#

i think you dno't need a load scene

#

i described how simple it is to throw up a screen

#

without a separate scene for it

zinc aurora
#

you only saw one method in it so maybe that's why you were confused

#

that's the top portion and the only other thing in the script is just a method to start the coroutine

#

i didn't create a whole scene for a loading screen yeahaha

undone coral
#

i think as soon as you use DontDestroyOnLoad

#

you are in jeopardy

#

we can talk about how you can get rid of scenes instead

#

you should just turn the contents of your scenes into prefabs

#

prefabs are a superset of features of scenes

#

without any of these warts

#

@zinc aurora is that helpful?

#

i'm not sure why it has to be don't destroy on load, or even a singleton.

#

i contribute to com.unity.webrtc

#

do you need help with it?

#

okay, i don't think you are 100% there yet

#

in terms of understanding how this stuff works

#

i just couldnt find any example for external webrtc url render/display
what i am trying to tell you is that there is no such thing as a webrtc url

#

you have to use signaling

#

webrtc is a library that expects objects called offers and answers, which are essentially json blobs that you have to provide it via whatever method you choose

#

there is no adopted standard for those methods

#

there ARE standards which no one has adopted

woven kettle
#

hey,

when I use the command texture2D.SetPixel(2000, 3, Color.red); if the point is outside the texture boundaries it goes to the other side.

for example if the point is far beyond the left boundary (x), it goes to the beginning of the right.

how do I stop this from happening ?,(I want it to just return if the point is outside the texture2D boundaries. , I dont want to appear on the other side like pac-man) ....

anyone knows ?

chilly nymph
chilly nymph
#

What's the issues?

#

I can also guess your ypixels are not set.

#

Can you break point.

woven kettle
#

how ?

chilly nymph
#

Drop a red boi

woven kettle
#

how to even check if its on the texture or not?

woven kettle
chilly nymph
hollow yacht
#

can anyone help me with a camera movement script?

woven kettle
chilly nymph
woven kettle
#

nope

#

throwing it in the garbage lol

narrow robin
#

Hi, I have a little question, I don't know if it's considered advanced or not but I thought it would better fit this channel:
Would anyone happen to know how I can include some sort of compile in my code without having the user install a dev environment like visual studio?
Or would it be easier to make a pre-compiled executable and make the client run un-compiled source files? (If that can be done at all in csharp of course)

plucky laurel
#

modding?

#

you can use lua/moonsharp lua lib, you can use roslyn compiler to compile on runtime, you can use csx roslyn scripting

narrow robin
#

Sort of, basically trying to make some custom editor, so I don't know if I can necessarily ask, but I thought I would try

plucky laurel
#

most mods dont need a specific compiler framework, its all handled by bepinex or harmonylib

narrow robin
#

Basically I'm trying to make some game similar to how Frog Creator did it or Eclipse Origins (Some old softwares)
But using csharp instead of vb6 like they did

#

That's what I mean by sort of modding

plucky laurel
#

if you want cs in the game itself, you have to study roslyn, there is everything you need to compile code jit

narrow robin
#

Oh I see, so it's sort of like hot-reloading the code without necessarily compiling?

#

That could work, many thanks!

plucky laurel
#

no it compiles code as usual

#
  • you cant unload the assemblies it compiled, each new compilation will generate a new assembly and it will take priority over the old
narrow robin
#

oh I see, will take a look into it then

plucky laurel
#

Microsoft.CodeAnalysis.CSharp

#

could have changed, last used it long ago

narrow robin
#

oh It's already included in the codeanalysis library?

plucky laurel
#

should be, scripting can be in a different one

narrow robin
#

Alrighty, huge thank you! 🙂

plucky laurel
#

by scripting i mean csx files

narrow robin
#

Yeah, I mean the end product would have all the code already there, but the editor could modify their data and maybe add functionalities using scripts, so I didn't really know where to start to for compiling anything working at the end haha

undone coral
#

what is the game?

#

it's best to support the modding that people who like to mod will actually do

narrow robin
#

It's more like a game editor than a full-on game, similar to RPG Maker if that makes sense

undone coral
#

yeah

#

so you expect the end user to program inside your app?

#

in some sort of scripting window?

plucky laurel
#

that is critical

narrow robin
#

That and with events and such

#

but yes

undone coral
#

i think lua will be best

#

moonsharp or whatever it is

narrow robin
#

Oh yeah, I mean the scripting part isn't necessarily a problem, I just didn't know how I could make the program so it would compile the project into a game executable with only the assets/graphics being uncompressed.

undone coral
#

okay

#

i would call that packaging

narrow robin
#

Or at least without having the user install vstudio for it

#

Yes packaging, sorry haha my brain is super slow

undone coral
#

for windows?

narrow robin
#

For now yes

undone coral
#

and would the end product itself be, in disguise, a unity player?

#

or do you plan to author some kind of your own executable?

#

what is the thing that people are making?

narrow robin
#

Sort of yes, Basically it would compile in a single executable like unity packages it, but with the possibility to modify the game without having to install unity and all the dev environment stuff

undone coral
#

concretely

plucky laurel
#

that doesnt sound like something unity eula allows tbh

narrow robin
#

Yeah taht's why I wasn't sure I could ask

undone coral
#

single executable like unity packages it
android and ios have a single package file, macos has a special directory and windows is not a single file

plucky laurel
#

there are plenty of other engines/frameworks you can use for this that dont put restrictions

undone coral
#

but specifically what is it that users are making?

narrow robin
#

I'm basically making a Game Editor of sort similar to RPG Maker but MMORPG.

undone coral
#

okay so

#

in this editing application

#

well, it sounds like you are trying to create roblox studio

#

to create roblox games

#

not Roblox, but roblox with a lower case r

narrow robin
#

like that yeah but for retro games like Final Fantasy and such

undone coral
#

okay

#

i'm sure you're aware this is extremely ambitious lol

#

let's talk about how roblox studio works

#

first, there is no packaging

#

because it's redundant

plucky laurel
#

pangloss goes on a tangent 🍿

undone coral
#

lol

#

i'm trying to help Mr Quest here achieve some big dreams!

narrow robin
#

Lol to be fair I often go on tangents

undone coral
#

so why do you need packaging?

narrow robin
#

I'm not planning on selling this, it's literally just a fun project for not completely stopping programming

undone coral
#

i know

#

yeah

#

well

#

is it like networked?

#

does it have to be networked multiplayer?

#

or single player final fantasy experiences

narrow robin
#

probably both

undone coral
#

okay

narrow robin
#

I mean I know how to do most of that stuff

undone coral
#

you are making roblox studio architecturally

#

you won't have packaging

narrow robin
#

I was just unsure how I could "package" so it wouldn't require installing anything other than either runtimes or .net framework

undone coral
#

you would have an end user binary that is the only binary you download

#

yeah of cours

#

but you would hae a grid of games that people have authored

#

in the menu screen

#

and the end user would choose it to play it

#

the "package" would be a deep link into your application

#

the most an end user would have to distribute is a URL

#

it doesn't make sense to do it any other way

#

so it would be onemorequest://application-id/199910921

narrow robin
#

Let me see if I can maybe find an example of what I mean

#

or rather an image of it

plucky laurel
#

gmod?

undone coral
#

that will tell the binary that everyone has to download all the assets you host at https:/jfido2u901hf.cloudfront.net/mygame/apps

#

no i get what you want

#

if you want to do it that way

#

you would have to have 1 binary that is used for all the packaging

#

that loads the asset bundle or whatever

#

i think this is a bad idea though

narrow robin
#

I mean I want to basically remake a RPG Maker but for both mmo and rpg

undone coral
#

because it is worse in every way

#

for the end user, for the game author, for you

#

to make it that way

#

it makes more sense to host the assets for the modder and the end user

#

the end user launches OneMoreQuest.app and picks the game from a list, or arrives at it directly via a deeplink

#

anyway that's all, that's my perspective

narrow robin
#

I want to basically allow the end user to simply export the project for release without having to bother with vstudio.
In the end they will be able to use their own assets if they want to.

Same as how rpg maker does it basically

undone coral
#

well that's a colossal amount of work

#

more than hosting it yourself

#

and doing it the way roblox does

narrow robin
#

But I think I have an idea on how I could make it happen.
Worst case I can always try and reference from Frog Creator's source even though it's in old vb6 stuff

undone coral
#

and the experience for everyone would be inferior to how roblox does it

narrow robin
#

But I'm not trying to make a new roblox necessarily

#

I just want some sort of editor that they can export a game with like rpg maker's games for example

undone coral
#

that is hard to do

plucky laurel
#

you are making an engine

undone coral
#

you should start with maybe making your own example game moddable

narrow robin
#

Sort of, which is why I wasn't sure if I could ask here haha

plucky laurel
#

and using unity as a library for your engine

undone coral
#

and expect people to distribute the binary + mod

#

then you can turn that into your template

plucky laurel
#

which makes me ask why use unity at all

narrow robin
#

I don't necessarily plan on using unity, I just didn't really know where else to ask since usually unity people are really knowledgeable on such stuff

#

Also, the only part I consider harder to do is simply the packaging at the end, the rest is all more or less simple code to implement that I've already done in the past.

#

But yeah I might be better off asking on stackoverflow so I don't break rules here since my goal isn't to make anything to compete with unity, simply a simple editor for funs of programming from scratch haha.

#

Still huge thank you for the help 🙂

undone coral
narrow robin
#

I mean I come from making games from scratch completely using sdl2 and opengl, so all the logic stuff is fine.
I just never got to adding such a feature to compile a game from within the application

undone coral
#

the networked persistent world part sounds hard to me lol

#

that you want to let people script

narrow robin
#

It's not hard doing it the way Rpg Maker did it, which is the simplest way to make it work out even on a multiplayer

#

They use events in the map to trigger that script, where as I would add a global event area that runs throughout the entire game to allow those scripts to run without more work than scripting.
But scripting isn't a problem for a long while still.

I plan on having preset actions they can use in events before adding that.

But yeah I think I already have an idea on how I'll package the game whilst allowing for changes.
Many thanks for trying to help!

jovial totem
#

not a particularly advanced question, but the general channel is currently taken by an argument. I have this problem:
I have an object that should keep its position relative to the main camera (moon), and then rotate about the camera's position by a certain amount. However, I cannot simply parent the moon object to the camera because then it inherits the camera's rotation, which I do not want. (and also the camera is marked not to destroy on load which could present its own set of moon duplication issues.)
How should I go about solving this problem, or should I take a different approach to having a moving sun and moon?

jolly token
jovial totem
narrow robin
#

I don't know if unity has that, but can you select a light source for the sun?
If so you can control it's position through that light and the skybox should update with it. Just need to make sure it's a directional light source and you can most likely update the skybox images whilst using the same method if you want a better effect. For example having a starry night and a cloudy day. But depending on the skybox material you use in the first place, those might already be there.
And if you don't have that by default, you could always make a script update the skybox rotation according to your light source's rotation.

chilly nymph
#

Hey gents, what's the best process for token based auth in unity at the moment? My server passes back my webapps a token and also a JWT (login auth, and project auth). Just want to know the best way to go about it at the moment.

jolly token
chilly nymph
#

Is there a way I can consume a JWT in unity?

#

Or will I have to parse it myself?

flint sage
#

You'll have to parse it yourself

#

(using some library probably)

chilly nymph
#

Fun

hushed moth
hushed moth
chilly nymph
#

You should just use a token.

balmy prism
#

i have implemented a tilt of camera while wall running but for some reason sometimes when i get off the wall it tilts my camera permanently nad my controls are wierdly inverted

wet vale
#

am using this code to drag objects in my scene
the problem is when i use Mathf.clamp
is that my object change orgin
any ideas?

balmy prism
tribal hinge
#

I'm self taught and have tried to seek that information myself recently... Didn't find a whole lot. Specifically how to do Unit Testing

#

My guess is that it's too specific per game project to give general advice for? Not sure

#

Except for people like me who build their own engine on top of Unity in order to bypass it's shortcomings

wide bolt
#

This is a debate we had regularly at a studio I used to work for. I'm all for unit testing and try to add tests where ever possible. The argument against it in games is that the fundamental "Success" condition for a game is not testable. The real strength of testing is making sure that recent code doesn't break old code, but if, for example, the code you broke just makes the particles look like crap, you wouldn't be able to write a unit test for ParticlesLookNeat. Obviously there are very testable parts of all games, especially if you do a good job of architecting your views away from your models and controllers. I'm just giving you the devils advocate version of why some devs avoid it in games.

tribal hinge
#

A lot of the game logic is not graphical though !

wide bolt
#

Once the decision was made not to use a proper automated test suite, I started loading up my code with Asserts. Proper tests would be better, but you can get pretty close with asserts.

#

There are not shortage of arguments for tests. Especially when working on a team. It essentially makes it impossible to break things, even if you don't know the whole code base. But the real advantage comes with Test Driven Development. When I started organizing my thought process into TDD terms, my productivity and code quality went through the roof.

#

I've never looked into BDD. I should probably spend some time researching it.

#

Just read a little right now. Seems like it addresses higher level issues than Unit Tests usually would, so I guess it's not a "One or the other" type thing.

tribal hinge
#

I am a firm believer in having core game systems entirely separated from their graphical counter parts, so what I meant by game logic was making sure the game systems classes pass that testing

maiden turtle
#

or the user interactions

wide bolt
tribal hinge
#

Yeah how I do it in my current game is the game logic classes are not Monos but take a GameObject as a constructor - but they don't need it to function. Then on the prefab I put Monos that control the animations and such (that reference the game logic class)

#

That plus events it's pretty easy to just keep my core game logic independent from whatever unity is doing

rugged radish
#

same, all the object logic and system logic resides in plain classes and monobehaviors only have view logic, and some of them also controller logic

hot lintel
#

This is a tough question, so I'm not exactly sure how to ask it.
I'm using PUN to make a networked game and I want to introduce Agents that can play in place of players.
My problem is, I don't know how to call PhotonNetwork to actually add these agents because the Photon.Realtime.Player class is internal protected. I can't actually instantiate the class outside of Photon it seems? What would you do instead then?
In order to call AddPlayer() on a room I require some Photon.Realtime.Player derived object.

sly grove
#

there won't be one for an AI character

#

you need to introduce these characters at a different abstraction level

hot lintel
#

Hm

#

Any tips on how to do that?

#

When I google around I keep seeing people asking similar questions on forums but not getting an answer from PUN developers or others

sly grove
#

Well first of all

#

PUN is olllld

#

it's their oldest, crappiest networking solution

#

idk why people are still using it

#

Photon has a lot of much newer, much better solutions

#

secondly, it's a networking framework, not a game framework

#

you'd make your own abstraction if you want. Like:

class Character {
  public Player owner; // If null, this is a server-controlled AI
  // everything else.
}```
hot lintel
#

I'm kind of new to networking and I didn't pick the framework

#

I just have to work with it

sly grove
tribal hinge
#

This is the kind of thing I was trying to find out about how to do

buoyant depot
#

Is there anyone that has a strong knowledge of physics with collisions and detections?

west scarab
#

Anyone here used C# as a scripting language for a game? Advantages, disadvantages?

sly grove
#

It also won't fly on platforms like iOS

west scarab
#

That's what I thought

#

What happens if you just don't pass any assemblies like System to it? It wouldn't be able to use any "dangerous" calls like writing to files

sly grove
#

I've only really used LUA/MoonSharp in Unity for this, but I'm sure there's other approaches

sly grove
#

And not sure how to practically prevent the loaded assembly from containing references to System etc.

west scarab
#

The roslyn compiler lets you execute strings as C# code, but you need to explicitly make assemblies available to it

sly grove
#

hmm.. maybe something like that is possible then? I've never seen that approach in action so not sure

#

if it works as you say I could see it maybe being possible to just pass them your custom "game interface" assembly and they can only interact with that

#

I'd still be a little wary because I feel like there's probably a way they could just include a binary payload that manages to access things even without having access to System assemblies.

#

Seems relevant, not sure there's good answers here though

west scarab
sly grove
#

yeah ofc, I'm just not totally confident about how sandboxed that actually is

west scarab
#

I have no idea how it fares performance wise though

sly grove
#

or that

#

probably can't be worse than an interpreted language though right?

west scarab
#

Depends on how long the compilation takes I guess

#

It hangs the editor for like 5 seconds

sly grove
#

it's also an upfront cost

west scarab
#

Not sure if that's the compilation or the initialization

#

After that it's fast

sly grove
#

yeah I could easily see a "mods" menu in the game where you load a mod (and do the compilation there) and then it's gtg. that's a fine user experience

west scarab
#

Yeah that would be fine. Gut feeling would be that runtime performance would be pretty good (at least faster than python / lua), but that's just guessing

sly grove
#

agreed

#

Other thing though is... does this force you to use Mono, or at least include Mono somehow in your game?

west scarab
#

I have no idea, I started playing with it like 10 minutes ago 😅

sly grove
#

I feel the compiler wouldn't work in IL2CPP

#

worth thinking about too

west scarab
#

Definitely

west scarab
sly grove
west scarab
#

I used it shortly a few years ago but non-hardwired performance was terrible, and iirc I never tested the hardwiring

#

tbf reflection is just slow

#

So I can't really blame them

sly grove
#

Yeah the thing I used it for was not performance sensitive at all so I believe it.

#

I was basically building a dialogue system with it

woven kettle
#

Hey,

I have lots of tools that reacts to collision (hammers, shovel, electric drills , laser drill... etc) , some of them physically, others are raycast or projectile.

my current setup is that I have script for projectile with the collisions function within the same script, and the same for every other type of item ( total of 5 I think)

is it a bad idea if I separated the collision part in a separate file ? would that negatively impact the performance specially for fast tools ?

west scarab
west scarab
woven kettle
sly grove
crude isle
#

@woven kettle also don't worry about performance at this stage. Get the code working and then profile your project if you start having FPS issues.

woven kettle
#

i think I might need to return something bk to some tool , because the tool also needs to know what it hit and reacts on it

woven kettle
crude isle
#

@woven kettle have a base ToolCollision script, make different Tool collision types (triggerEnter, Raycast, etc) that derive from that base, and have your tools just listen to an event from ToolCollision based on the result of the collision, which sshould more or less be the same between all collision types

#

Tool shouldn't care how the objects it's target where found

woven kettle
# sly grove Wdym?

when the projectile/physical hit a special object, I need to return some bool/int value to the function that caused it to react on it. .. like if an electric hammer was hitting sand just fine then it hit a metal rock, it should tell the hammer that it hit an "unbreakable" object .. and the hammer will temporarily disable then and deflect a bit.

#

would returning a small value like bool or int between 2 different scripts impact the update function much?

sly grove
#

No

crude isle
#

@woven kettle Nope that wouldn't impact performance at all. You're going to drive yourself crazy preemptively optimizing trust me. Also, I don't see why you would need it in an update method. Just rely on Unity's built in Physics to find your collisions when they occur and pass along the results to your Tools.

woven kettle
undone coral
west scarab
undone coral
west scarab
#

I'm sure it's possible, I was more looking for potential pitfalls in the context of a videogame to watch out for if anyone here has used it to a more extensive capacity

jolly token
crude isle
#

@jolly token Yeah I'm still digesting it in my brain (im slow). My confusion right now is how I would structure my components and the actual ItemEffect behaviors within this type of structure. I'm probably gonna have to actually try to implement it before it clicks.

jolly token
crude isle
#

@jolly token or more like what the workflow for making a PassiveItem would be like. Interfaces make serialization annoying and I prefer to make my components very lego-blocky.

#

@jolly token ill be diving into it soon™. For sure, Ill let you know how it goes!

jolly token
crude isle
#

@jolly token True, EventTrigger is a class anyway I could just make it abstract monobehavior I guess and wrap the rest into base classes. That is... if I understand your code correctly at the moment lol.

#

I've never used contravariance or w/e it's called before. I need to read up on it and make sure I fully understand whats going on.

#

my current basic understanding is it's just a generic constraint that accepts derived classes, right?

jolly token
crude isle
#

that's it? Just works like a normal generic?

#

oh

jolly token
#

"covariant" is accepting derived classes
for example IEnumerable<object> can accept IEnumerable<string>

crude isle
#

hmm... I thought thats how normal generics worked too though lol.

jolly token
#

"contravariant" is opposite

crude isle
#

@jolly token Oh okay. I think I get it.

jolly token
#

contravariant is to accept less derived class, specifically

#

If you see the sample code, I made IItemEffect contravariant
So IItemEffect<SpecificEventParam> can accept IItemEffect<GenericEventParam>

crude isle
#

@jolly token That makes a lot of sense and I'm think I'm starting to get it

#

you constrain to a derived type but a contravariant constraint can accept the base type.

#

going backwards along the class heirarchy

jolly token
#

Yes, and that means you can only use it as input parameter type. That’s why it use in keyword.

#

Covariant is opposite. You can only use it for return value and it uses out keyword

west scarab
#

Is it not possible to have multiple draggable GUI.Windows?

#

Only one of them is draggable while I have multiple open

plucky laurel
#

it is possible

#

make sure they have unique ids

west scarab
plucky laurel
jolly token
#

interfaces are cool and can solve many problems 😄

unkempt nova
#

Can also create new ones

#

Look into covariance vs contravariance, it gets tricky

jolly token
#

variances are only possible in interfaces btw 😄 (and delegates)

#

But it's all about type safety, it shouldn't cause more problem if used correctly

long rock
#

I have a mono which creates an object and passes a delegate to through the constructor. The delegate references a method of the mono. When calling the delegate in the constructor everything is fine( I store it in on the delegate in the obj), but when I call the delegate later on in that obj it is null. Does unity loose the reference to the mono ? I am little bit lost here 🤔

wide bolt
long rock
#

Nope normal c# obj from normal class

wide bolt
#

Hmmm, I can't think of any reason that the delegate you described would only be available in the constructor. Do you have any code you can share?

long rock
#

I'll try to paste it from plastic sec

#

Mhm seems I cannot reach any code from mobile here

wide bolt
long rock
#

If it is ok for you I'll pm you and post it when I get back to a PC tomorrow

undone coral
crude isle
#

@undone coral Yeah I looked around in there for a bit. Cool projects, but I haven't deep dived them yet. I'm sure I could learn something when I take the time

undone coral
#

your Binding of Isaac esque game, is all the game logic centralized in one place, separate from unity

#

or is it spread around a bunch of monobehaviours attached to game objects?

#

like is it "decoupled"

crude isle
#

@undone coral I guess you could call it decoupled. At least by my definition of the term lol. I was going for the whole composition/lego blocks strategy with my scripts.

undone coral
#

it's really really hard to do with things being decoupled

#

it's basically impossible

#

if you wanna keep doing the decoupled thing

#

your best bet is

#

i guess i need an example that makes sense for you

#

like what is an item in your binding of isaac: decoupled that you want?

#

describe the pill

#

or whatever it is

#

the effect

#

a concrete effect

crude isle
#

@undone coral One idea is an Item that drops an AoE zone at the start of a player Dash. The zone applies a slowing status effect on enemies that pass through it.

undone coral
#

okay

crude isle
#

I could just make that extremely easily.

undone coral
#

yes

#

you have to!

#

you went with decoupled

#

you have no choice

#

it adds and removed components to the enemies as they enter and leave the zone

#

or whatever

#

it checks which enemies are inside in an update and modifies their speed, or everything's Speed property queries for SpeedModifier components on the same game object

crude isle
#

i just want a more design time friendly setup that lets me mix and match triggers and effects in creative ways

undone coral
#

i know!

#

but it's too late

crude isle
#

I have a StatusEffect system already in place

undone coral
#

i mean, is it that unfriendly, the system you have?

#

yeah

#

i know you want

crude isle
#

Well I don't have the system yet 😢 Unless you meant the StatusEffect stuff, in which case it's very friendly imo.

#

working on that lol

undone coral
#
{
 "class": "Item",
 "name": "Slow on Dash",
 "triggers": [{
   "class": "DashStartTrigger",
   "eventSource": "PLAYER"
 }],
 "effect": {
  "class": "SpawnEnchantmentEffect",
  "location": "EVENT_LOCATION",
  "lifetime": {
   "class": "FixedLifetime",
   "seconds": 3
  },
  "enchantment": {
    // lots of ways to do this
    "class": "PassiveTargetMembeshipEnchantment",
    "target": "ALL_ENEMIES",
    "filter": {
      "class": "CircularDistanceFilter",
      "radius": 5.0,
      "center": "EVENT_LOCATION"
    },
    "effectOnMembershipAdded": {    "class": "ModifySpeedEffect", "operation": "MULTIPLY", "value": 0.8},
    "effectOnMembershipRemoved": {    "class": "ModifySpeedEffect", "operation": "MULTIPLY", "value": 1/0.8}
  }
}
#

i know this is what you want

#

but this is really really hard to set up

#

since you've gone decoupled you just gotta make all these as components and slots and stuff

crude isle
#

That type of system is definitely way too complex. I just wanna be able to Drag a "OnDashBeginTrigger" and then a "SpawnObjectItemEffect" and it "just works" (after lots of blood, sweat, and tears...).

#

Yeah with components and stuff

#

the details outside of the architecture I already have in place mostly. I just can't find a comfortable solution to handling the event data from the trigger to the ItemEffect. I need to experiment with the interface approach linked above and see if I can use it properly.

high lake
#

Is there a way to calculate the closest point to a point on any collider (both from inside and outside the collider)

Physics.ClosestPoint only works on BoxCollider, SphereCollider, CapsuleCollider or a convex MeshCollider, so no non-convex mesh colliders.
Not only this, but Physics.ClosestPoint only works when the point your checking is not inside the collider, if it is inside it just returns the original position instead

jolly token
#

Or any point on collider surface?

high lake
#

Technically I could use Physics.ComputePentration and make one collider a tiny SphereCollider but that just seems a bit of a weird workaround to me

#

especially since I would need to create a SphereCollider everytime I want to get this closest point
This also only works if the two objects are intersecting, and if I used Physics.ClosestPoint to accomodate for this, it will fail for non-convex colliders such as planes

jolly token
high lake
undone coral
#

is that helpful?

undone coral
#

@crude isle then you do

class GameLogic {
 void Move(GameContext context, Actor actor, ...) {
  var baseSpeed = actor.BaseSpeedBeforeModifiers;
  context.PushValue(baseSpeed);
  FireEvent(new OnBeforeMoveEvent(actor));
  var modifiedSpeed = context.PopValue();
  ... blah blah blah
  FireEvent(new OnAfterMoveEvent(actor, ...));
 }
}

class ModifySpeed : OnBeforeMoveTrigger {
  float multiplier;
  public override GameEvent[] interestedIn => new [] {GameEvent.ON_BEFORE_MOVE};
  protected override void OnFire() {
   var baseSpeed = context.PopValue();
   baseSpeed *= multiplier;
   context.PushValue(baseSpeed);
  }
}
#

but then all the moving has to go in the same place Move

#

why pop and push value?

#

because it should be clear that you can do

#
class ModifySpeed : MultiplyValueTrigger {
  public override GameEvent[] interestedIn => new [] {GameEvent.ON_BEFORE_MOVE};
}
#

@crude isle the science of all of this isn't "i make a thing called triggers and events" and litter your codebase with these things

#

the secret is realizing that your game effects are functions, and the signatures are like, it takes a value

#

and you shouldn't have a speed and a damage and a healing, you have a value and a value and a value

#

anyway i hope this is helpful, feel free to share more detailed code and we can talk about it 🙂 @crude isle

formal falcon
undone coral
#

lol

formal falcon
undone coral
#

try Find Usages in your licensed copy of Rider

#

😎

jolly token
#

What is the good way to add 'hook' to pre-loading timing of scene?
Context: I'm building DI container and want to inject some dependencies before Awake or OnEnable timing.

undone coral
#

or a bog standard static

#

which will execute on the main thread and be run at the "right time" in a sense

#

as soon as you touch the type

#

or script load order.

#

you can do a RunOnLoad editor script to programmatically set script execution order to -1000000000000000

#

00000000

#

000000000000000000000000

jolly token
undone coral
#

you can register a SceneManager.activeSceneChanged

jolly token
undone coral
#

probably too late though

jolly token
#

Yeah sceneLoaded was too late

undone coral
jolly token
undone coral
#

exactly

jolly token
#

I'll make sure to add plenty of those

undone coral
#

you can try to use static constructors

#

to side-effect loading everything in the right order on demand

#

Real Dependency Injection

sly grove
jolly token
#

static constructor per scene?

undone coral
#

yeah that might work

jolly token
#

What about when reloading 😂

undone coral
#

but you can't automate that for a user

#

lol

#

yeah...

jolly token
undone coral
#

i am struggling to come up with something simpler than script execution order

sly grove
undone coral
#

the whomst've?

undone coral
#

oh shit

#

that's a bad boi

#

yeah you should use that

sly grove
#

lol - it's liable to break though - being undocumented and all

undone coral
#

my dependency injection searches Resources at a well known path and instantiates all the prefabs with the right types on it

#

this has been the most reliable for me

#

since it always works 100% with il2cpp

jolly token
undone coral
#

because otherwise you have to [Preserve] or modify link.xml

jolly token
undone coral
#

all the stuff in all Resources folders everywhere gets the right amount of code stripping

#

Resources is dependency injection lite

jolly token
#

Is it even you set stripping as High or something?

undone coral
#

hmm

#

good question

undone coral
#

but yeah if i was doing "a mobile"

steel sluice
#

Hey guys. I have following problem: P is the player, E is the enemy. CAM is the camera.
The player is looking to the Enemy.
So since I multiplied the Cam.forward vector with the input, I already get the Player to move according to the viewing angle.

Now I have the problem that the animations are off.

For example on the picture:
When I press the forward button, I want the player to play it's "walk left" animation (float horizontal = -1)

I don't know how to do the maths... Can somebody help me?

In the picture's example, when I press forward (W), the player plays his walk forward animation because the input is not relative to his rotation

#

I hope i describes it understandable 😅

#

When I move the player relative to his rotation, the animations work, but the movement feels off. (He will not move in the direction relative to the camera. This is crap)

For reference: I want it to feel like in assassin's Creed

zenith ginkgo
steel sluice
#

The horizontalVel is my normal move vector?
(Cam.forward*player.forward + cam.right+ player.right?

zenith ginkgo
#

Looks like it aye

torn basalt
#

Okay so I am pretty close now. I think I just need a nudge in a direction. I have 2 solutions for pushing or pulling a cube. 1 uses vert because I also want to drag the verts of a face in the x or z axis using my forward or back motion of my Oculus controller.

Solution 1 : Verts

Problem is that I can't seem to get the verts z or x position to line up with the ray point


                    for (int i = 0; i < surface.Vertices.Length; i++)
                    {     
                        surface.Vertices[i] = new Vector3(surface.Vertices[i].x, surface.Vertices[i].y, posZ.z + 1);
                    }

                   selectedObject.GetComponent<MeshFilter>().sharedMesh.vertices = surface.Vertices;

                   selectedObject.GetComponent<MeshCollider>().sharedMesh = surface.filter.sharedMesh;
               ```

Solution 2 : Transform

Problem : The isSide is a bit of a hack but it will only work if the walls ware separate objects. What if its an inverted cube and I want to push/pull the sides in or out?


``` Vector3 posZ = primaryController.transform.position + transform.forward.normalized * primaryController.rayDistance;

                    if(surface.isSide)
                    {
                        selectedObject.transform.localPosition = new              Vector3(posZ.x,selectedObject.transform.localPosition.y, selectedObject.transform.localPosition.z);

                    }
                    else
                    {
                        selectedObject.transform.localPosition = new Vector3(selectedObject.transform.localPosition.x, selectedObject.transform.localPosition.y, posZ.z);

                    }```


Any help would be great.
torn basalt
timid chasm
#

hey i need help with my code please

#

i made chicken invaders 3 and sometimes when 2 bullets hit an enemy it kills it twice

#

and everything after that gets wierd

#

it's like every script doubles itself

sly grove
#

and use an if statement to check if it's dead already

sly grove
#

I don't think "number of components" is really something to think about.

#

there's no number you would reach where you say "this is too many scripts"

#

as long as you stick to the single-responsibility principle and make modular, reusable scripts

#

you have nothing to worry about

#

I didn't say make it too complex

#

making modular, resuable scripts naturally leads to script re-use and composition

#

which simplifies things vs trying to shove a lot of unrelated behavior into few scripts

#

also reinforced by the single responsibility principle

timid chasm
jolly token
#

Is it about complexity/maintainability or performance?

#

Ideally: zero SO 😄

errant plinth
#

Going for an "ideal" number of SOs smells a bit like going for an ideal LoC

#

Trying to aim for metrics based on LoC is where it's potentially harmful

#

Can be an indicator of issues when it's different from expected. Can be useful

#

But when used as a KPI it'd be more likely to lead you astray

jolly token
#

I'd only allow SO when I have specific editor needs for it 😛
(e.g. Animation Curve, Behaviour Tree editor, etc)
Otherwise I go for spreadsheet

#

Though about classes, I can't say more than "You don't need more abstraction than you need"

static marsh
#

I have an IPostprocessBuildWithReport inside of an assembly which is constrained by a define DISABLE. This is supposed to handle removing native libraries which do not belong in some build configurations. Those build configurations include DISABLE in BuildPlayerOptions.extraScriptingDefines which is passed to BuildPipeline.BuildPlayer.

If I manually add DISABLE to the scripting defines list in Project Settings, this works correctly; the native libraries are removed from the build. However, when that define is only added to extraScriptingDefines, the native libraries are not removed.

It looks like extraScriptingDefines does not affect editor assemblies? Is there a better way to go about this?

jolly token
static marsh
jolly token
crude isle
#

Okay so I believe I actually figured out my issue with Passive Items... Took me a while to wrap my brain around it. Thanks to everyone who helped, it got me out of my tunnel vision. @jolly token @regal olive @undone coral (sorry if I missed anyone, way too much chat history to go through)

Here's a link to 4 (very large) pics that show my script setup in case anyone is curious. It's a bunch of Code screen shots since I'm not sure the best way to share this stuff... :

https://imgur.com/a/vmVR7Nr

So far I haven't found an issue with it. I have several test Items working! I can do some pretty cool shit with it I think (and hope).

grave vortex
#

someone can help me via screen share?

#

looking for help with decomposing quaternion

chilly nymph
grave vortex
#

just need some explanation from someone good with linear algebra

#

are quaternions part of linear algebra?

jolly token
undone coral
static marsh
undone coral
#

i don't know is that essential?

#

i see it all the time

brisk pasture
undone coral
#

anyway i think there's a checkbox

static marsh
undone coral
#

but yes

#

it's tough

brisk pasture
#

ah did not read enough

static marsh
brisk pasture
#

yeah for native libs its a pain in the ass

undone coral
#

yeah

brisk pasture
#

best i have done, is a stupid branching scheme

#

could ignore the libraries in there proper locations in vcs. store them elsewhere in the project, then on build move copy the correct ones into your plugins folder

#

tedious though

static marsh
#

I've actually encountered a different, potentially worse aspect of this issue though: Scripts which use the define are not recompiled. I suspect this is a bug in the incremental build system somewhere... The non-Steam build became stuck with the Steam-exclusive build UI changes, until I either cleared the Library folder or modified the UI scripts that had the #if statements

#

I haven't had to work with this code in a long time, so I don't know at what point it broke. I'm on 2021.3.8f1, using IL2CPP

#

Forcing a recompile with CompilationPipeline.RequestScriptCompilation(RequestScriptCompilationOptions.CleanBuildCache) after calling PlayerSettings.SetScriptingDefineSymbols did not resolve the issue

silent jungle
#

Hey guys,

I am experimenting with compute buffers and the drawmeshinstancedindirect function to achieve some LOD related results. My plan is to have one compute buffer that will store data that several drawmeshinstancedindirect calls will utilize with different meshes.

Is there a way to tell the GPU only use a subsection of the compute buffer when rendering?

chilly nymph
sly grove
silent jungle
#

In the drawmeshinstancedindirect function there is an argsoffset parameter that acts as an index offset but the issue is that it doesnt state where it should stop

chilly nymph
sly grove
#

you can pass whatever data you want into the actual rendering shader via the material

silent jungle
silent jungle
silent jungle
#

I guess a follow up question is how to stop lol, how can I abort an instance call in the shader?

sly grove
#

you can't

#

If you don't want to draw something, don't call Draw

#

if you don't want to run the compute shader, don't call Dispatch

static marsh
#

@undone coral In response to your question emote: We use defines to switch some things in the UI, depending on if it's a Steam build or not. We also use defines to disable the in-game cheat commands in release builds. When switching from a Steam debug build to a non-Steam release build, the Steam-specific UI was still in use. I didn't think to check, but I am assuming the debug-only cheat commands were also still enabled in the release build.

#

Running a clean build solved this problem. So it looks like this is a bug in the incremental build system in 2021.3.8f1

dreamy coyote
#

im a beginner and i was wondering what kind of math is recommended to learn

livid kraken
dreamy coyote
#

when you get into more advanced scripting, what kind of math should one expect to learn and apply?

devout hare
#

Depends on what you're scripting

dreamy coyote
novel plinth
#

Calculus and Linera algebra, very useful for vector maths

#

but I've stumbled a person at work, he can't do advanced math etc... But what he can do was scrapping SO for algorithms, and luckily he can applied to the game or the system he's working on.. He's been working at the same company as mine for more than 2 years now 😆

dreamy coyote
#

lmaooooo

dreamy coyote
fickle obsidian
# dreamy coyote for someone like me who has a good understanding of calc 1 and is learning calc ...

having a solid foundation is likely decent enough. working in production, you never really know what you may have to build. I'd say the close you are to graphics, the more granular your understanding of maths, the better. as for general gameplay programming, i find a solid primer of linear algebra, and trig can help you intuit a lot of the cases where you'll need to apply a solution to match a development need. if you can help describe a desired result with a concrete mathematical example, chances are there's a starting place in a library or already there in engine for you to mess around with.

compact ingot
# dreamy coyote for someone like me who has a good understanding of calc 1 and is learning calc ...

Once you know linear algebra and euler‘s formula, you largely don’t need trig anymore. In game dev I find this one of the greatest simplifiers. Not a day passes where I don’t need LA. So imo, invest heavily into linear algebra. Basic calculus (single variable function analysis and integration, emphasis on polynomials) is all you’ll ever need. Discrete math is also very powerful but generally neglected or taught as component of other disciplines; it also forms the basis of statistics together with calc. Personally I’ve never had much use for statistics but I can see it being useful when doing certain kinds of AI and for gathering user feedback. One major skill is to be able to compose/design closed formulas that do exactly what you want.

hexed pumice
#

I have this code to minimize the player window, works great in Unity editor but does not work on build. Any ideas why?

    [DllImport("user32.dll")]
    private static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);
    [DllImport("user32.dll")]
    private static extern IntPtr GetActiveWindow();

    public void OnMinimizeButtonClick()
    {
        ShowWindow(GetActiveWindow(), 2);
    }
hexed pumice
#

nevermind, code works fine, my mouse is just offset for some reason

slim crater
#

Hi everyone, online there are a lot of tutorials about save-load systems. This systems work even for Android?

flint sage
#

No idea

#

Depends what system

lofty falcon
#

Probably won't work if it is

hexed pumice
#

like i said the code actually works

#

its running as a borderless window

#

and the mouse is offset

#

not sure how to fix that

jolly token
#

Maybe your resolution is different between ingame and windows?

novel plinth
#

frame based system commonly used in fighting games

flint sage
#

If you want a frame perfect game then sure but unity is probably not the best engine for that

#

Or rather, you'll need some custom systems

novel plinth
#

I think he meant as in frame-based system, like in fighting games

#

take SFV for example, a Standing Heavy kick will have 12 frames, to complete, and with 4 active frames at the end... so during this 12 frames, it is vulnerable to be getting hit by lower count frame moves such as Medium Kick

flint sage
#

Yeah I know, but e.g. The animator won't let you do that by default

novel plinth
#

also frame-based system will have some sort of priority system, which is another different beast... frames based system isn't easy to make.. especially in single threaded engine like Unity

hot lintel
#

Not sure what I'm supposed to do with this error message from Unity about a Unity package

Library\PackageCache\com.unity.render-pipelines.core@12.1.7\Editor\Volume\VolumeComponentEditor.cs(469,59): error CS1061: 'TooltipAttribute' does not contain a definition for 'tooltip' and no accessible extension method 'tooltip' accepting a first argument of type 'TooltipAttribute' could be found (are you missing a using directive or an assembly reference?)

jolly token
novel plinth
#

we made similar to this, but had to resort to UE instead due to complexity of frames queuing in Unity.. frame based is just heck hard to make

jolly token
#

Is it better in UE?

novel plinth
#

Depends, tbh UE makes more sense than Unity for frame-based system

#

in our case that is.. others may have their own opinion on this

novel plinth
jolly token
hot lintel
#

What does it mean when you say "frame based"

#

Ah

#

That kind of frame

novel plinth
#

yeah, I said it already about active-frames above.. those are common in fighting games

jolly token
#

Ah I meant the UFE asset

novel plinth
#

ah okay 😄 , never heard about that assets.. looks nice 👍

#

I take my word back, they use capsule colliders for both hit-box and hurt-box 😄 ...

#

never ever use non-box colliders for both hit/hurt boxes in fighting games

#

there's a reason behind why it must be box shaped in fighting games.. proly google it if you want to know it better

jolly token
deep citrus
#

For a client-server game that works around different instances, is it better to build a different executable for each instance for the server or just one executable with different scenes for each instance. I know managing one build is easier specially if want to automate scaling based on load but does it have a performance impact that would be relevant?

sly grove
#

What would be different?

jolly token
undone coral
undone coral
#

if you need sophisticated building with correct caching, you can use gradle or bazel

undone coral
feral cedar
#

how can i reload native plugins?

#

ive been fighting with this for a while, but cant get it working

#

but it doesnt seem to work, even if i unload the dlls the dll is still locked and cant be removed

undone coral
#

update the dll

#

and reopen it

#

is that what you mean by reload?

feral cedar
#

is this really how all plugin developers do it?

undone coral
#

yes

feral cedar
#

isnt that insane? especially after this much time

#

i mean, isnt unity supposed to make development easier and faster?

undone coral
#

i think it's better not to stress about stuff that doesn't matter

#

i work on a native plugin all the time. i am just sharing a POV

#

it doesn't really matter

feral cedar
#

you don't mind all the time wasted and super slow iterations?

undone coral
#

are you trying to make a native plugin for procedural terrain generation?

#

and are you doing that because you feel more comfortable writing C++?

feral cedar
#

doing voxel data generation and meshification, but a big point here is to not be limited to unity and be able to use the library from any rendering engine

undone coral
#

i'm kidding it's not a mistake

#

but it's An Approach

#

if you were using unreal engine, you'd be sitting staring into dead space waiting for long compile times, and constantly starting the editor again because of exceptions or programming errors during iteration

#

writing anything iteratively in C++ is a huge chore, in any complex application

#

if you want to reload quickly, write your thing in C#

#

use burst compilable jobs, it's faster than C++ anyway

#

on some important end user* platforms

undone coral
#

in the long term it doesn't matter - people can make innovative stuff many ways

#

and the reload times don't matter

feral cedar
#

tbh, if i have spent all the time that i used unity writing custom engine, id have a full featured engine by now

undone coral
#

i agree that in order to do something innovative, you often have to leave other things behind

feral cedar
#

i guess i need to come back to unity sometimes to remind myself why i have left

undone coral
#

that said, if your goal is to make an interactive game, especially one where you take a 2d input like a mouse click or touch, and interact with a 3d world, you will fail without Unity

#

if you want to make a renderer, that is different

#

imo, it is way more innovative to figure out how to integrate Your Rendering Thing into HDRP / URP and make stuff for phones

#

and do something cool for 2d interfaces to 3d worlds

#

it is 100x more compelling than realtime rendering of photoreal stuff or whatever, because if that is essential just make a pre-rendered movie

#

that is a perspective informed by working in academic research and what i am personally excited about

feral cedar
#

i can have efortless hotload in c++, asset swapping, full threading support, without having to fight the engine all the time

#

i imagine i sound super grumpy right now, but im just tired of this stuff

undone coral
#

i think if you are making an FPS or something that already exists

#

you know, go for it

#

i would use Unreal if you want "C++ rendering innovations for FPSes"

#

exhibit A: the realtime caustics demo NVIDIA did. but that required like 1 extremely experienced person and 4 interns, work that was done intensively in 6 months out of 2 years

#

by basically the world's foremost expert in realtime light simulations

#

and you still can't like, download it as a plugin. it's right at the border of usefulness

#

do i think there's a future for Microsoft Visual C++ on Windows developers? no

#

if you want to make a renderer from scratch or whatever, a game engine, do it in swift on Metal for the iPhone

#

"bUt tHeN i CaN't uSe C++ aNd vIsUaL sTuDiO"

#

our tools are obstacles, i agree!

#

that is what you are saying

#

well, if you really were sincere about doing something innovative, why the hell are you targeting a shitty dying platform

#

with the cheapest users in the world

feral cedar
#

i think i will go the custom engine way and implement unity/unreal when its done. the idea was to focus on the important stuff while unity handles all the boring stuff

#

my target is pc

undone coral
#

it's about microsoft visual studio for C++

#

i've heard your perspective from other people before

feral cedar
#

and dont get me wrong, im a huge fan of c# and prefer it hundreds times over c++

undone coral
#

you should buy a mac, and develop for the iphone, if you are going to write a native engine

feral cedar
#

but there are some things that you just need the extra performance

undone coral
#

because the ROI on such a thing will be 100x bigger

#

the GPUs on M1 and M2 are incredible, and doing something innovative there will pay much bigger dividends

#

do you see what i am saying?

#

you are talking about native and blah blah

#

you're not.

#

you're JUST talking about Microsoft Visual Studio for C++ GUI .sln blah blah

feral cedar
#

cant really compare pc and mobile games, mobile input is extremely limiting

undone coral
#

do you own an iphone?

undone coral
#

like how do you plan to explore your world?

#

that you are meshifying and voxelificating?

#

a first person camera with WASD controls?

#

do you see what i mean?

#

this is beside the point that minecraft PE on the phone, which has those exact cranky controls, is immensely popular and kids use it just fine

#

it sounds like you own an android phone

#

i am trying to encourage you that, if you do something native

#

doing it with unity

#

and making it work well with unity means you can make it work on phones, Which Matter

#

there is a very, very small audience for innovative rendering experiences on PCs

#

you should get an xbox dev kit if you are interested in that

#

and then, you'd still want to do it in unity

feral cedar
#

cant wait to have to deal with that in unity

undone coral
#

i don't htink we need any more FPSes

#

i think it's really easy to make a world explorable on a phone

#

this is coming from the perspective of someone who tries new things, and also does a lot of research into rendering

#

visual studio is your obstacle

#

you have to stop using that incredible shitty IDE

#

you don't want to be a Windows Android drone

#

we have enough of those

#

lol

#

this is a stylized opinion

#

obviously you are going to make something cool 🙂

feral cedar
#

you are forgetting about software and different industries

undone coral
#

i am trying to free you from your Microsoft Visual Studio for C++ Android shackles

#

especially in game development

#

where all those people were left behind

#

i think the first thing you should do is buy a mac

#

and next you should use the jetbrains IDEs

#

like appcode, CLion and Rider

#

@feral cedar buying a mac will unlock your potential

#

@feral cedar how can i help the most

feral cedar
#

cant you see that we drink the same kool-aid, but of a different color?

undone coral
#

lol

tawdry lintel
#

Anyone ever used Facepunch Steamworks?

Attempting to push an item to the workshop, calling this

var result = await Steamworks.Ugc.Editor.NewCommunityFile
.WithTitle(CurrentLevelSaveLoadName)
            .WithDescription( "Test" )
            .WithTag( "Map" )
            .WithContent(path)
            .WithPreviewFile(imgPath)
            .WithPublicVisibility()
            .SubmitAsync();

However its giving me a null reference, inside SubmitAsync() internally when it calls
SteamUGC.Internal.CreateItem(this.consumerAppId, this.creatingType)

silent jungle
#

anyone knows a good resource to practical uses of the relationship between the compute and append / consume buffers?

chilly nymph
fresh salmon
#

Yeah they're like that. They like monologues with weird stuff in it

hushed moth
#

Is ther some lib to play http-flv media stream in unity?

undone coral
#

comprehending how to do this video stream thing you want to do

#

i'm sure you've searched the asset store

#

but generally no, http-flv is obsolete enough that i don't think you will find a maintained wrapper for it

#

there are asset store assets that work for many video sources.

#

the most robust will be HLS using the preexisting VideoPlayer, but that will have 10s latencies (like typical streaming video online)

#

@hushed moth is that helpful?

hushed moth
#

Webrtc is not good for 40m bitrate, max 8, rtmp not supported, so i tought the http-flv could work

undone coral
#

are you trying to make a streaming video player?

#

or what is the application

#

/ the game

hushed moth
#

I have the streamer server i can cast it to rtmp, hls,wss, webrtc and http-flv so far

undone coral
#

what's the objective?

hushed moth
#

And i would like to play it in 360 (quest 2) with the lowest latency as possible

#

Hls works but 30s latency

undone coral
#

a VR video player?

#

is that the goal?

#

from e.g. youtube or something?

hushed moth
#

Lets say livestreaming 360, i have my server for that

undone coral
#

livestreaming what though?

#

a prerecorded video?

#

a live camera?

#

a different 3d rendered game?

#

there's nothing sensitive about "i want to render a game on the desktop and send it to the quest remotely"

#

but on the other hand, if that's what you want to do, you definitely, absolutely should use Virtual Desktop or wait for Meta to release the streamed gameplay feature

#

which is it?

#

is the server also rendering the content? @hushed moth

#

so many questions

hushed moth
#

It can be prerecorded, live 3d render, whatever, the end is that i have rtmp, hls, http-flv, webrtc mediastream and i can play them with ffmpeg on linux, and the latency is important. I can play hls in unity w/o problem but the latency is 30s

undone coral
#

it really shouldn't be 30s

#

HLS is typically 5-10s

#

is it like group watching a video?

undone coral
#

then i can give much better advice

hushed moth
hushed moth
undone coral
#

lol

#

what are you making

#

don't be shy! it'll be helpful to know

#

alright well i've helped as much as i could without knowing anything about what you are trying to do

chilly nymph
#

I don't see anything wrong with passing a reference from the calling manager.

#

new Boss(this) seems fine to me.

#

Whatever instances the boss.

#

In terms of your question, that's what I called it, yes.

#

No, but I'm assuming you're going for some type of manager if you're holding references like that.

#

I try to keep the logic to the system that needs it. A boss can spawn mini bosses, so I would keep that tied to the boss. But that also asks the question should that be on a spawn system.

#

Exactly, I've had this question before too. A spawn system should be a "Global" system BUT if it's on a specific entity what should you do.

#

If you figure it out, let me know 😄

#

SpawnSystem.Spawn(miniboss)? No?

#

It's how GO are instanciated in the API.

#

Fair.

jolly token
#

It’s quite wrong because boss has to know about spawner and spawner has to know about game manager

#

Well "Employee shouldn't tell manager what to do"

#

No the flow is obviously: GameManager manages Spawner, Spawner manages Boss lifecycle

#

So boss's lifecycle event should be exposed without knowing spawner

#

It's okay to pass reference if Spawner has interface that listens to Boss lifecycle, and Boss only knows about that interface

#

Exposing event is one pattern, having listener interface is another pattern
What I meant is this: class Spawner : IEnemyDeathHandler
And boss/enemy script only knows about IEnemyDeathHandler

brisk pasture
#

can think of plenty of cases, since it would make sense that a object should know when to pool its self again into the spawner

jolly token
#

It's completely same approach as registering event.
Only difference is that you passing reference of interface instead of reference of method

chilly nymph
#

If the boss is removed then who is doing timesheets?

#

There's functionality that the boss does for the sub bosses.

jolly token
#

I'm not sure that the boss should be in the business of explicitly executing a list of functions
Let's say you have event called onDead and if boss calls onDead?.Invoke() it's exactly "explicitly executing a list of functions" defined with events

#

The difference using concrete reference vs interface is obviously the listener can be any class other than Spawner, so boss doesn't have to care about how Spawner implementation changes.

There is no better/worse concept about this, that's all up to details. Using interface can force you to implement some other events. Also you don't have to have assumption of multiple lister. Calling single listener method is sufficient in this case.

#

No, it's not Boss telling Spawner to what to do. It's Boss notifying it to listener. Even if you use events it's same, Spawner's method will be called by Boss's event in call stack. 🤷‍♂️

#

I don't know why would you have problem with common Observer pattern but not with events

#

Using interface listener is observer pattern

#

Well that's all about preference and what kind of details you have in system.
For example if you have sub-boss then you might want to pass ISpawner for real this time 😛

#

But ISpawner only have Spawn. Not sending lifecycle event through that interface

#

It's a case that makes more sense to have interface than an event

vocal dagger
#

Im deep profiling my game which is lagging during some network events... anyone knows how to get the stacktrace of this shit ? I already have deep profiling on, but it still just throws nonsense at me

I also dont know what the heck "EntityCommand'2" is... i have a generic of that struct, but what the hell is the 2 ?

jolly token
#

Honestly I wouldn't design to make Spawner to manage spawned objects, though XP

jolly token
vocal dagger
jolly token
vocal dagger
jolly token
#

My preferred design is having CombatModel which is all data/event, no logic.
It contains EnemyModel, PlayerModel, and each model has info like Position, Health

And all system like WaveSpawnSystem or GameOverSystem, references model only.
No systems references each other. They only see/subscribe to model state.
If they have to somewhat communicate, they send Command to model instead.

tired creek
#

Why are triangles in Mesh list of type int, not uint? List of vertices cannot contain negative indices after all

sly grove
sly grove
sly grove
#

You're not going to have more than 2 billion triangles anyway

#

or I guess 1/3 of 2 billion

vocal dagger
#

My code allocates a lot of memory due to closures...

                prefab.InstantiateAsync(pos, rotation.value).Completed += handle => {
                    
                    // Assign MonoEntity and the go itself to the entity :)
                    var manager = World.DefaultGameObjectInjectionWorld.EntityManager;
                    var go = handle.Result;
                    
                    var monoEntity = go.GetComponent<ECSEntity>() ?? go.AddComponent<ECSEntity>();
                    monoEntity.Index = entity.Index;
                    monoEntity.EntityReference = entity;
                    manager.AddComponentObject(entity, go);
                };

Anyway to instantiate a adressable and passing values to it WITHOUT them being allocated on the heap ?
In this case the passed "entity" gets allocated which results in a lot of gc when executed frequently...

dapper cave
#

is there a way to draw gizmos outside OnDrawGizmos

#

?

sly grove
jolly token
dapper cave
sly grove
vocal dagger
jolly token
#

Just get .Result and use it

dapper cave
#

thanks, now the scene looks like hedgehog

vocal dagger
jolly token
#

After all the prefab you need has been loaded, then InstantiateAsync is always synchronous

vocal dagger
#

Im actually a adressables noob ^ so i dont really have an opinion on this.

Ahh i see, do i need to call LoadAsset everytime ? Or just once ?

jolly token
vocal dagger
#

Thanks ^^
Actually thought once in total, since i heard adressables reduces the loaded asset amount

jolly token
#

They do reference count, but it only decrease when you do Release the handle

vocal dagger
#

Thanks ^^

However i think the issue is not fully resolved.

I wanna instantiate the asset once it was loaded... So i actually need to hook into the OnComplete event to then instantiate it and fill it with data... Another closure which allocs memory xD

jolly token
#

How many prefabs are you instantiating?

vocal dagger
#

Hundreds, thats why those damn closures are a real problem... Why the heck dont they add a method to pass custom payload to it ? Who designed this shit ?

jolly token
#

Maybe just load when game loading and don't worry about rest of game?

sly grove
#

you can map the operation handle to whatever data you want to associate with it to a Dictionary or something

jolly token
#

Hmm static method with static dictionary then maybe

jolly token
#

Restarting your assembly or fork process beforehand? 😌

novel plinth
#

Why? Use instance of a class instead.. as in singleton

sly grove
#

do you mean a static class or a static variable that refers to a class instance?

#

Storing any kind of state in an actual static class is a bad idea

novel plinth
#

and reinstantiating the static You can't instantiate static classes, best you can do, is to make a wrapper to reset the static constructor

jolly token
#

We do use static methods and states in Unity all the time, tho

sly grove
#

static state in Unity is all over the place, true:
Time.timeScale
Time.fixedDeltaTime
Cursor.lockMode

#

I'm not disagreeing, static state is bad

jolly token
#

Well avoiding static is a good practice

#

Being Testable is also a good practice

#

Though in real world some class has to be singleton

#

You just hide it with dependency injection 😌

#

Yes Composition root is where you set up your dependencies
and DI container is the class that stores/resolves dependencies

#

You'll need to load that prefab somewhere 😄

#

Problem of Unity is that there is no single point of entry

#

That makes many things has to be static

#

No I'm saying many Unity API has to be static because absence of single point of entry

quartz stratus
#

Would you mind dropping the titles of the testing and DI book/s you mentioned here?

sly grove
#

Where the hell do they come up with this cover art lmao

quartz stratus
#

@regal olive Thank you!

jolly token
#

For whatever reason programming books has random cover most of time..

#

I like how o'reilly books having random animal on it

quartz stratus
#

Sweet, I'm definitely going to order it.

twilit basin
#

i need some help with the fbx exporter in unity
i'm trying to do a runtime fbx export

#

when I do this, the KeyModifyBegin() function throws a null reference exception

#

same with this, but with the addMember() function

#

i was checking the docs, and it said that in GetCurve, and GetCurveNode, if the bool is set to true, it will create a curve if it doesn't exist and the eAnimatable flag is true

#

I've set the flag to true and the bool parameter is also true, but it still is null

chilly nymph
#

Under the hood does anyone know what's going on with pixel values when you transform.scale? If you had a 2k image and you scaled it down does it still hold 2k resolution?

jolly token
#

I've started writing a Dependency Injection Container project and want to hear some opinions. The major concept is being simple as possible and providing static API as Unity does. Wherever you instantiate a GameObject, the context will be inferred from the hierarchy (Global>Scene>Parent) and then injected.

Also meant to be used for injecting hierarchical model structure, supports object pooling and UI bindings, etc. It's very early stage and mostly biased to my own use case, so I would appreciate if anyone has feedback or criticism. 😄 https://github.com/cathei/PinInject

#

Features you’d expect from DI container, or something they shouldn’t do, anything helps

plucky laurel
#

you dont clear statics? or i missed it

jolly token
plucky laurel
#

(im on the "im only curious" side)

plucky laurel
jolly token
#

Ah that one I am clearing it

plucky laurel
#

found it, partial yep missed that

jolly token
#

Sadly Zenject and other projects are not well maintained anymore 😞 and too much verbose configuration they have IMO

jolly token
#

For anyone looks into code fun part: I’m making hidden cache component to prefab root and saving internal references of ‘injectable’ components. When I instantiate the prefab they are converted to reference to the instance’s components and I just inject by looping them 🙌

jolly vine
#

What is the best way of removing the interpolation between colors of each vertex of a tri?

#

I want each tri here to be eather cyan, or black

plucky laurel
#

split them

#

is that pure vertex color?

#

looks weird i cant understand if the gradients are result of a shader or vcolor

jolly vine
plucky laurel
#

thats the only way to cleanly separate triangles that i know of

jolly vine
#

dang

#

thats sounds really complicated for my little brain

#

I'm using someone else code to genorate low poly procedural terrain you see

#

But I'm having to change the terrain from displaying a texture to displaying vertex colors

plucky laurel
#

if i explain the principles will you apply them?

jolly vine
#

I understand the basics of mesh genoration

jolly vine
#

*I understand the basics of mesh generation

#

I've done a bit of it myself

#

but something as complex as procendural map genoration is more dificult for me to create than its worth

#

I would be able to do it would just take me ages

#

tldr probably not lol

#

I think I've found another way of fixing the issue tho

#

basically inside my vertex shader (made with shader graph) I just round the color to one of the ones I am using

#

so I doesnt use a blend between multiple colors

#

I think that should work

#

hopefully lol

#

Shadergraph doesnt support float4 arrays (color arrays)

#

So I will have to make a really basic written shader i think

#

time to get complicated!

uneven star
long rock
#

Hello everybody, is it possible that the Script of a ScriptableSingleton is already an instance of ScriptableSingleton? When i create ScriptableSingleton Object it seems this is another instance of the ScriptableSingleton. I am confused about ScriptableSingleton, getting an Error when clicking on the ScriptableSingleton Object -> ScriptableSingleton already exists. Did you query the singleton in a constructor?

craggy spear
long rock
#

ok, sorry

mortal scroll
#

hey everyone, i have a main menu where you can select a weapon to play with. but i also want to save this gameobject as "LastUsedWeapon" so you dont have to always choose it. How can i serialize an whole gameobject?

livid kraken
#

you dont

#

serialize a weapon id

#

ammo amount etc

#

rebuild the object at runtime

mortal scroll
#

oh ok thank you

livid kraken
#

serialize data to disk

#

not the objects that hold that data at runtime

mortal scroll
#

ok

livid kraken
#

I have a questsion is mesh.SetTriangles((int[])(object)newIndices, 0); the same as mesh.SetIndices((int[])(object)newIndices, MeshTopology.Triangles, 0); and if it is not, why ?

#

also ignore the ugly hacky casting

jolly token
#

I need test cases too xD

#

Though I’m not sure how to reset static if I run test parallel

tropic locust
#

I am writing PlayMode tests for a Unity package. I need to create test assets, models, textures, scenes etc to be able to test the functionality. I normally, for play mode, would just create Test scenes I could load and run manually and check the test results but I would like to give the TestRunner a go in PlayMode.
The problem is that I want to make sure all these Test assets and scenes do not pollute the builds on other projects (This is a package to be used in many projects).
Anyone know what is the workflow for that? If I put all the assets used for testing in the test assembly folder and before releasing disable the assembly on all build targets does it make the assets not included in the build of the host project?

jolly token
tropic locust
#

Ho wait... if I only reference the assets in test scenes that are not in the build settings.... nothing would be referenced.... therefore not included.... Right?

#

So I might not have a problem to start with....

jolly token
tropic locust
#

No I think you are right indeed

jolly token
#

But if you make play mode tests you have to add test scenes in build settings (assuming you’re using unity test runner?)

tropic locust
#

The only problem I see now is that I do need Addressable assets, and those get built into the bundles independently if they are directly referenced or not......

tropic locust
#

Yes, It's not a game, it's a dev tool.

#

So all assets will be test only

jolly token
#

If you use Package’s Test folder it has some limitations 😦 so I just put my testing stuffs in Assets folder

tropic locust
#

I would like to be able to run the tests on the host project too if something goes wrong or for QA purposes so I need to include all the tests and test assets on the project. I just want to make sure it does not pollute builds though

#

That's why I decided to put them on the package's test folder

#

So they get pushed to git, and loaded into the package when imported

jolly token
#

I’m not even sure if you can open scene from Packages folder unless it’s embedded package

tropic locust
#

Good point, I haven't tried that.

jolly token
#

If it’s git package you’ll get something like “you cannot open readonly scene”

tropic locust
#

That's why I have been avoiding playmode tests honestly

#

I can't find a tried workflow

#

Specially for a package

jolly token
#

Maybe deploy test scenes with separated unitypackage

#

Or put them in Samples folder

tropic locust
#

Ha yes! Samples folder is a special one for packages right?

jolly token
#

Yes, you can import them with package manager UI

tropic locust
#

awesome, that makes total sense

#

Thanks a lot, I will try that.

jolly token
#

Good luck 😄

tropic locust
#

I am very curious now.... 🙂

undone coral
#

tests on the host project too if something goes wrong or for QA purposes so I need to include all the tests and test assets on the project. I just want to make sure it does not pollute builds though
i don't htink this provides value the way you think it does

#

while i wasn't aware you couldn't ship a scene in a package, you can ship a prefab and use a 3 line script to instantiate it in. you can create a scene on the fly. it sounds like you want to use the real host project scene though

#

it's better to cp -r the host project into Projects/TestProjectB or whatever

#

and set it up properly for CI if this is what you really want to do

#

so my takeaway is, you have developed apackage that is used by 1 project

#

that has tests that only really make sense in the context of that project

#

so write a test scene in the project. why are we using the word "polluting"? it won't pollute builds. your package is part of this project end of story

#

@tropic locust does that make sense?

sleek terrace
#

Any one know why tilemap.hasTile(position) might return false, even though the tile exist?

sleek terrace
tropic locust
undone coral
#

is it though

#

is this package online and public?

tropic locust
#

Probably not public. We have a B2B model at the moment. Maybe one day.. 🤷🏻‍♂️

undone coral
#

okay

#

well what would be most helpful?

tropic locust
#

But in practice it is the same as if it was public

undone coral
#

i know it will be used in many projects

#

but is it currently being used in many projects?

#

it sounds like you have a specific frustration with a specific project of yours

tropic locust
#

😊 its currently being developed

undone coral
#

and aspirationally you are develoiping the package, yeah

#

i hear you

tropic locust
#

But also yes, its being actively tested in 2 projects at least

undone coral
#

and you had this specific frustration, the only real frustration word is "polluting"

#

in my experience the development lifecycle looks like
1 repo

Packages/com.davidjonas.package
Projects/DavidJonasProject
Projects/CollaboratorProject

then, once you actually have something where you no longer need to have the two projects to know if the package is working, these three things can be separated into their own repositories

tropic locust
#

Not frustrated at all, I am just planning out ways to not make the host project builds bigger

undone coral
#

i think it's a natural part of the lifecycle that this is a monorepo

#

because if you are doing authentic R&D

#

like there is no alternative