#Ill add a few more examples here

1 messages ยท Page 1 of 1 (latest)

tulip crown
#

examples in a sec

sick arch
#

God bless.

tulip crown
#

You would need to do something like this if you wanted to write to the hashmap in parallel

#

It will not auto resize then however, so you need to set the Capacity to what it should be

sick arch
#

I see. That's fine with me.
I'm starting to get the grasp of things ๐Ÿ™‚

tulip crown
#

If you have a lot of readonly data I think the unity recommended approach are blob assets

#

Maybe something to look into, see if it works for you ๐Ÿคท

sick arch
#

That's what I've seen, I'm not sure how usable it is for my purpose.

Right now I'm working on an effect system that basically does:

EffectSystem => Map of EffectType, Action<> => Static method that executes said effect type

bright zealot
#

yep, although building blobs takes some use and I'd honestly only recommend blobs if you feel like data access to it starts being a bottleneck

sick arch
#

Having access to my data in the static method feels like a bit of an issue

#

Well, I can access it, just not with burst-compiled code..

tulip crown
#

You can call static methods from burst

sick arch
#

The problem is loading the specific effect type in the static method^

tulip crown
#

Yeah, that makes sense

bright zealot
#

I'd not recommend static methods. If you are in a job just write a method. It can get burst compiled and you don't have to deal with limited data access and endless parameters

sick arch
#

I wanted to make my effects be entities, but they need a lot of data from the target unit. It may just be bad design of the effect system itself causing this issue, to be fair.

tulip crown
bright zealot
#

also static burst methods are translated to function pointers which are limited to just basic parameter types which can be a total pain

sick arch
#

Yea what I'm currently doing feels like more of a hack than a truly well put together system

bright zealot
#

That's why I don't use Entities.ForEach anymore. Using methods in them is horrible ๐Ÿ˜„

tulip crown
#

Yeah, I think unless it's a very small operation using a "fully fledged job" makes more sense

bright zealot
#

Eh, effect systems that need lots of data is pretty normal ^^

tulip crown
#

There's lots of different ways to work around your issue, hard to say without all of the context

sick arch
#

DamageEffects with ~40 parameters are not fun.

I'm not sure what's better syntax than ForEach

tulip crown
#

You can define a job directly by creating a struct that implements one of the job interfaces, such as IJob, IJobChunk, etc

bright zealot
#

40 might be a tad too much ๐Ÿค”

sick arch
tulip crown
#

I think it depends on how they work, but if I were to implement an effects system I would try and move each "part" of the effect to a component, and then write systems that modify your effect targets as needed. But again, it's hard to say without seeing how it's set up

sick arch
#

I only have access to the server, the client is already made and I can't modify it

tulip crown
#

Why do you want to switch to ECS at all then?

sick arch
#

Performance

tulip crown
#

Depending on how late you are in the project I think it can be very hard to switch

bright zealot
tulip crown
#

If you need performance, just use jobs without ECS

sick arch
#

It's an MMO with ~100k NPCs and the goal is to handle up to 10k CCU

tulip crown
#

You can still write bursted code completely without entities

bright zealot
#

What type of MMO is it? Similar to WoW?

sick arch
#

ArcheAge. It's more action-based than WoW

#

I wrote an almost finished emulator for it in .net but now I ran into some perf issues and other limitations, Unity seemed like a good choice to continue

bright zealot
#

ah so we are talking about a private server?

sick arch
#

Currently just an emulator

bright zealot
#

well yes, i do think it's a good choice. the data setup might be a little problematic because you are not as flexible

#

was it .net 6?

sick arch
#

Yes it was

#

I think I need to detach myself from the idea that entities are in-world elements

bright zealot
#

hm, .net 6 is really fast. not as fast as burst though

sick arch
#

I tend to think of an entity as a Unit (npc, player, house, vehicle) rather than a bit of data

tulip crown
bright zealot
#

it makes sense for some cases and then it doesn't for others ๐Ÿ˜„

sick arch
#

But then the issue becomes how well can one entity's component affect another entity's component

bright zealot
#

is there an effect list somwhere? I have played Archeage only for a very very short time

sick arch
#

I can probably pull it out

bright zealot
#

Thanks, okay from a first look. Hardly any effects have a logical relation to each other. they are pretty much their own mechanics. which means every specialType would work as its own component

#

this whole data lends itself very well to blobdata

sick arch
#

SpecialEffects are very generic compared to the rest - 4 integers as parameters instead of whatever else

bright zealot
#

You can author the spells as mono behaviour component but I'd not save them as entity with components but convert them to blobs

sick arch
#

I'd rather not use monobehaviors at all - currently I use none and it's great

bright zealot
#

just for authoring, not for runtime

#

this is what I do in my spell system. from GO to prefab entities to blob data. spells as entities don't work when you want your server to scale

#

then I save the blob in a NativeHashMap and a job can lookup the spell ID and get all the data.

sick arch
#

"and a job can lookup the spell ID" => this is the step I'm currently wondering about

bright zealot
#

the great thing about blobs is that you can allocate BlobPtr or BlobArray which are useful in case a spell doesn't have a certain mechanic but you still want easy access to the data

bright zealot
sick arch
#

That's how I do it too, I just don't have the nativehashmap reference in my job ๐Ÿ˜„

#

But all the advice helps

bright zealot
#

np, I'm afk for some minutes

sick arch
#

I guess maybe having a BlobAsset with nativehashmaps is the way to go ?

bright zealot
#

public NativeHashMap<int, BlobAssetReference<SpellBlobRoot>> blobLookup; this is my spell lookup map

sick arch
#

And where do you pass the blobLookup reference to your job ?

bright zealot
#

the hashmap is public in the SpellLoader system. Then in another system I get the reference via spellLoader = World.GetExistingSystem<SpellLoader>();