[QUOTE=war_man333;47211753]Would you advise using raycasts or 2D raycasts? I'm using 2D right now, because I'm making a 2D game. I'm using it to determine if an NPC has direct vision of a player, but it's working really wonky. Sometimes it doesn't collide with walls as it should, other times it does. Should I call it in a FixedUpdate or something?[/QUOTE]
are all your walls on the same depth?
I'm not sure how, but it resolved itself when I set the raycast distance to infinite. :v:
How would you guys handle things that should be global or accessed by several objects/components. Such as phys-setting, game state or state information.
I'm currently trying to be as object oriented as possible. But right now I want to have a score for the player and I know this is going to accessed by a few objects already.
Do you have some sort of "global" object with the game state script which handles all those fancy things, and then every other object that needs to access those variables just have a pointer that "global" object and then just GetComponent whatever they need.
Or is there a much better approach it this? I just find it to be a kind of weird way to do it.
[editline]26th February 2015[/editline]
Just took a quick look into PlayerPrefs, but that is persistent between sessions. Which I'm not looking for.
[editline]26th February 2015[/editline]
Is Singletons a better approach?
[QUOTE=Jalict;47218108]How would you guys handle things that should be global or accessed by several objects/components. Such as phys-setting, game state or state information.
I'm currently trying to be as object oriented as possible. But right now I want to have a score for the player and I know this is going to accessed by a few objects already.
Do you have some sort of "global" object with the game state script which handles all those fancy things, and then every other object that needs to access those variables just have a pointer that "global" object and then just GetComponent whatever they need.
Or is there a much better approach it this? I just find it to be a kind of weird way to do it.
[editline]26th February 2015[/editline]
Just took a quick look into PlayerPrefs, but that is persistent between sessions. Which I'm not looking for.
[editline]26th February 2015[/editline]
Is Singletons a better approach?[/QUOTE]
I use Singletons approach, it's ok :).
Does anyone know how I can make objects react to the 2D light mesh that I have?
because right now it just looks like this
[t]http://i.imgur.com/KCR7L1j.png[/t]
What material did you set them to?
[QUOTE=Jodern;47218509]Does anyone know how I can make objects react to the 2D light mesh that I have?
because right now it just looks like this
[t]http://i.imgur.com/KCR7L1j.png[/t][/QUOTE]
Keep in mind Unity lighting is in no way 2D. You have to move them underneath the lightsource on the Z axis.
Yeah and there are no shadows. Light is 3D and you're casting it at quads in space.
I should probably have mentioned that the "light" there isn't an actual light, it's just a mesh with a transparent/gradient type shader that I've calculated using a bunch of raycasts.
[t]http://i.imgur.com/daTV9b2.png[/t]
currently the shader will fade to 100 % transparent, which I could probably change to fade into black instead. Somehow.
The real issue, as near as I can tell is turning off an object when it is not lit (or covering the rest of the scene in "blackness" as the cuurrent darkness it just the black background)
[QUOTE=Jodern;47219054]I should probably have mentioned that the "light" there isn't an actual light, it's just a mesh with a transparent/gradient type shader that I've calculated using a bunch of raycasts.
[t]http://i.imgur.com/daTV9b2.png[/t]
currently the shader will fade to 100 % transparent, which I could probably change to fade into black instead. Somehow.
The real issue, as near as I can tell is turning off an object when it is not lit (or covering the rest of the scene in "blackness" as the cuurrent darkness it just the black background)[/QUOTE]
Are the objects "beneath" or "above" the shadow mesh in the sorting layers?
[editline]26th February 2015[/editline]
[QUOTE=Jalict;47218108]How would you guys handle things that should be global or accessed by several objects/components. Such as phys-setting, game state or state information.
I'm currently trying to be as object oriented as possible. But right now I want to have a score for the player and I know this is going to accessed by a few objects already.
Do you have some sort of "global" object with the game state script which handles all those fancy things, and then every other object that needs to access those variables just have a pointer that "global" object and then just GetComponent whatever they need.
Or is there a much better approach it this? I just find it to be a kind of weird way to do it.
[editline]26th February 2015[/editline]
Just took a quick look into PlayerPrefs, but that is persistent between sessions. Which I'm not looking for.
[editline]26th February 2015[/editline]
Is Singletons a better approach?[/QUOTE]
I use a variety of approaches; I have a static classes full of public constants/statics for things like LayerMasks and whatever I might need all over the project (Masks.IgnorePlayer, Masks.LevelOnly, etc.). I also have static classes with functions like ScreenHelper which has functions for drawing lines and circles in GL. And finally I use singleton objects like GameManager and MusicManager that are MonoBehaviours that persist through scene changes which I access with their instances: MusicManager.Instance.Play( AudioClip ).
Some people might argue [i]I'm doing it wrong[/i] but I don't give a fuck it works for me.
[QUOTE=foszor;47219084]Are the objects "beneath" or "above" the shadow mesh in the sorting layers?
[editline]26th February 2015[/editline]
I use a variety of approaches; I have a static classes full of public constants/statics for things like LayerMasks and whatever I might need all over the project (Masks.IgnorePlayer, Masks.LevelOnly, etc.). I also have static classes with functions like ScreenHelper which has functions for drawing lines and circles in GL. And finally I use singleton objects like GameManager and MusicManager that are MonoBehaviours that persist through scene changes which I access with their instances: MusicManager.Instance.Play( AudioClip ).
Some people might argue [i]I'm doing it wrong[/i] but I don't give a fuck it works for me.[/QUOTE]
The cube doesn't respond to the gradient atm because the light mesh shader fades to transparency instead of black,
but the main issue I'm having is hiding the part of an object that is outside the light mesh (ie is not lit)
Part of my graded unit is to develop a small project with a team of at least 2 other people. There's a pretty big lack of communication between us. These 2 guys I've known for a while, and can talk with them fine, but this one guy is so shy that it's nearly to the point of ignorance. Anyway I went ahead and gave myself the role of programmer, since the others wanted to do art/management. I kinda regret it though because I'm having more trouble with C# than I thought. Like, when I look at the Unity tutorials or whatever, I feel like I understand what each class does and the variables that are a part of it. But when I actually try to write code, I sit there not knowing how to go about it.
Just guess and start writing code that you think should work then once you have that baseline set, you can go through and fix and improve it. Syntactically incorrect code is a better start than no code
Yaaay I finished making a functional pong game with a guide. Time to go for breakout!
Was stumped as to why the GetKey.(up) wasn't working for a few minutes before I realized the "." was causing the issue, I am such a huge noob.
WARNING: Music.
[vid]http://a.pomf.se/zqbgqx.webm[/vid]
This is a preview of my latest project. I wish to create a fast-paced first person shooter, HEAVILY inspired by Team Fortress 2, Half-Life and Quake!
I am using Bolt for the multiplayer aspect of the game. It is a server authoritative game, and for now handles just like Team Fortress in the netplay side of things!
The video showcases basic player movement and some more advanced techniques, such as air strafing, bunny hopping and rocket jumping. For now, the Soldier is the only functional class. I will work on the rest of them once I get the soldier 100% done.
(Btw, I haven't coded death yet, so forgive me for the negative health, guys! :n)
What do you guys think?
(The song is Aphex Twin - Polynomial C)
I wish I would know how to use bolt :(
I tried it and I got stuck at some point but before that I got stuck in something else, it was just annoying.
[t]http://i.imgur.com/iwanzJK.png[/t]
Finally got that scripted menu working. Not so much of interest, but it took me 3-4 days for me to figure out a way around. All the elements were placed away off the canvas at ridiculous values. For the first, I rewrote the code that anchors, pivot and size would come first before position was declared. Then for the other, I wrote a custom version of SetParent where it can use anything that are based on the "Behaviour". Getting their transform and then putting it in the child's transform.SetParent(*parent here*). Which helps me getting Unity to shut up about parenting and flushing away the local relatives. And then third: I found the Canvas's pivot horrendous to work on, it was in middle of the screen. I put in a Panel in order to mask it and put up a new pivot located at the upper left corner.
[QUOTE=Jodern;47219257]The cube doesn't respond to the gradient atm because the light mesh shader fades to transparency instead of black,
but the main issue I'm having is hiding the part of an object that is outside the light mesh (ie is not lit)[/QUOTE]
You need to render the dark after you render the objects. I don't know how unity works, but in my game engine I use an offscreen buffer as a darkness/shadow texture that covers the whole screen. I calculate the light mesh for each light and render/blend that mesh on the offscreen buffer making transparent holes in it, and then render it over the whole scene. Transparent areas(holes) makes stuff beneath it visible(light), non transparent areas cover it in black(shadows).
[QUOTE=AntonioR;47224849]You need to render the dark after you render the objects. I don't know how unity works, but in my game engine I use an offscreen buffer as a darkness/shadow texture that covers the whole screen. I calculate the light mesh for each light and render/blend that mesh on the offscreen buffer making transparent holes in it, and then render it over the whole scene. Transparent areas(holes) makes stuff beneath it visible(light), non transparent areas cover it in black(shadows).[/QUOTE]
Thanks! I think I got it working
[t]http://i.imgur.com/tov8yGU.png[/t]
[vid]http://a.pomf.se/ojnpis.webm[/vid]
Shotgun! Currently doing the raycasting.
ScriptableObjects are cool, I wish I knew about them before.
Is there any 2d sprite level editors for unity? something where you can place objects properly on a grid?
Was sort of working on one myself but wanted to know if there was something already out there.
Does anyone know if there's any good camera management stuff in the asset store?
Like I'm trying to swap between different views and have the camera smoothly interpolate between them
[QUOTE=ZenX2;47233431]Does anyone know if there's any good camera management stuff in the asset store?
Like I'm trying to swap between different views and have the camera smoothly interpolate between them[/QUOTE]
You could just do it yourself? It's not that hard to make the camera interpolate position and rotation.
[QUOTE=TH3_L33T;47232342]Is there any 2d sprite level editors for unity? something where you can place objects properly on a grid?
Was sort of working on one myself but wanted to know if there was something already out there.[/QUOTE]
I was also looking for a good tile editor, the one in the 2d tool kit is awesome.
Still working on my RTS project.
Reached "Hello, A*" status last night:
[url]http://puu.sh/gfYx9/0433a4e90d.jpg[/url]
Now I'm workin' on path collision & smoothing. It's not perfect, but it'll do for now
[url]http://puu.sh/ghbW3/640e3263e6.jpg[/url]
And some cool selection rings from a few weeks ago
[url]https://dl.dropboxusercontent.com/u/96502721/S/coolcicle.mp4[/url]
edit: This isn't the WAYWO thread, woops
So i have a bit of a conundrum at the moment...
I have a skill system that I'm making. The way I currently have it is that I have SkillBase, which is my generic skill class. I have subclasses that alter the behaviour of SkillBase, like SkillBaseCharged, which charges a skill based on how long you hold your mouse down. However, to keep things abstract, my SkillController(what stores and manages all of the skills the player has) has to have a list of SkillBase's. Now say I needed to display in my GUI some special thing if a skill is a charged skill. With the current set up that is impossible cause I only have references to a SkillBase. Any suggestions?
[QUOTE=crazymonkay;47235007]So i have a bit of a conundrum at the moment...
I have a skill system that I'm making. The way I currently have it is that I have SkillBase, which is my generic skill class. I have subclasses that alter the behaviour of SkillBase, like SkillBaseCharged, which charges a skill based on how long you hold your mouse down. However, to keep things abstract, my SkillController(what stores and manages all of the skills the player has) has to have a list of SkillBase's. Now say I needed to display in my GUI some special thing if a skill is a charged skill. With the current set up that is impossible cause I only have references to a SkillBase. Any suggestions?[/QUOTE]
[code]
public abstract SkillBase
{
public virtual void OnGUI()
{
Debug.Log( "SkillBase GUI" );
}
}
public FireBall : SkillBase
{
public override void OnGUI()
{
Debug.Log( "FireBall GUI" );
}
}
private List<SkillBase> skills = new List<SkillBase>();
private void Awake()
{
FireBall fireball = new FireBall();
skills.Add( fireball );
}
private void OnGUI()
{
foreach ( SkillBase skill in skills )
{
skill.OnGUI();
}
}
[/code]
The result will be the log flooded with "FireBall GUI". You [b]CAN[/b] draw the BaseSkill GUI with:
[code]
public FireBall : SkillBase
{
public override void OnGUI()
{
base.OnGUI();
Debug.Log( "FireBall GUI" );
}
}
[/code]
Which will call both the SkillBase OnGUI and the FireBall OnGUI.
Does that help?
[editline]28th February 2015[/editline]
You can read more about Polymorphism here: [url]https://msdn.microsoft.com/en-us/library/ms173152.aspx[/url]
I've had a really annoying time the past few hours tracking down problems that were happening because of script execution order.
Always think about the order in which things need to happen.
[QUOTE=elih595;47233779]I was also looking for a good tile editor, the one in the 2d tool kit is awesome.[/QUOTE]
Try out [URL="http://www.mapeditor.org/"]Tiled[/URL], it's mainly a tile map editor but still can be handy. You can also import maps and what not into Unity via [URL="https://github.com/marshallward/TiledSharp"]Tiled Sharp[/URL].
[QUOTE=Pelf;47232188]ScriptableObjects are cool, I wish I knew about them before.[/QUOTE]
What are they good for actually?
Nevermind, I see they are good for storing data :).
Sorry, you need to Log In to post a reply to this thread.