156
News about the Unity engine and project showcases from Reddit. Made possible with @reddit2telegram (@r_channels).
but now I could clearly see "RangedProjectile#5". Puzzle piece #2.
How the fuck? Why the fuck? Why am I retaliating on a projectile? I thought the bug was me shooting myself?!
So, let's take a closer look at why we're retaliating a projectile, by breaking down all these systems in play here.
So, my Game have a few systems all in play here. We have
Weapons \- that are the main driver behind spawning and targeting different prefabs.
Projectiles \- prefabs with scripts that explain their behaviour, type, and apperance.
StatusEffect \- Buffs and debuffs that can be in two different states; active or blueprint. Projectiles can carry status effects that gets applied when they strike a valid target
Retaliation \- Actions that happen after an object has been struck by a hostile attack.
In normal gameplay, when a Weapon spawns a Projectile the projectile has a reference back to it's original owner. This is in play so that effects such as retaliation targets the enemy, and not the projectile in questions, and so that When attacked effects also work. BUT there's a catch, IF an enemy where to die WHILE a projectile is in motion, the reference get set to the projectile instead. This is an intended design choice, in order to get secondary effects, such as explosions or particle spawning to happen in the correct place. This is an intended mechanic and not something that I would like to change. Here's we found piece #3.
This still does not quite explain WHY we're getting our own effects applied to us. But we're getting awfully close. The last piece, has to do with StausEffects and especially HOW my game handles these. As mentioned, status effects can be in both blueprint and active mode. But, we don't actually differentiate between the two, all status effects have their own lifecycle management and are applied as normal scripts right on the GameObject. They don't really interact with anything other than their controller and themselves. EXCEPT... for projectiles. Since these are designed to carry StatusEffect-blueprints, they have specific code that "picks up" any StatusEffect on themselves. Because, when I made this system way back when... I sometime forgot to assign StatusEffects to my projectiles. So I added a quick component lookup to correct my lazyness. Which is now the source of this entire bug... Piece... #4.
So, here's the full chain,
1. Tower purchase upgrade Magical Shield
2. Ranged enemy send projectile towards the tower. Projectile has a reference to it's owner
3. The enemy is defeated while the projectile is in motion. Projectile updates it's owner to now be itself. Since it's an orphan
4. Projectile hits the tower, retaliation takes effect BEFORE damage, so we run through the entire retaliation flow
5. Retaliation attempts to strike the projectile owner, checks the reference and applies all retaliation effects to said owner. Orphaned projectile now has an active StatusEffect called Magical Slow
6. Retaliation flow completed. Moving on to damage phase.
7. Projectile now deals damage to the tower based on it's stats.
8. Projectile now attempts to apply status effects, if it doesn't find any, my fallback kicks in
9. Fallback runs GetComponent<StatusEffectDefinition>() finds the ACTIVE Magical Slow effect that our retaliation just applied, and passes it along to the tower.
An entire day, debugging, logging, testing, hunting for this elusive bug. And the culprit was just a single line. Written long long ago just because I was lazy and forgetful...
Well at least I got a fun story our of it.
Hope you enjoyed reading my little adventure
tl;dr lazy me, causes chain-reaction with a single GetComponent
https://redd.it/1xsw7w3
@r_Unity3D
is it still considered hard to make online games
Maybe you remember the times when making an online game was a running gag in devlogs about how hard it is but years have passed since then so surely it cant be that hard right?
So is it still considered hard to make online games in unity? (Im not doing a competitive game but rather something similar to gartic phone or codenames to play with friends)
https://redd.it/1xsvnbk
@r_Unity3D
7 things that bit me building an online game with NGO 2.x + Multiplayer Services (Sessions, Relay, Vivox)
https://redd.it/1xsqqgc
@r_Unity3D
42 Creatures I've created in 2 years!
https://redd.it/1xsojqf
@r_Unity3D
Your Unity game pays 3-4 MB for UI Toolkit even if you never use it
https://redd.it/1xsn5qz
@r_Unity3D
Made a terraforming spell system for my magic RPG
https://redd.it/1xskxtw
@r_Unity3D
Movement using root motion always looks so smooth
https://redd.it/1xshks2
@r_Unity3D
Aliquo Die - Visual style in Unity
https://redd.it/1xsfpj2
@r_Unity3D
Lighting up a voxel city with nothing but glowing lines in Unity
https://redd.it/1xse4tb
@r_Unity3D
I made a sheep-shearing mechanic in Unity. Here’s how it looks in Shear It! 🐑
https://redd.it/1xs7f8e
@r_Unity3D
We’ve launched The Rusted, our indie action puzzle platformer
https://redd.it/1xs91jn
@r_Unity3D
I wanted to share my 6 month development process, here are some Levels from my game. Do you have any suggestions regarding the light?
https://redd.it/1xs5c67
@r_Unity3D
It's uncanny to see anti-aliasing in the scene view of Unity, after 10 years of using it daily.
https://redd.it/1xs10xw
@r_Unity3D
Does my game look too ugly? Will this art style cut it for casual Web target?
https://redd.it/1xs1l5d
@r_Unity3D
Tip: you don’t need to model construction stages. One clip shader builds all 111 of my buildings
https://redd.it/1xrwn4t
@r_Unity3D
Silly bug, four layers deep, with the most simple fix possible - STORY TIME
Would like to tell you a story of how I spent my last weekend trying to get to the bottom of a very nasty, and verry silly bug.
Had recently released a new version for my game that included a few new upgrades to purchase, this is a tower survivor game, so it's almost impossible to test every permutation of upgrades and combos. I had been testing a few things and not found anything major whatsoever before release. Anyway players where reporting that their tower suddenly stopped attacking, which was very odd.
I had recently done some very major performance improvements. One of which was a "ProjectileBankSystem". A system that puts and controls the population limit of how many projectiles can be on screen at once. If all slots are filled we "bank" the projectile, and make the next one of the same type double in strength.
My first though was that something about this system had broken, or that a weapon somehow did not release their slot once the projectile expired. After some testing and debugging I could not find anything wrong with banking system. So I decided to move on and look for other clues.
One of the players reporting the issue had also sent a screenshot, and it gave me another clue. The player had some very odd looking stat spreads. The most noteworthy one was their attack speed bonus, which was set to -97%. While it is technically possible to get this low of an attack speed, it was certainly not possible on level 8, while also only having 23% bonus damage.
I have a few upgrades in the game that increases damage, at the expense of attack speed. So for this to be true, the player would need to have at least 15 of those upgrades, which would make their bonus damage be above 200%.
I now at least know the source of the "my tower stopped attacking" report. It didn't technically stop attacking, attacks just took 30 times longer to execute.
After some more careful investigation, I found that the player had POSITIVE damage taken modifiers, which is usually not the case. I present "damage taken" as a negative modifier. Say you purchase 3 Wooden Shields, that grants -2 flat damage, and -5% damage each. That would grant you -6 flat and around -15% damage taken. This player had their damage taken set to POSITIVE 30%. This is where it clicked for me, there's ONE powerup in the entire game that modifies these two stats together, and that's the Tower Upgrade called Magical Shield. Puzzle piece #1 had been found.
\--
Magical Shield
Reduces damage taken by 6
Reduces damage taken by 25%
Stacks: Infinitely
When attacked:
Applied Magic Slow to attacker
Increased damage taken by 10%
Reduces attack speed by 15%
\--
So, by the looks of it, the effect of Magical Slow is somehow being stacked on my Tower, instead of the enemies that attack it. Alright... time for even more investigation and deep diving.
Since Magical Shield is an uppgrade, whith an "When attacked" effect. That means that this effect is being attached to my tower as a blueprint. All effects can be in two states, "active" meaning exactly what it says, it's stats and effects are in play, and are actively being taken into account. The effect can also be in it's "blueprint" mode. Basically meaning that it is on the GameObject, but disabled, and linked inside the "StatusEffectSlot" that I have.
As mentioned, since this is a "When attacked" effect. The blueprint for this effect sits on my tower, under "Retaliation" effects. So I begun looking into the retaliation system, how does it apply effects to attackers, do they target the correct enemy or script layer? My first thought was that my tower was somehow hitting itself. That one of my projectiles have been misconfigured and somehow counted as an enemy projectile. Allowing for this effect to happen. Couldn't really find anything useful, until... a log report came through that I did not quite recognize. All other applications had been "MeleeEnemy#123", "RangedEnemy#555" etc,
how to start
hi, i dont know how to start this, i just joined this sub.
I have always liked character design and wanted to get into game dev.
My question is, where do i start? what tutorials should i watch and what should i learn first? Ig anyone has any recommendations please let me know!!!!!! i have a background in 2d animation!
https://redd.it/1xsu7x3
@r_Unity3D
Found some remains of my debugging
https://redd.it/1xsrv89
@r_Unity3D
Made some improvements to our monster's movement based on feedback. How's it looking now?
https://redd.it/1xsnzsh
@r_Unity3D
Added a cat-petting feature to my cat game!
https://redd.it/1xsl25f
@r_Unity3D
🧙♂️ We're making a game where you draw spells. How would you improve the casting experience?
https://www.reddit.com/gallery/1xsjy8p
https://redd.it/1xsjzdp
@r_Unity3D
Issues with moving over bumpy terrain with a character controller?
https://reddit.com/link/1xshp4h/video/io1iof8jxq0i1/player
I downloaded and imported one of the official Unity terrain templates from the asset store just to test out my player movement on uneven surfaces. I use step offset of 0.35 - 0.45 and slope limit is generally around 45 degrees.
I tested walking up hills and uneven terrain on Warzone, Black Ops 6, Battlefield 2042 and Battlefield 6, and I never noticed but they feel similar too in some ways. Lots of jittering when moving up steep hills and the player slides back and fourth trying to navigate a slope at times.
But in my case and in the video, when I get up near the top, my character controller gets stuck in a very tiny "ditch" although visually it seems like nothing should be getting stuck there. And just like in other games, I have to press jump repeatedly or move sideways to get over that particular spot. But then at the end of the video my player kind of does an automatic zig-zag due to getting stuck on different parts of the terrain.
On Battlefield 6, I was able to move over almost everything. It actually felt like their slope limit was 80+ degrees with some of the hills I was able to walk over. But on Black Ops 6 I was getting stuck a lot and had to jump my way over objects so I just can't tell which direction I should try to go towards and what to try and solve.
My main question is what should be considered normal? I'm not sure if I'm looking too much into it as I've spent a considerable amount of time working on my collision.
On games with huge mountains that players walk on, do the developers intentionally make sure the most of the slope is walkable during the actual terrain creation process?
https://redd.it/1xshp4h
@r_Unity3D
How do you test a 2D game UI across different screen sizes in Unity?
A layout can look fine in the editor but become cramped on a narrow phone or when text gets longer. What is your practical process for catching those problems before release?
https://redd.it/1xsfv9w
@r_Unity3D
I used Unity's Particle System to give my Water character a constantly flowing head
https://redd.it/1xs2zpq
@r_Unity3D
Concave wave inside volume
https://redd.it/1xsagtq
@r_Unity3D
Peelable Sticker system
https://redd.it/1xs8kcy
@r_Unity3D
Taking a lil' boat ride in my open world mushroom picking game that takes place in a reimagined Iceland!
https://redd.it/1xs4dmt
@r_Unity3D
Neat cigar smoke effect done with Unity's VFX graph and EmberGen
https://redd.it/1xs2isw
@r_Unity3D
How is it look of my game's atmosphere?
https://redd.it/1xrxd32
@r_Unity3D
I know water shaders are an old topic, but here is mine
https://redd.it/1xrvy8d
@r_Unity3D