#code generation

1 messages · Page 1 of 1 (latest)

glacial cave
#

i suppose you can go down the rabbit hole of roslyn source generators, and do all this filtering, but it sounds like you probably have fewer than 100 types that will need these templated event bus definitions, so you probably can do that all in like, 10 minutes

#

versus building all this infrastructure for "just" 100 types, which will take your days

lapis garnet
#

Why would it take days? My plan is just to generate a .cs file that I write to based on non editor assemblies.

#

I've done that kind of thing before, never took more than half a day

glacial cave
#

it's your call

#

i think there are going to be a lot of weird interactions and surprising doing reflection with il2cpp

#

it is a huge amount of pain to save like 10 minutes

#

you already know what all the types are. just put them into a list.

#

do whatever it is you need to do

lapis garnet
#

oh yeah, that's why I'm trying to do this at design time. Essentially push a button that generates the C#, or hook it into the build process so I don't need to use reflection.

glacial cave
#

you will never make an error of omitting one of these types. if you DO, then you are going to be making mistakes EVERYWHERE anyway

#

just write the list of types

#

i mean how many is it?

#

like 10?

#

100?

#

do you see what i am saying

lapis garnet
#

Probably more like a few thousand in the end, low end might be 5-600

glacial cave
#

by now, with all the questions you've answered here

#

fine

#

a few thousand

#

a few thousand you can still do

#

it will take you like 30 minutes - 1h

#

besides, that's epculative

#

like how many do you have right now?

lapis garnet
#

I appreciate the advice, but I think I'm happy with my method. I get you disagree about whether this is worth the effort, but I've encountered issues trying to debug things like this before and they took a lot of time.

glacial cave
#

okay but don't you see

#

if you would make a mistake here

#

you're going to be making mistakes everywhere

#

another perspective is... event bus for what kind fo game? you could go straight to ECS

#

and like i said

#

you probably have 10 types right now

#

it's all defensive programming for stuff that hasn't happened yet

spiral marlin
glacial cave
#

there's a reason nobody cares about reflection in il2cpp. it's just usually the wrong solution to a problem

#

okay, but you're going to get all these arcane il2cpp errors

lapis garnet
#

That is where I disagree, this kind of thing will eliminate the possibility of human error. Sure this hasn't happened for me yet, on this project, but I've seen it happen in the past. I take your point though, and it's something to consider for sure.

glacial cave
#

how many types do you have?

spiral marlin
#

I have not run into any weird issues with Reflection on IL2CPP. It's officially supported, any issues can be reported as a bug.

glacial cave
#

it seems reasonable to answer this question first

#

yes, report it as a bug, wait 9 months

spiral marlin
#

The IL2CPP team are a solid team, very responsive to bugs.

lapis garnet
# glacial cave how many types do you have?

I don't know how many it will be exactly yet, I'm building a tool that I'll use in multiple games. This will be a shared system, part of my company's core tech we use on everything. Any one game will probably have a few hundred to a few thousand but I can't say for certain yet.

glacial cave
#

take a guess

#

i mean you know i'm right because you're not answering the qeustion

#

maybe it's 0 right now

#

if it's zero, i guarantee you, it's all a little premature

lapis garnet
#

I've answered the question--anywhere from 500-5k on any given project. I'm just starting on the project now so it's 0, but I know where this is going.

#

@glacial cave I appreciate what you're saying, I really do, but I just don't agree with your conclusion about the effort required. I've taken note of your criticism, but this isn't worth belaboring any more.

glacial cave
#

lol okay okay

#

yes of course i'm just trying to push you on this

#

listen making games is hard you can blow a lot of time on this, which i will tell you now is pointless

#

try to get to 10 types before you decide you even need an event bus

#

or any of this stuff

#

i don't know what the game is

#

if you are trying to do something really sophisticated, some complex sim game or something

lapis garnet
#

Yes I understand, I've worked on a number of large games. I'm solving for scale here, which is why I like my solution since it's worked for me in the past. I've put in the effort before, and I saw the benefit of it.

glacial cave
#

consider ECS, which has the logical conclusion of an event bus

lapis garnet
#

I'm not coming from a place of not being informed.

lapis garnet
spiral marlin
#

Just to add some statistics to the discussion, I have 284 event types for my event bus, medium sized project.

spiral marlin
#

But some of those events are generic, and can have many instances each.