|
TerraGoetia posted:Trying to compute line of sight is causing me headaches. I wrote something up based on what I remember from high school algebra, but I end up seeing through walls sometimes. I want line of sight to be useful for targeting ranged abilities, so I can't pass it off as a quirk. Generally the way you want to be checking LOS is to verify if the target is in the view frustum (basically, within max distance and view angle) of the entity doing the check, and, if so, run something like a Bresenham test between them for any colliders like walls. If objects can fall in multiple buckets, or you have things like windows, you may want to do multiple Bresenham checks between the point you chose as your entity's "eye" and every cell the target's body inhabits. Obviously this won't test for things like really tiny windows unless you make your cells equally tiny, and Bresenham is coarse grained so it may give false negatives. You can always tweak cell size or do bonafide ray casting when you get a negative to double check. There's a lot of ways you can optimize LOS tests depending on the specifics of your game. E: Note, Bresenham has issues around diagonals. You can skirt around this by "thickening" the line to its neighboring cells around where its error is under 0. Linear Zoetrope fucked around with this message at 07:00 on Jan 8, 2018 |
# ? Jan 8, 2018 06:56 |
|
|
# ? May 25, 2024 02:23 |
|
Depending on the context, like in some top down 2d game or something involving tiles, LoS can get kind of weird if you just rely on drawing lines. If thats the kind of problem you're dealing with, this might lead you to something useful.
|
# ? Jan 8, 2018 07:02 |
|
How crazy are you Unity people getting with the MonoBehaviours? For my ring menu, I wanted to add a basic zoom-in/zoom-out effect when opening/closing the menu. I could just slap a pile of conditional logic and supporting variables to fuss over that in ring menu GUI code, but I want to just throw some little MonoBehaviours around like candy to take care of this for me.
|
# ? Jan 8, 2018 08:39 |
|
Rocko Bonaparte posted:How crazy are you Unity people getting with the MonoBehaviours? For my ring menu, I wanted to add a basic zoom-in/zoom-out effect when opening/closing the menu. I could just slap a pile of conditional logic and supporting variables to fuss over that in ring menu GUI code, but I want to just throw some little MonoBehaviours around like candy to take care of this for me. Small is good, generally. the overhead for a MonoBehaviour isn’t huge, and being able to re-use them is extremely useful. In my current project at work, things like that are either handled by a Unity animation or a tween behavior. I generally prefer the tweens unless the animation is complex in some way.
|
# ? Jan 8, 2018 12:02 |
|
Linear Zoetrope posted:Bresenham
|
# ? Jan 8, 2018 13:33 |
|
leper khan posted:I generally prefer the tweens unless the animation is complex in some way.
|
# ? Jan 8, 2018 17:41 |
|
Rocko Bonaparte posted:How are you doing tweens in Unity? At work we have a small lib someone here wrote with a bunch of MonoBehaviours. On my personal projects usually I use http://dotween.demigiant.com or similar.
|
# ? Jan 8, 2018 17:45 |
|
leper khan posted:At work we have a small lib someone here wrote with a bunch of MonoBehaviours. On my personal projects usually I use http://dotween.demigiant.com or similar. Alright, maybe it's time I asked that question: What assets are people finding useful? I'm wondering how many wheels I'm reinventing or accidentally about to reinvent. I'm currently getting a lot of use out of: The ProTools Suite InControl Ink Unity Integration UI - Builder: Got on the cheap and haven't really gotten into this yet... Unity Test Tools TextMesh Pro Unity Logs Viewer Things I probably shouldn't have written and reused: My memoization/serialization suite The dialog system I created to interface with the Ink engine I suspect my timing system is dumb and implemented 5,000 times better 5,000 times before I wrote my own pathfinding stuff but I suspect this one was hard to dodge. I'm doing top-down 2.5d and wanted to auto-build my network based on my level data. I just couldn't find anything I trusted.
|
# ? Jan 8, 2018 18:05 |
|
Does this video demonstrate sufficiently good enough ability as a gameplay programmer? In other words, is it "portfolio worthy"? I've been posting progress on it for the past couple of weeks in the Games thread and on the AwfulJams Discord server. Altogether, I've clocked about 35 hours of time investment and productivity into the project. I also put it in its current state on my Github thing for portfolio purposes and I want to show it to you guys and get your opinions on whether it's sufficiently "portfolio material" as a gameplay programmer. https://www.youtube.com/watch?v=D97kQJAYswY Here's my Trello board that I've been using to manage the project: https://trello.com/b/1TP9El03 Basically I need someone to tell me that I am still poo poo at programming or that I'm officially "good enough" on the "you must be this good to even think about getting a job doing this kind of thing for a living" scale. Love Stole the Day fucked around with this message at 21:06 on Jan 8, 2018 |
# ? Jan 8, 2018 20:58 |
|
For some reason I can't post on the UE forum so maybe you guys can help me. I'm trying to compile the UT source by following this guide. When I try to build the Agent project I get an error: code:
code:
|
# ? Jan 8, 2018 21:52 |
|
Rocko Bonaparte posted:Is the non-pro version sufficient or did you put out the dinero? Biggest productivity gain I bought for myself in a team setting is “Console Pro” (though I’ve has some issues with the remote console which seems like it would be nice). I also like Odin Inspector, but my office hasn’t (and likely won’t) spring for licenses for the team. TextMeshPro is a must have, and now free Unity Test Tools has since been rolled into the engine proper iirc. I shamefully use it less often than it warrants.
|
# ? Jan 8, 2018 21:53 |
|
leper khan posted:TextMeshPro is a must have Unless you want Chinese or extensive Japanese support
|
# ? Jan 8, 2018 23:23 |
|
Boz0r posted:For some reason I can't post on the UE forum so maybe you guys can help me. I'm not an Unreal dev, but I'm confused. You have a C# file and C# error, but your guide doesn't mention C# at all. Is this supposed to be a C++ class/file? If it's supposed to be C#, how are you using C# in UE?
|
# ? Jan 9, 2018 00:08 |
|
BirdOfPlay posted:I'm not an Unreal dev, but I'm confused. You have a C# file and C# error, but your guide doesn't mention C# at all. Is this supposed to be a C++ class/file? If it's supposed to be C#, how are you using C# in UE? Because with UE4, you use C++ for everything except the sort of project "metadata" stuff, which is done in C#. So every UE4 project has a few .cs files in there whose only purpose is to configure the engine. Don't know why they use C# for it, really. Also I don't know what's up with his issue, but it probably has something to do with that somehow?
|
# ? Jan 9, 2018 00:13 |
|
Love Stole the Day posted:Because with UE4, you use C++ for everything except the sort of project "metadata" stuff, which is done in C#. So every UE4 project has a few .cs files in there whose only purpose is to configure the engine. Don't know why they use C# for it, really. Also I don't know what's up with his issue, but it probably has something to do with that somehow? Because I'm stupidly helpful, I signed up for the UnrealEngine source on Github. And, wow, this stuff is from the source and is C#. Sorry about that. First, is the body of XButton.cs in the UnrealControls namespace*? Next, do you have "Resources.Designer.cs" in ".../Programs/UnrealControls/Properties? Finally, does that define the UnrealControls.Properties namespace? *If you're unfamilar with C# you should see something like this after the using's: code:
|
# ? Jan 9, 2018 00:53 |
|
Boz0r posted:For some reason I can't post on the UE forum so maybe you guys can help me. Is it possible you downloaded 'develop' or 'master' instead of the one of the 'release' branches? Also make certain you ran the appropriate bash/shell scripts to download third party sources and other files.
|
# ? Jan 9, 2018 02:05 |
|
Can any Unity people help me out with a simple script? I'm trying to store references to enemies and to the controller script components attached to each enemy. This code gives me: "NullReferenceException: Object reference not set to an instance of an object" code:
(I can make the game work this way by finding the scripts at runtime with GetComponent in the Update function, but I've heard that it's much better for performance to store references.) code:
Polo-Rican fucked around with this message at 05:07 on Jan 9, 2018 |
# ? Jan 9, 2018 04:17 |
|
Polo-Rican posted:Can any Unity people help me out with a simple script? I'm trying to store references to enemies and to the controller script components attached to each enemy. First things first, I'm assuming that the NullRef is firing on the GetComponent line, because that's the only time that you're doing anything with a reference. The simple assignment lines wouldn't do that and the Instantiate call is identical between the two snippets. This would mean that oneenemy isn't a valid reference. This could be because enemy isn't a GameObject and the as operation would result in a null. If I'm wrong about my assumption, which line is causing the NullRef?
|
# ? Jan 9, 2018 05:55 |
|
Ranzear posted:Unless you want Chinese or extensive Japanese support Doesn’t it work if you shove all the glyphs you need into the font generator? I was able to get Arabic working a few years ago, even with their different chars for in the middle of words or not.
|
# ? Jan 9, 2018 08:24 |
|
Polo-Rican posted:Can any Unity people help me out with a simple script? I'm trying to store references to enemies and to the controller script components attached to each enemy. I'm just looking in and I don't know anything about Unity, but are you creating those arrays somewhere before you try and assign to them?
|
# ? Jan 9, 2018 08:27 |
|
baka kaba posted:I'm just looking in and I don't know anything about Unity, but are you creating those arrays somewhere before you try and assign to them?
|
# ? Jan 9, 2018 09:43 |
|
I fixed the problem. Originally I'd just defined the array at the top of my code like this: code:
code:
One thing that sucks about Unity is the amount of bad advice out there. If you google lots of issues, you find so much bad code! Polo-Rican fucked around with this message at 16:30 on Jan 9, 2018 |
# ? Jan 9, 2018 15:51 |
|
leper khan posted:Doesn’t it work if you shove all the glyphs you need into the font generator? I just know there are far too many to fit in one, let alone a dozen, textures. If we were making a game about dragons, we would actually have been missing 竜 The prior solution was to constrain the writers to a limited Japanese character set, but that won't work for Chinese. Don't even get me started on emoji support. Rasterizing entire fonts to a texture should be a crime. Ranzear fucked around with this message at 19:53 on Jan 9, 2018 |
# ? Jan 9, 2018 19:50 |
|
Update on this:leper khan posted:At work we have a small lib someone here wrote with a bunch of MonoBehaviours. On my personal projects usually I use http://dotween.demigiant.com or similar. I gave this a shot this morning and was impressed. I was able to consolidate a bunch of bullshit code and state from a MonoBehaviour and encapsulate everything I needed to do in one tween. In particular, I tried it for the code I ran when closing the ring menu. I wanted the menu to "zoom out" by having the scale transform go from 1x to 0x over a very short duration. Before this I needed to track when I told it to close and interpolate across that in Update() to do the scaling. Once the animation finished, I wanted to unpause and hand control back to the main game. I was able to put all that code in a OnComplate callback in the tween declaration. It put all the code nicely in one spot and got rid of all the crap variables I was using to do all this across the file. What depresses me is that I didn't even really know what a tween was before this, and I was able to embark on my own code to move across variables over a time span.
|
# ? Jan 9, 2018 19:57 |
|
Ranzear posted:I just know there are far too many to fit in one, let alone a dozen, textures. If we were making a game about dragons, we would actually have been missing 竜 If you have the source version of TMP, you can probably make multiple atlases and index into each one based on the character you’re looking at. Definitely not a simple thing I guess. SDF fonts basically require you to render into a texture though, so They’re really great for most other languages.
|
# ? Jan 9, 2018 19:59 |
|
I downloaded the newer version of UE and plopped it into the UT project and it compiles. I hope it doesn't break anything.
|
# ? Jan 9, 2018 20:24 |
|
Anyone ever implemented on gpu octrees? I'm looking at https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter37.html and cannot make heads or tails of it. Specifically the part about how it's stored on the gpu/the lookup shader quoted in that article. Even with the source, which is here: http://http.download.nvidia.com/developer/GPU_Gems_2/CD/Index.html , I cant figure out what's going on. That the file that handles the actual octree structure (CHrdwTree) is essentially uncommented and confusingly written doesnt help. (nor does that I havent used c++ in like 5 years ) I don't understand how the shader is ever getting a child octant, it looks to me like the IndirPool from tree_lookup() in the shader files just takes one sampler3D, which is just 2x2x2 if I'm reading the article right, so wouldnt offer the resolution that the application is clearly getting. But I dont get it, should I be using an array of 3d textures? If so how is the lookup function from the article going from one sampler3d to the next, and wouldnt creating hundreds, if not thousands or even tens of thousands, of small 3d textures be horribly inefficient? I feel like it's doing something trickier than that but I cant figure it out. At any rate I'm trying to get this whole concept running in Unity but I've hardly any clue how to handle the cpu-gpu communication for this sort of thing. Any help is appreciated.
|
# ? Jan 10, 2018 04:45 |
|
Out of curiosity, why is it so normal to put fonts into textures, and so not normal to transform truetype fonts into triangles in a vertex buffer on the fly? Seems like triangle-based fonts would have a lot more flexibility rendering-wise, and you'd be able to just use truetype font files and a not that complicated library for the transformation. I realize truetype has curves in it, but at font scales most curves could be readily approximated as like 4-6 straight lines. The 'holes' in truetype fonts make for trickier transformation, but I've done that kind of transformation, it's not like it's an intractable problem.
|
# ? Jan 10, 2018 07:30 |
|
Thanks for the advice. I found that I was able to program Bresenham's Algorithm for my line of sight based on the notes at https://csustan.csustan.edu/~tom/Lecture-Notes/Graphics/Bresenham-Line/Bresenham-Line.pdf. I've had some irregularities regarding seeing behind "around" some walls, but only if I'm looking at them from a north-south perspective. I can probably just design my level's sight line around these issues and test carefully.
|
# ? Jan 10, 2018 07:30 |
|
Polo-Rican posted:I fixed the problem. There's a few fundamental misunderstandings here that are gonna get you in a lot of trouble down the road, let's sort that out! So first of all, null represents nothing. It's like a special object that means "there's nothing here". It definitely isn't an array, so you can't assign values to it, which is what you were trying to do. It's ok to set a variable as = null, but you need to make sure you've set it to an actual instance of your object before you try and treat it as one, or you get that crash (which is really there to help you find and fix the problem, when you're trying to do something that doesn't make sense). That's what you're doing in your solution where you call new GameObject[], that's why it works - enemies is set to an actual array now, instead of null The second point ties into that - when you go code:
The equals obviously assigns a value to that label, you're telling it what object to point at, basically. So the right hand side is where you provide that object - you can create one with new, or call a function that returns a GameObject[], or put another GameObject[] variable there (so both labels end up pointing to the same object), or put null if you don't actually want to assign an actual object. Point is, if you want to create an array, it happens on the right side of that assignment. So private GameObject[] enemies = null; creates a label for a GameObject array but points it at null, so that's what you get when you try and access it. GameObject[] enemies = new GameObject[10]; creates the label, but also creates an actual array object, and then points the label at it. So this works when you try and access it as a real array! enemies = GameObject.FindGameObjectsWithTag("Enemy"); is taking the label which you've already created (otherwise it wouldn't know what 'enemies' even refers to), calling that method that returns an array of GameObjects, and pointing the label at the array it produces. Now there's an array there and you can use it You don't actually need to set the variable to anything when you create it, you can just do the left hand side bit and create the label - code:
That was way longer than I meant it to be but I don't have time to cut it down, I hope it makes sense! I'd honestly recommend going through something like the banana book and just getting a handle on the language and the core stuff you need to be aware of. It'll definitely help you fight through all the bad advice and code examples *C# sets fields (the top level variables in your class) for object references to null if you don't assign anything - bla bla technical language stuff, point is you don't need to set a thing to null unless you want it to be null, say as a default value. Just creating the label can make your intent clearer since you're explicitly not giving it a value just yet
|
# ? Jan 10, 2018 10:05 |
|
roomforthetuna posted:Out of curiosity, why is it so normal to put fonts into textures, and so not normal to transform truetype fonts into triangles in a vertex buffer on the fly? Seems like triangle-based fonts would have a lot more flexibility rendering-wise, and you'd be able to just use truetype font files and a not that complicated library for the transformation. I realize truetype has curves in it, but at font scales most curves could be readily approximated as like 4-6 straight lines. The 'holes' in truetype fonts make for trickier transformation, but I've done that kind of transformation, it's not like it's an intractable problem. delaunay triangulation is O(n^3). and often times, a lot of triangles is a bad case for rasterization. there's other algorithms which might be faster (e.g. lorenzetto http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.11.4259&rep=rep1&type=pdf ), but r&d is ongoing. and then you also have to do grid fitting / stem darkening for legibility at small sizes. honestly for lots of small shapes cpu rasterization extremely outperforms gpu rasterization, especially when you can do curve interpolation on the cpu.
|
# ? Jan 10, 2018 12:02 |
|
can’t you use your os to render text on an image and use that as a texture? why the extra work? do you actually need 3d text or something?
|
# ? Jan 10, 2018 12:15 |
|
leper khan posted:I also like Odin Inspector, but my office hasn’t (and likely won’t) spring for licenses for the team.
|
# ? Jan 10, 2018 15:10 |
|
Rocko Bonaparte posted:What's the big whoop on Odin Inspector? Does it just generally expose properties better by default? I saw it touting serialization as well as not having to write custom inspectors, but I didn't understand what they did to be able to brag about that. All I could really see were the examples of the additional variable types they were able to expose, as well as how they changed how some existing stuff was exposed, which admittedly looked pretty good. There’s a[n optional] custom serializer they wrote which will handle more types (eg dictionary). They wrote a bunch of custom editors for things like Quaternion so you can have the editor show them as Euler angles (I don’t have 3d math galaxy brain). See also colors and a bunch of other stuff. More cool, in my opinion, are all of the attributes. You can tag fields as supposed to be filled with a scene object or prefab and then it tells you if the contract is broken. There are a lot of new attributes, and many are neat/useful. Others I just haven’t bothered to get to yet Scene validation is an incredibly useful tool for larger projects where things can start changing out from under you.
|
# ? Jan 10, 2018 17:13 |
|
leper khan posted:
An example of the rules: 1. There should be a default player start point (warning, just used for testing) 2. However, there definitely does have to be at least one way into the scene 3. There shouldn't be any cameras because I have something taking care of that; flag existing cameras in the scene Is this something that can be written simply with that?
|
# ? Jan 10, 2018 18:39 |
|
Rocko Bonaparte posted:Oh yeah I just remembered that because I have been doing something similar. I had to write out a few assertions that my extension looks for with Reflection and then runs to tell me if I've hosed up having or not having things in the scene. This thing can do something similar? Some of those things can be done with just an attribute on a field (eg the Required attribute) yes
|
# ? Jan 10, 2018 20:09 |
|
Shinku ABOOKEN posted:can’t you use your os to render text on an image and use that as a texture? why the extra work? do you actually need 3d text or something? This is pretty much what Unity's built-in text system does (or well, they probably use FreeType or similar but same deal). Doing this is fast enough that you can, if you want to, render to that texture on-demand and just display the letters at the size/style you want without much issue. Even better, if you need the same glyph again, you just pull the one you already rendered out of the texture. You can also pre-render all the glyphs you think you'll need beforehand for even more speed. The problem with this method is that you're pre-rendering text at fixed sizes; glyphs rendered at 16 pt just aren't going to look good at 80 pt size. One solution to this, which TextMeshPro uses, is to instead render the glyphs out and then generate signed distance field textures from them. With these you do just a bit of extra math to determine your final alpha, and you can get very smooth-looking fonts rendered at very disparate sizes out of a single glyph texture, and the texture doesn't even have to be that big. There's also certain kinds of effects (glow, soft drop shadow, among others) that become really easy and cheap to render with SDF fonts. The issues with this method: - Generating the signed distance field texture is, relatively, very slow. Because of how slow it is, you pretty much _have_ to pre-render all your glyphs. This means you can't easily ask for new ones on-demand. If you're localizing for East-Asian languages this can quickly become a big problem, because now you have to either pre-render a crapload of SDF textures, or try to pick which ones you think will or won't get used and add some limitations. - At very small sizes (IMO) SDF-rendered fonts are much harder to read than with the traditional method, or at least with TMP they are. You could probably mitigate that by smoothing in the shader or anti-aliasing, but with the traditional method you'll get properly rendered fonts at exactly the size you want, every time. Some links: https://en.wikipedia.org/wiki/Signed_distance_function - Wikipedia's articles about these kinds of things are generally very unhelpful for me (I am a math dummy), but it's probably technically super-precise or something https://www.youtube.com/watch?v=CGZRHJvJYIg - A video showing pretty well what the results are of SDF fonts visually
|
# ? Jan 11, 2018 04:28 |
|
leper khan posted:Some of those things can be done with just an attribute on a field (eg the Required attribute) yes I'm not following how that would work. The situation is that I need to ensure that there are GameObjects in the scene that meet these rules--or that there aren't GameObjects in the scene meeting other rules. How would I assign attributes to make such rules work? In other news, I discovered the RequireComponent attribute while trying to look that up.
|
# ? Jan 11, 2018 07:02 |
|
roomforthetuna posted:Out of curiosity, why is it so normal to put fonts into textures, and so not normal to transform truetype fonts into triangles in a vertex buffer on the fly? If that's not possible, then there are three major problems with mesh fonts: One is that they're not really any cheaper to render except at large sizes, polygon data is fat (8 bytes per vert, at least 2 per edge), and the triangles have to be rasterized. Second is that it's much harder to handle holes. The glyph for "o" for example is just two circles, the hole is cut out by the rendering process. When rendering to a texture (and there are some GPU rasterizing algorithms...), that's pretty easy because overlap can be cancelled out using stencil invert, even/odd checks, and other techniques, but if the hole has to be done by cutting it out of the geometry, then you're basically talking doing CSG. Third is that they are bad at low resolutions if they're rendered directly into the scene because they rely on geometric anti-aliasing like MSAA, post-processing shaders like FXAA, or temporal. Texture filtering by itself is pretty good at minimizing artifacts from subpixel motions, and when that's not enough, you can do fancy stuff in the shader. OneEightHundred fucked around with this message at 09:55 on Jan 11, 2018 |
# ? Jan 11, 2018 08:48 |
|
|
# ? May 25, 2024 02:23 |
|
Rocko Bonaparte posted:I'm not following how that would work. The situation is that I need to ensure that there are GameObjects in the scene that meet these rules--or that there aren't GameObjects in the scene meeting other rules. How would I assign attributes to make such rules work? .... you just put the attributes on things. I don’t understand what the issue is.
|
# ? Jan 11, 2018 09:30 |