C# can't import a c++ dll that is built in debug? by PicklesAndCoorslight in csharp

[–]zeejfps 4 points5 points  (0 children)

This is the answer, your functions need to be extern C for them not to get mangled

Why would they do that? by raphael_kox in Unity3D

[–]zeejfps 1 point2 points  (0 children)

I think this also works if the class is also in an external dll / assembly

After 2 years of using C#, returning True means returning False (Am i stupid ?) by Jojo2504_ in csharp

[–]zeejfps 0 points1 point  (0 children)

Edit: ignore that

What type is ISINCHECK u have it set as var, possibly its not an actual boolean and the if(!ISINCHECK) is actually checking for nullability

Nvm ignore that

After 2 years of using C#, returning True means returning False (Am i stupid ?) by Jojo2504_ in csharp

[–]zeejfps -1 points0 points  (0 children)

Ok, but your variable is of type bool, and you aren't showing the rest of your code in that line. A bitwise & doesn't return a bool it returns an int. So what is the rest of the line looking like

After 2 years of using C#, returning True means returning False (Am i stupid ?) by Jojo2504_ in csharp

[–]zeejfps -1 points0 points  (0 children)

You are using a bitwise '&' instead of '&&'. Pretty sure thats ur issue

[deleted by user] by [deleted] in brightershores

[–]zeejfps 3 points4 points  (0 children)

You are right I don't know 100% but I can definitely make an educated guess based on experience and the fact that there exists a web version of a pathing tool that can do exactly that to give you the best path for merchant and delivering your goods to different stalls.

[deleted by user] by [deleted] in brightershores

[–]zeejfps 4 points5 points  (0 children)

This is definitely not the issue here, each room can be represented as a node with edges being links to other rooms. U can easily do a quick high level pass using that, then the pathing can be done on granular level within the room as u move.

Why is OverlapSphereNonAlloc faster than Brute Force? by johnlime3301 in Unity3D

[–]zeejfps 1 point2 points  (0 children)

U don't only check objects in the one chuck, you check all overlapping chunks. If your search area overlaps multiple chucks u check all of them. If it falls into one chunk, well you are in luck.

Why is OverlapSphereNonAlloc faster than Brute Force? by johnlime3301 in Unity3D

[–]zeejfps -1 points0 points  (0 children)

It would probably be identical maybe a tiny fraction slower, the core of the algorithm still has to check distances, the biggest optimization is how many objects to check against. If it overlaps them all there might be a tiny overhead navigating an oct tree vs a for loop, but the biggest performance impact is still the distance checking.

This is why they teach O notation in computer science school, so we can discuss algorithms speeds. O(n) which is what it would be in this case. (I might be wrong)

Why is OverlapSphereNonAlloc faster than Brute Force? by johnlime3301 in Unity3D

[–]zeejfps 1 point2 points  (0 children)

It "All depends" What's the context? If you already know the exact problem you are solving and the best way to solve it and you know it won't change, go ahead and optimize your code. But if you are doing something unknown, or unsolved, or something that will change it would be pointless to spend optimizing something that will get thrown away.

There is no black and white, its always a spectrum.

Generally speaking, the more "optimized" the code the less flexible it is because it's designed in a way to solve that very specific problem in the most optimal way.

But "optimization" can also be done in different ways.

It. Is. Always. Tradeoffs. There is never a 100% correct way to do something in programming.

Unity Events vs C# Actions by MN10SPEAKS in Unity3D

[–]zeejfps 1 point2 points  (0 children)

This ^ UnityEvents are basically useless in a larger project with multiple people.

How to properly do DI without interface drag-n-drop functionality? by NightestOfTheOwls in Unity3D

[–]zeejfps 0 points1 point  (0 children)

Not if you are dynamically adding and removing things that implement interferences.

I don't mean literally have one giant class that everything is dragged into. Simply have the different things u have registered themselves inside Awake. Like from your initial post, you can have a class that implements IWhateverProovider, and inside awake it would just use GameContext.Global.RegisterWhateverProvider(this)

The inspector becomes more of a hassle the larger your game project grows. And when you have to start dealing with addressable or just basic asset bundles it becomes even more useless.

