Media is too big
VIEW IN TELEGRAM
I created a small game prototype where you fight in a mech against kaiju. Do you think a concept like this is worth further development?
https://redd.it/1hm1f74
@r_Unity3D
https://redd.it/1hm1f74
@r_Unity3D
Minimax function for a chess bot
If I'm searching on a higher depth, lets say 3 or 4, it would make sense for the computer to avoid getting its pieces captured. Lets say its possible for black to take a pawn on a2 with their rook but the rook would get captured on the next move. That's a -4 trade, which is bad. It still does it on a depth higher than 1. And it doesn't avoid checkmate, and yes the InCheck() function is working.
Did I set up the Minimax function wrong?
private int Minimax(int depth)
{
if (depth == 0)
{
return Evaluate();
}
var moves = moveClass.GenerateLegalMoves();
if (moves.Count == 0)
{
if (InCheck())
{
return int.MinValue; // Loss if in check and no moves because checkmate
}
return 0; // Stalemate
}
int bestEval = int.MinValue;
foreach (Move move in moves)
{
int backupBoard = (int)Chessboard.board.Clone();
// Explaining parameters: 2 null values: piece visualization, 2 bool values: (1: if perform color flip or not, 2: refresh legal moves list for other noscripts to access or not)
moveClass.MakeMove(Chessboard.board, move, null, null, true, false);
// Flip sign for opponents perspective
int eval = -Minimax(depth - 1);
bestEval = Mathf.Max(bestEval, eval);
// Undo move
Chessboard.board = backupBoard;
Chessboard.ColorToMove = Chessboard.ColorToMove == Piece.White ? Piece.Black : Piece.White;
}
return bestEval;
}
https://redd.it/1hm5cof
@r_Unity3D
If I'm searching on a higher depth, lets say 3 or 4, it would make sense for the computer to avoid getting its pieces captured. Lets say its possible for black to take a pawn on a2 with their rook but the rook would get captured on the next move. That's a -4 trade, which is bad. It still does it on a depth higher than 1. And it doesn't avoid checkmate, and yes the InCheck() function is working.
Did I set up the Minimax function wrong?
private int Minimax(int depth)
{
if (depth == 0)
{
return Evaluate();
}
var moves = moveClass.GenerateLegalMoves();
if (moves.Count == 0)
{
if (InCheck())
{
return int.MinValue; // Loss if in check and no moves because checkmate
}
return 0; // Stalemate
}
int bestEval = int.MinValue;
foreach (Move move in moves)
{
int backupBoard = (int)Chessboard.board.Clone();
// Explaining parameters: 2 null values: piece visualization, 2 bool values: (1: if perform color flip or not, 2: refresh legal moves list for other noscripts to access or not)
moveClass.MakeMove(Chessboard.board, move, null, null, true, false);
// Flip sign for opponents perspective
int eval = -Minimax(depth - 1);
bestEval = Mathf.Max(bestEval, eval);
// Undo move
Chessboard.board = backupBoard;
Chessboard.ColorToMove = Chessboard.ColorToMove == Piece.White ? Piece.Black : Piece.White;
}
return bestEval;
}
https://redd.it/1hm5cof
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
Tag Comparisons in Unity2D: Lessons Learned with Rigidbody2D
So I learned something today about colliders, that I should have known. Maybe you are having a similar issue so I thought I'd share. I'm sure most people already know this but...
If you have an object with a Rigidbody2D component on it and you have colliders on child objects, the collision will happen with the Rigidbody object (the parent) and not the child object.
I was trying to get the tag from the child object collision but it was sending me the tag from the Rigidbody object instead and I didn't realize this behavior.
"When you call CompareTag on a collider that belongs to a child object, if that collider is part of a GameObject hierarchy where the parent has the Rigidbody2D, the event will be triggered on the parent. As a result, when you check
Hope that saves someone some time.
https://redd.it/1hm61zc
@r_Unity3D
So I learned something today about colliders, that I should have known. Maybe you are having a similar issue so I thought I'd share. I'm sure most people already know this but...
If you have an object with a Rigidbody2D component on it and you have colliders on child objects, the collision will happen with the Rigidbody object (the parent) and not the child object.
I was trying to get the tag from the child object collision but it was sending me the tag from the Rigidbody object instead and I didn't realize this behavior.
"When you call CompareTag on a collider that belongs to a child object, if that collider is part of a GameObject hierarchy where the parent has the Rigidbody2D, the event will be triggered on the parent. As a result, when you check
other.CompareTag("YourTag"), it will return the tag of the parent object rather than that of the child."Hope that saves someone some time.
https://redd.it/1hm61zc
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
New Indie Game Coming out Soon!! (Digg 'n' Deep)
Hey! I am very exited to announce that the game me and two friends have been working on is coming out really soon after new years!!!! We would love it if you checked out the first teaser we created!
https://www.youtube.com/watch?v=KoVbOm8K2QA
https://redd.it/1hm7pnm
@r_Unity3D
Hey! I am very exited to announce that the game me and two friends have been working on is coming out really soon after new years!!!! We would love it if you checked out the first teaser we created!
https://www.youtube.com/watch?v=KoVbOm8K2QA
https://redd.it/1hm7pnm
@r_Unity3D
YouTube
Digg 'n' Deep: Which path to choose?
A little teaser for Digg 'n' Deep to show what we've been cooking up :D
Player camera isn't able to see any text boxes
I'm having a seemingly simple problem that I cannot fix to save my life, and am wondering if anyone is able to help me with it? So far, I'm programming a game that needs two text boxes for your username and points earned. I have staged the entire scene of my game, which can be fully seen in the Scene view, Game view, and Player camera preview view. Everything up to this point has been incredibly easy to stage and view from every camera. For some reason, when I try to add a text box, nothing I do will make my preview see it.
Hierarchy -
Player
> Player 1
> Player 1 Camera
> Player 1 Canvas
> Text box
I have disabled all other elements of the game for now, and the only thing I have on my screen view that's active is this text box. I have mirrored its
Z location to be the highest thing in the scene at only 0.5, I have made it a UI element with the highest order on the screen so it sits above all other elements on the screen. The canvas is set to Worldview. My camera is linked to the Player 1 canvas, and is in the correct position. I feel like everything is set up for this camera to be looking RIGHT at the text box, but it's still invisible to the player camera preview. Lastly, I've run all of this through Chat GPT to see if it knew, and it said everything appears to be set up correctly.
The only other odd thing is when I create the canvas, the canvas is about 1,000x larger than my scene, so I have to X & Y position it down to be within the scene view, and the scale is still 1,1,1. The text box is within the walls of the canvas, but the text is giant, even at a font size of 1. A font size of 10 and it's super blurry like it's up against my eyeballs it's so close.
Does anyone have the faintest idea of what's going on? It seems simple that a camera should be able to see a text box, but something very strange is happening. Any insight would be greatly appreciated. Thank you.
https://redd.it/1hm7b7m
@r_Unity3D
I'm having a seemingly simple problem that I cannot fix to save my life, and am wondering if anyone is able to help me with it? So far, I'm programming a game that needs two text boxes for your username and points earned. I have staged the entire scene of my game, which can be fully seen in the Scene view, Game view, and Player camera preview view. Everything up to this point has been incredibly easy to stage and view from every camera. For some reason, when I try to add a text box, nothing I do will make my preview see it.
Hierarchy -
Player
> Player 1
> Player 1 Camera
> Player 1 Canvas
> Text box
I have disabled all other elements of the game for now, and the only thing I have on my screen view that's active is this text box. I have mirrored its
Z location to be the highest thing in the scene at only 0.5, I have made it a UI element with the highest order on the screen so it sits above all other elements on the screen. The canvas is set to Worldview. My camera is linked to the Player 1 canvas, and is in the correct position. I feel like everything is set up for this camera to be looking RIGHT at the text box, but it's still invisible to the player camera preview. Lastly, I've run all of this through Chat GPT to see if it knew, and it said everything appears to be set up correctly.
The only other odd thing is when I create the canvas, the canvas is about 1,000x larger than my scene, so I have to X & Y position it down to be within the scene view, and the scale is still 1,1,1. The text box is within the walls of the canvas, but the text is giant, even at a font size of 1. A font size of 10 and it's super blurry like it's up against my eyeballs it's so close.
Does anyone have the faintest idea of what's going on? It seems simple that a camera should be able to see a text box, but something very strange is happening. Any insight would be greatly appreciated. Thank you.
https://redd.it/1hm7b7m
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
I've been trying to add bloom effect to certain things in my scene, but I can only put it on everything except for certain objects. I tried everything.
https://redd.it/1hm89vp
@r_Unity3D
https://redd.it/1hm89vp
@r_Unity3D
Reddit
From the Unity2D community on Reddit: I've been trying to add bloom effect to certain things in my scene, but I can only put it…
Explore this post and more from the Unity2D community
In need of 2D character
Im making 2D platformer in unity 2D for mobile, and im looking for 2D character (preferably cartoonish style) which would have simpe animations like idle, run, jump,shoot. Regarding shooting, i want to be able swap different weapons from pistols to rifles, and i need to be able to aim at the target to some degree.
I was looking into fiverr to purchase something off the artist, but its only a hobby project and im a beginner so im not invested enough to spend 100s of dollars (YET), but i could pay something like 10 -20 euros (i know, it may be unrealistic but hey..its only a hobby project).
What would you guys recommend? Im browsing unity asset store but i cant quite find something thats suitable, there are some assets that COULD be used but theyre out of date since spine and unity versions are no longer supported, so im kinda looking for an artist who may have such character created but not used anywhere, so i could buy it, if the price is right
https://redd.it/1hm6try
@r_Unity3D
Im making 2D platformer in unity 2D for mobile, and im looking for 2D character (preferably cartoonish style) which would have simpe animations like idle, run, jump,shoot. Regarding shooting, i want to be able swap different weapons from pistols to rifles, and i need to be able to aim at the target to some degree.
I was looking into fiverr to purchase something off the artist, but its only a hobby project and im a beginner so im not invested enough to spend 100s of dollars (YET), but i could pay something like 10 -20 euros (i know, it may be unrealistic but hey..its only a hobby project).
What would you guys recommend? Im browsing unity asset store but i cant quite find something thats suitable, there are some assets that COULD be used but theyre out of date since spine and unity versions are no longer supported, so im kinda looking for an artist who may have such character created but not used anywhere, so i could buy it, if the price is right
https://redd.it/1hm6try
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
This media is not supported in your browser
VIEW IN TELEGRAM
I made a shader that turns Unity's default quad into an animated butterfly. 🦋
https://redd.it/1hmb2ii
@r_Unity3D
https://redd.it/1hmb2ii
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
A tree swaying in the wind for the main menu of my game Effulgence, entirely created from text symbols. The options include three levels of symbol brightness. Is there one you like?
https://redd.it/1hm3c57
@r_Unity3D
https://redd.it/1hm3c57
@r_Unity3D
Best DI for Unity in 2024?
Recently started a new pet-project, and searching for must-have libs. And I was struck by the reinventing the wheel disease again — decided to make a simple module for Dependency Injection. In general, it's not that there's much to do for basic things. The simplest bindings and
What I chose from:
1. Classic Zenject. But it's kind of dead. Even Extenject isn't in active development. But I've never liked Zenject's monstrosity. And after poking around in the code, I saw for myself that they've overdone it with reflection. Plus, it allocates a lot of unnecessary memory. What's interesting is that pools are even used for internal service tasks, which is pretty cool.
2. Reflex. Looks good, maintained. The code is generally much simpler than Zenject, there are still various contexts: Project -> scene -> other scenes.
3. VContainer won. Small, fast, and allocates less memory than others (according to the author). It seems to cover most of the cases. The code is simple, if necessary I'll fork it and modify it for myself. The only downside so far is that it can't resolve
What do you use currently for DI in Unity?
https://redd.it/1hm81u8
@r_Unity3D
Recently started a new pet-project, and searching for must-have libs. And I was struck by the reinventing the wheel disease again — decided to make a simple module for Dependency Injection. In general, it's not that there's much to do for basic things. The simplest bindings and
[Inject] attribute would have been enough. But then factories are added, prefab spawning, lazy initialization... As a result, after a couple of days, I decided to take 3d-party libs.What I chose from:
1. Classic Zenject. But it's kind of dead. Even Extenject isn't in active development. But I've never liked Zenject's monstrosity. And after poking around in the code, I saw for myself that they've overdone it with reflection. Plus, it allocates a lot of unnecessary memory. What's interesting is that pools are even used for internal service tasks, which is pretty cool.
2. Reflex. Looks good, maintained. The code is generally much simpler than Zenject, there are still various contexts: Project -> scene -> other scenes.
3. VContainer won. Small, fast, and allocates less memory than others (according to the author). It seems to cover most of the cases. The code is simple, if necessary I'll fork it and modify it for myself. The only downside so far is that it can't resolve
[Inject] on monobehs on the scene out of the box. You have to explicitly specify builder.RegisterComponentInHierarchy<Office>() for all of them. Off course, nothing prevents you from going through the scene and checking monobehs for the field.GetCustomAttributes attribute, but this will still be very slow for fat scenes with a bunch of nested objects. And it's cool that if you need to squeeze out performance, you can attach Roslyn Source Generator for sourcegen.What do you use currently for DI in Unity?
https://redd.it/1hm81u8
@r_Unity3D
GitHub
GitHub - modesttree/Zenject: Dependency Injection Framework for Unity3D
Dependency Injection Framework for Unity3D . Contribute to modesttree/Zenject development by creating an account on GitHub.
Unity suddenly started charging me $30 every month. Automatic subnoscription to Muse
https://redd.it/1hmfx55
@r_Unity3D
https://redd.it/1hmfx55
@r_Unity3D