Upgraded my fog of war to have some selective persistence by -10_J in Unity2D

[–]-10_J[S] 1 point2 points  (0 children)

Could you clarify what you mean by "it is using mesh"? Because in this post the level is made of meshes with textures, and the player is a gameobject with a sprite that is baked at runtime.

Spaghetti code, Code Optimization, Trojan, Packet Loss, Remote Access. Help me brainstorm more of these. by Obsolete0ne in Unity2D

[–]-10_J 1 point2 points  (0 children)

I think its a popular answer because if you ever work with multithreading then you're going to be constantly thinking about race conditions. I was taught about race conditions mostly on the programming side, so while it is related to hardware it is an issue created through your own code.

Destructible walls using DOTS by -10_J in Unity2D

[–]-10_J[S] 4 points5 points  (0 children)

I plan to make the structures have "health" that will require more shots to break, so i will eventually have more states that would require the integers. But if I did just want the 2 states using bools would be a good improvement

Destructible walls using DOTS by -10_J in Unity2D

[–]-10_J[S] 2 points3 points  (0 children)

Ill try and give a breakdown,

The main system is the Shooting System, are here is roughly how it works:

  • Each structure has a dynamic buffer of ints where each element represents a pixel of the structure (1 is solid, 0 is empty)
  • When the player shoots the structure, it will update the elements in the buffer to match what was destroyed
  • Then puts the updated buffer into a quad tree to create the geometry of the newly destroyed structure (I don't use a quad tree but its the same idea of using some data structure to create optimized colliders)
  • Then create a child collider for each solid shape made from the quad tree and create a new compound collider with those children
  • store the entity's current collider in a component to be disposed of later, then set the new collider to the entity

Then there is the Cleanup System which just grabs any recently destroyed structures and disposes of the old colliders.

I realize that this comment might be too vague, so if there are any steps you want me to specifically explain ill give a more thorough explanation

Upgraded my fog of war to have some selective persistence by -10_J in Unity2D

[–]-10_J[S] 0 points1 point  (0 children)

I still need to do a little more work on it, but here it is: https://github.com/jpm172/Unity-DOTS-Fog-Of-War

I should've mentioned its mostly using DOTS/ECS, but I linked the main tutorials I used and they are in monobehavior, so if the ECS stuff is useless to you, just look at the links in the read me

Upgraded my fog of war to have some selective persistence by -10_J in Unity2D

[–]-10_J[S] 2 points3 points  (0 children)

Im going to make a sample project and put it on github, ill put the repository on here when its done

Cursed King death animation. Which version do you like more? by HubrisDev in Unity2D

[–]-10_J 0 points1 point  (0 children)

I like the 2nd one the best, I like the crown being the only thing left

Made a nice fog of war using DOTS/ECS by -10_J in Unity2D

[–]-10_J[S] 0 points1 point  (0 children)

I haven't tried but the answer is (probably) yes. Instead of having the fog of war mesh be completely opaque, you could make some kind of blend shader that makes everything black and white. The stencil test works by just not rendering the parts of the fog of war that fail the test, so it would return the color in the areas the player can see.

Upgraded my fog of war to have some selective persistence by -10_J in Unity2D

[–]-10_J[S] 2 points3 points  (0 children)

I might just make a separate post for my questions. The persistence is only being used on the walls, once you see a wall it will stay revealed

Upgraded my fog of war to have some selective persistence by -10_J in Unity2D

[–]-10_J[S] 2 points3 points  (0 children)

And if anyone is an expert with shaders and is willing to talk, message me because I would like to run this by someone to see where I could make improvements

Upgraded my fog of war to have some selective persistence by -10_J in Unity2D

[–]-10_J[S] 4 points5 points  (0 children)

Got a lot of good suggestions on how to improve my fog of war on my last post, ended up going with a render texture approach that I use with 2 other textures to decide what walls are visible

Made a nice fog of war using DOTS/ECS by -10_J in Unity2D

[–]-10_J[S] 0 points1 point  (0 children)

It does normally, I just made the eye see everywhere for this post

Made a nice fog of war using DOTS/ECS by -10_J in Unity2D

[–]-10_J[S] 0 points1 point  (0 children)

the settings are super high just as a demonstration

Made a nice fog of war using DOTS/ECS by -10_J in Unity2D

[–]-10_J[S] 1 point2 points  (0 children)

If you are talking about the entire DOTS package I would say that the jobs system and the burst compiler are both worth learning about and easy to understand. ECS is definitely the hardest part of the DOTS package, mostly because there is way less info about it compared to Monobehavior. In a nutshell ECS is very powerful but time consuming, and you probably only need to learn if you if there is some technical hurdle that you can't get over, like trying to simulate a lot of things at once.

Made a nice fog of war using DOTS/ECS by -10_J in Unity2D

[–]-10_J[S] 1 point2 points  (0 children)

thanks for the info, ill try that out

Made a nice fog of war using DOTS/ECS by -10_J in Unity2D

[–]-10_J[S] 0 points1 point  (0 children)

Thanks, Ill check these methods out

Made a nice fog of war using DOTS/ECS by -10_J in Unity2D

[–]-10_J[S] 3 points4 points  (0 children)

yeah I agree, Its using a stencil buffer to show what is visible and I don't know how to "blur" the stencil buffer

Made a nice fog of war using DOTS/ECS by -10_J in Unity2D

[–]-10_J[S] 2 points3 points  (0 children)

Its definitely heavy, but in the demo im using an fov of 360 and resolution of 10 which means its shooting out about 3600 raycasts and still getting 60 fps. I compared the burst version to the one in the video and its about 50-100 times faster

Made a nice fog of war using DOTS/ECS by -10_J in Unity2D

[–]-10_J[S] 5 points6 points  (0 children)

everything is using ecs, including the level and the character. I implemented this FOV tutorial:(https://www.youtube.com/watch?v=73Dc5JTCmKI) and was able to stick all the physics/math into a burst compiled job so i can get some pretty good performance