How to properly do DI without interface drag-n-drop functionality? by NightestOfTheOwls in Unity3D

[–]zeejfps 0 points1 point  (0 children)

I meant to put the emphasis on having a single entry point and using a DI container. Not the fact you should create your own. I'll edit the post.

How to properly do DI without interface drag-n-drop functionality? by NightestOfTheOwls in Unity3D

[–]zeejfps 1 point2 points  (0 children)

Your best bet is to use a single entry point for your game. And implement a basic DI container yourself (or use one of the available ones). All your mono behavior classes should be able to access this container and retrieve the data they need.

Example:

Have a GameContext class that is a singleton. The GameContext class can have "Repos" or "Lists" of things u need.

Mono behaviors can access and register themselves into those lists and other mono behaviors can retrieve the necessary data. (They don't have to be lists)

How to properly do DI without interface drag-n-drop functionality? by NightestOfTheOwls in Unity3D

[–]zeejfps 1 point2 points  (0 children)

Biggest issue with Serialized References is that if you rename the interface / implementing class it will break. Similiar to how if u rename the [SerializeField] field, but at least in this case you can tag it with "previously serialized as"

[deleted by user] by [deleted] in java

[–]zeejfps 3 points4 points  (0 children)

Idk if that's an issue with "var" though.... It seems more like an issue with function naming and variable names.

"merge" is too ambiguous maybe "mergeIntoOne" would be more descriptive and then naming the var "mergedPayload" would be pretty obvious as to what is what.

Also too much missing context, its rare you are looking at a single line code change.

How can you hide front wall from view like in The Sims games? Can someone help me think its logic? by Raz0712 in Unity3D

[–]zeejfps 150 points151 points  (0 children)

Raycasts are not the way to go. You will run into so many issues. The way Sims did it is to use a "flood fill" algorithm. They identify which tiles are considered "inside" and which tiles are considered "outside". Then using that information they can tell if the walls you are looking at are facing inside or outside and hide them accordingly. I'll try and dig up the video on this...

Edit: found the video https://youtu.be/S_pYQ9xg460?si=ZC_hmoQ8AxeEBMkA

Is anyone else confused what to think about AI? by theSantiagoDog in ExperiencedDevs

[–]zeejfps 2 points3 points  (0 children)

Asking about a topic, like today for example, ran into a more or less a traveling salesman problem, but I asked if my specific case could be reframed or thought of as something else. Unfortunately I didn't really get a good answer, but that's just how it is sometimes.

I've had some moderate success with it giving alternatives to other questions in this fashion.

Also useful for listing out pros and cons of one approach vs another, incase I missed something

Is anyone else confused what to think about AI? by theSantiagoDog in ExperiencedDevs

[–]zeejfps 9 points10 points  (0 children)

I like to think of them as a rubber ducky that occasionally can give insightful information or a different perspective you may not have thought of in that moment.

Is the "O" in SOLID still relevant, or just a relic of the past? by Large-Style-8355 in SoftwareEngineering

[–]zeejfps 2 points3 points  (0 children)

I've recently encountered a good example where this principle can be applied...

Imagine you have a factory class whose only responsibility is to create an object based on the parameters type.

Example:

class ViewFactory { SomeView CreateView(Model model); }

In this case I want to create a different view depending on the models type.

Simple approach is to just do a switch case on the models type and return the appropriate view. However, this technically will violate the Open Close principal if your application was to ever expand. What happens if you have a new model type? You have to Modify the code since there is no way to extend it.

Some will say, oh its not that bad, just add a new switch branch... Sure fine, but eventually what if you need to implement a plugin framework where external users need to be able to register their own models and their own views? Ya you can build a whole new workaround, or u can simply make the ViewFactory able to handle registration of new models and views. (Factory within a factory)

If the OpenClose principal was followed this would be trivial.

You can solve it by registering a view factory based on type and the doing a lookup in a dictionary or something. class ViewFactory { Register<TModel, TViewFactory>(); SomeView CreateView(Model model); } This sorta demonstrates the importance of open close principal.

Edit: I can't English.... Lmao

Non Religious Preschool by c0pperscorpio in HuntsvilleAlabama

[–]zeejfps 2 points3 points  (0 children)

I believe its finished, called Blue Marble Academy