KillHour posted:Ray casts really aren't that resource heavy in and of themselves. You can probably do a hundred per frame no problem. To expand on this as well, you can create an invisible greatly simplified mesh that you use specifically for checking vision. A model with a bunch of surface deformations or edges can be reduced massively if all its going to be used for is "is this mesh intersecting the ray between A and B".
|
|
# ? Dec 18, 2017 22:41 |
|
|
# ? May 11, 2024 07:56 |
|
Regarding my prefab crap, I can probably use the EditorSceneManager.activeSceneChanged event to do my bidding. I have to dabble in it to be sure, but it reads like the kind of thing I wanted. Edit: Apparently not. This is for when one scene becomes another versus something changing in the current scene. You see some strange stuff online about all this stuff... Edit Edit: EditorApplication.hierarchyWindowChanged seems to do the job. I can drop a prefab down and then take a peek to see if I care about it: code:
Rocko Bonaparte fucked around with this message at 15:12 on Dec 19, 2017 |
# ? Dec 19, 2017 08:26 |
|
If you want to know what seems to work, this is what I figured out for OnHierachyWindowChanged()code:
This lead to some materials shenanigans in DropInWorld(). I'm attaching a MeshRenderer, Meshfilter, BoxCollider, and my own sauce there, and I have to specify the texture. Unity gets really mad that I'm not assigning this to sharedMaterial in-editor. To be honest, I don't really understand the significance of sharedMaterial versus a regular material; the editor explains the ramifications of it but not why the editor is so fussy about using it and why I leak if I don't. If it'll jar somebody's memory, the error was "Instantiating material due to calling renderer.material during edit mode. This will leak materials into the scene. You most likely want to use renderer.sharedMaterial instead." I did a very cargo-cult thing to get it to work because sharedMaterial was null walking into a new MeshRenderer: code:
|
# ? Dec 20, 2017 07:29 |
|
I'm now doing the normal thing of trying to manage collisions and physics in Unity again. In this case, I want to drop an item in the world and have gravity plop it where it belongs. I then want my player to be able to pick it up again. The latter would be served by a MonoBehaviour diverting OnCollisionEnter/OnTriggerEnter to a routine that checks if the target matches all the rules; all I really need is for those callbacks to run at all. The player is using a character controller with a capsule collider. The bulk of the control is managed by InControl. I gave the item a RigidBody just so I could give it gravity. It is not set to be a trigger; if it was, then it falls straight through the world. The world is done with ProBuilder Detail entities. Right now, the object falls, hits the world, and stops. The collision callbacks don't run even if I'm driving my player all over the item like a tonka truck. What I am thinking of changing is creating a second game object just for the item giver script, assigning that a spherical collider that is a trigger. I would assign that to the falling item; I assume the collider would follow with it. I'd have to rewrite the logic a little bit and probably create a utility function to manage it. I can see it working, but is it an optimal way of solving the problem? Edit: I guess I can just throw more colliders right on the same GameObject. Thanks for being my rubber ducky! Rocko Bonaparte fucked around with this message at 22:05 on Dec 24, 2017 |
# ? Dec 24, 2017 20:26 |
|
Not a question at all but I just feel like sharing a happy moment I've been having. I've been doing planning on paper without doing any actual coding and was starting to wonder if I was just mucking about, but I suddenly managed to have a real epiphany thanks to taking time to think things through even when it didn't feel like it was fitting together. I finally feel like I really "get" why inversion of control and events/delegates are such a good and powerful things, instead of just doing it because people told me it was smart. Essentially, I've worked out a plan to have a lot of my game's logical stuff carried out via Interactions, which are just serialized objects. They take a list of Targets, which have conditions for acceptability, and have a list of Effects which do things to targets. Effects are just kind of wrappers for functions that turn the generic Targets into parameters to call the functions with. The "aha" moment came when I came to realize that, by instead of doing things like "Okay its an attack from an Actor to an Actor, so it does Actor.Item.Weapon.DamageValue amount of damage and, uh, poo poo, what about modifiers like armor and the weather and alignment of planets, I guess I need to know all that too, poo poo now I can't change anything, and gently caress what if I make a new item type gently caress gently caress", I could now just throw whatever generic Targets I want to Effects and now, suddenly, its the function's job to sort out all that nonsense, and the function can just hand the bag down to the Targets themselves and essentially tell them "Yo you're being attacked by This, which says its attacking with This damage, sort your own poo poo out". So suddenly these Interactions can operate like they're just working in a kind of dream logic where they don't actually have to care about anything else's implementation anymore. If something fails to work it can crash or do something else but its no longer the concern of the higher level stuff at that point, its instead something like "I actually dunno what to do when attacked by a, uh, brick wall???" and now instead of having to shuffle a bunch of ultra dependent poo poo around that breaks whenever the underlying stuff changes at all, its just modifying some function somewhere to accommodate things, or modifying the target conditions to disallow that interaction. It suddenly feels like once I get this poo poo in place, and create a few interactions and hand them to the right stuff, and get the UI to know how to generate an appropriate interface for providing targeting information from the user, that I could throw together basically anything I want and not have to care if I decide to change everything out from under it. I'm actually feeling pretty excited to implement this and find out where my train of thought fucks up terribly and makes me miserable again. e: doing more messing with it, this is probably a very good place to work in some Event system for dealing with Effects, or something like that. It seems like an ideal fit. Tiler Kiwi fucked around with this message at 14:14 on Dec 29, 2017 |
# ? Dec 29, 2017 13:16 |
|
Persistent Hamprince posted:Not a question at all but I just feel like sharing a happy moment I've been having. I've been doing planning on paper without doing any actual coding and was starting to wonder if I was just mucking about, but I suddenly managed to have a real epiphany thanks to taking time to think things through even when it didn't feel like it was fitting together. I finally feel like I really "get" why inversion of control and events/delegates are such a good and powerful things, instead of just doing it because people told me it was smart. You’re using Unity, yeah? this talk isn’t bad event stuff around 28:00, but the rest is probably worth watching
|
# ? Dec 29, 2017 14:51 |
|
thanks. i was actually not really familiar with scriptable objects until you mentioned them a while ago, so that was a bit of advice that turned out to be super helpful.
|
# ? Dec 29, 2017 15:07 |
|
If I'm making a game for Windows and Mac, how sorry am I gonna be later on for manually maintaining the Visual Studio and Xcode projects? It feels like I should use CMake or something to generate them, but on the other hand I won't be distributing the source code, so no need for using CMake to make sure whoever is doing the build is using a compiler that supports all the C++11/14 features used, where they have SDL installed, etc. I'm aware that I'll have to update both projects every time I added or removed a file, but most of the development is gonna be done on one platform and then just ported to the other, so that shouldn't happen too often. And it seems like using the CMake-generated project files to do the actual development work would be annoying. Maybe keep a separate project for development and use CMake to generate the build systems for building release binaries? Ideas? Or should I ask this in the C++ megathread? Doc Block fucked around with this message at 21:44 on Dec 29, 2017 |
# ? Dec 29, 2017 21:39 |
|
wasn’t there a hot new cpp build system? meson i think
|
# ? Dec 29, 2017 22:30 |
|
Shinku ABOOKEN posted:wasn’t there a hot new cpp build system? meson i think
|
# ? Dec 30, 2017 01:27 |
|
roomforthetuna posted:You could use Google's bazel build system. As a product of Google it's sure to be supported for years to come, just like Google Code, Google Reader, Google's XMPP servers, or an Android device from more than two years ago. https://www.gwern.net/Google-shutdowns
|
# ? Dec 30, 2017 01:41 |
|
I’m probably dumb but I’d use a build system if I had more than two platforms to support.
|
# ? Dec 30, 2017 01:43 |
|
Doc Block posted:If I'm making a game for Windows and Mac, how sorry am I gonna be later on for manually maintaining the Visual Studio and Xcode projects? It feels like I should use CMake or something to generate them, but on the other hand I won't be distributing the source code, so no need for using CMake to make sure whoever is doing the build is using a compiler that supports all the C++11/14 features used, where they have SDL installed, etc. How easy is it to figure out when you make a mistake and forget to add a file to one solution and not the other? If it's difficult and leads to unexpected problems, then that's a point for automation. If it's obvious that something's wrong, and obvious how to fix it, then automation isn't as necessary. How much time are you spending maintaining those solutions right now? How many files do you add day to day? If you're adding a ton, then the automation investment is worth it. How often do you avoid making new C++ files and instead shove stuff into existing files, even when it doesn't make sense or kind of breaks your standard? If you're not creating new files as often as you should, then it might be because you've made it difficult to create new files and you're avoiding updating those solutions. Autogenerated solutions and projects are great when done correctly. It is easy to gently caress up the automation, and it's also easy to go down a bad rabbit hole and spend way more time on an automated solution than you end up saving.
|
# ? Dec 30, 2017 01:48 |
|
roomforthetuna posted:You could use Google's bazel build system. As a product of Google it's sure to be supported for years to come, just like Google Code, Google Reader, Google's XMPP servers, or an Android device from more than two years ago. Or Tango.
|
# ? Dec 30, 2017 05:03 |
|
Keep in mind that if you're doing C++ builds on Windows that you expect to be portable to any non-MS platform and you're using templates at all, you need to constantly check that your code is still compiling on that other platform because MS's C++ compiler is extremely over-permissive about parsing identifiers in template code.
|
# ? Dec 30, 2017 05:15 |
|
Chainclaw posted:How easy is it to figure out when you make a mistake and forget to add a file to one solution and not the other? If it's difficult and leads to unexpected problems, then that's a point for automation. If it's obvious that something's wrong, and obvious how to fix it, then automation isn't as necessary. I haven't started the game yet, but I'm most likely gonna do all/most of the development on Mac and then port to Windows, since I'm a Mac crybaby and am a lot more familiar with macOS than Windows. So having to mess around with adding/removing/renaming files for both at the same time shouldn't be too big of an issue. OneEightHundred posted:Keep in mind that if you're doing C++ builds on Windows that you expect to be portable to any non-MS platform and you're using templates at all, you need to constantly check that your code is still compiling on that other platform because MS's C++ compiler is extremely over-permissive about parsing identifiers in template code. Thanks, I'll definitely keep this in mind.
|
# ? Dec 30, 2017 10:34 |
|
OneEightHundred posted:Keep in mind that if you're doing C++ builds on Windows that you expect to be portable to any non-MS platform and you're using templates at all, you need to constantly check that your code is still compiling on that other platform because MS's C++ compiler is extremely over-permissive about parsing identifiers in template code. It'll also help to add /permissive- to the compiler flags, they've been working on 'fixing' that issue. It's not perfect, but at least it makes you somewhat less likely to accidentally break on other compilers.
|
# ? Dec 30, 2017 11:18 |
If anything, won't permissive make it less likely to compile on other systems? The only thing compilers have in common is the ISO standard, so being permissive in terms of breaking the rules of the standard, raises the chances of it breaking on another compiler, right?
|
|
# ? Dec 31, 2017 13:57 |
|
Joda posted:If anything, won't permissive make it less likely to compile on other systems? The only thing compilers have in common is the ISO standard, so being permissive in terms of breaking the rules of the standard, raises the chances of it breaking on another compiler, right? The 'default' is permissive, MS's compiler flags use '-' at the end to signify disabling something. (The idea seems to be they'll make it disabled by default eventually, at which point it becomes just `/permissive' to re-enable it for older MS-specific stuff)
|
# ? Dec 31, 2017 14:04 |
|
I came up with an unusually plausible new year's resolution - having done adventofcode last month, I realized I quite enjoyed doing a bite-sized programming challenge every day at 9pm, and kind of missed it when it was over, so now that there is no adventofcode my resolution is to make my own similar-sized challenges - come up with a bite-sized development task for my game each day before 9pm, and then implement it at/around 9pm. Today I chose adding some sound effects to the tutorial room that's all that exists so far (having not done any sound in Godot before). Turns out recording, editing, learning how to get it into Godot and scripting functioning triggers for it into my text dialog can all be done in less than 45 minutes. Noice.
|
# ? Jan 2, 2018 07:01 |
|
Is Unity the only one of the bigger engines that has full tess shader support? I wanna mess around with some really experimental geometry generation (basically messing with the surface depending on the viewpoint of the camera and general things that Real Shapes Do Not Do, and no, a vertex shader isn't sufficient because I need the patch generation), but it looks like UE4 only has support for really basic displacement mapping and Godot none at all.
Linear Zoetrope fucked around with this message at 07:28 on Jan 2, 2018 |
# ? Jan 2, 2018 07:23 |
|
Can anybody think of a cute way to rotate icons for a ring menu using the new Unity UI? I can set up the menu just fine with basic sine/cosine, and I can just offset that over time based on what I want to do. However, I have this nagging feeling I could do something with anchors. I don't want the icons themselves to rotate, but rather I want the position of the icons to rotate around a center. I figured I could do something by setting their anchors to the center, or parenting them to something that is centered, and then just do a rotation on that one thing. I suspect I then have to do something else to lock the raw images so they don't rotate along with the position.
|
# ? Jan 4, 2018 06:12 |
|
Rocko Bonaparte posted:Can anybody think of a cute way to rotate icons for a ring menu using the new Unity UI? I can set up the menu just fine with basic sine/cosine, and I can just offset that over time based on what I want to do. However, I have this nagging feeling I could do something with anchors. I don't want the icons themselves to rotate, but rather I want the position of the icons to rotate around a center. I figured I could do something by setting their anchors to the center, or parenting them to something that is centered, and then just do a rotation on that one thing. I suspect I then have to do something else to lock the raw images so they don't rotate along with the position. Set rotation (not localRotation) to zero [in code]? If they’re not going to move around in game, you can just get things lined up and you’re fine. e: you may want to do a look at at the camera instead if you’re in a 3d environment.
|
# ? Jan 4, 2018 14:24 |
|
leper khan posted:Set rotation (not localRotation) to zero [in code]? If they’re not going to move around in game, you can just get things lined up and you’re fine. They'd be moving in-game. I'm assuming a Secret of Mana ring menu where 12 o'clock is the cursor and right/left rotates the elements clockwise/counter-clockwise. Just to really hammer in what I'm doing, if it were a clock, then all the hours would be upright. If I turn the clock, the hours should all still be upright even if they have rotated around a common center. At the moment, each hour is a Unity new-style UI RawImage. I was figuring that each of these objects has a transform so I am thinking I could set something up to use that instead of doing a bunch of trig every frame as things progressively rotate.
|
# ? Jan 4, 2018 20:51 |
|
When I want to parent position and not rotation in Unity, I usually set it up like this: Create some child objects on the parent with no visuals. Offset them as I need. Create a separate object with visuals that is not in that hierarchy. Create a new C# component that has a public Transform. Attach that script to the visual object, and set the public transform to the child object I want this to follow. In one of the updates (LateUpdate or FixedUpdate, I forget the best one for timing) for that script, I call SetPosition on the local object, setting it to the position of the referenced transform. The downside to this is your Unity hierarchy may be a hassle to manage. Also, if you have other important info in that hierarchy, like render order, it may be a pain in the rear end. If you need it in the hierarchy, then another solution is I use is: Create an intermediate child between the center of the circle and the object that is rendering. Have this center child have the offset position. On the final child, the renderable, the math gets much simpler because your local position will be 0,0,0, so you can set your rotation to whatever.
|
# ? Jan 4, 2018 22:23 |
|
Rocko Bonaparte posted:They'd be moving in-game. I'm assuming a Secret of Mana ring menu where 12 o'clock is the cursor and right/left rotates the elements clockwise/counter-clockwise. You don't need to do any trig. Just set the rotation to 0 on LateUpdate.
|
# ? Jan 4, 2018 22:23 |
|
You can also use rotatearound for the position and set the rotation manually after that.
|
# ? Jan 4, 2018 23:37 |
|
leper khan posted:You don't need to do any trig. Just set the rotation to 0 on LateUpdate. The trig is for positioning the RawImages. I calculate the angle between RawImages by dividing the number of them by 2pi. The x,y coordinates then are just r*sin(angle*i),r*cos(angle*i) around my center point. Currently I'm just recalculating that each frame based on which element is selected and some offset voodoo to try to animate it. The question is if I can set up some shenanigans with a parent transform that serves as the pivot and have the whole mess of RawImages rotate around that from one command. I'd probably still at least use the trig code to set up the initial positions. That being said, having a MonoBehaviour on each involved object going, "Oh! You want me to rotate? Vetoed!" does sound like a very novel way to prevent them locally rotating the each RawImage. Chainclaw posted:When I want to parent position and not rotation in Unity, I usually set it up like this: Create some child objects on the parent with no visuals. Offset them as I need. Create a separate object with visuals that is not in that hierarchy. Create a new C# component that has a public Transform. Attach that script to the visual object, and set the public transform to the child object I want this to follow. In one of the updates (LateUpdate or FixedUpdate, I forget the best one for timing) for that script, I call SetPosition on the local object, setting it to the position of the referenced transform I kind of figured it might end up being something like that. You're basically declaring a waypoint for each visual item and tying them at the hip, if I read this all right. KillHour posted:You can also use rotatearound for the position and set the rotation manually after that.
|
# ? Jan 5, 2018 00:51 |
|
Rocko Bonaparte posted:The trig is for positioning the RawImages. I calculate the angle between RawImages by dividing the number of them by 2pi. The x,y coordinates then are just r*sin(angle*i),r*cos(angle*i) around my center point. Currently I'm just recalculating that each frame based on which element is selected and some offset voodoo to try to animate it. Why are you dicking around with exact positioning on your own? Unity can handle rotation via Transform (in this case, RectTransform). It is one of the core transformation operations. No need to roll you own with a sine and cosine method per point. Also, there's simpler ways to get the points of a circle that don't require 2 * n trig function calls. Yes, shenanigans with the parent is exactly what you should want to do! This gives you a stable "base" for your menu. I would create a (possibly empty) parent GameObject for your menu that you rotate. From there, you can populate your menu options around the outside of it with a simple locking Behavior that resets the RectTransform rotation to Quat.identity*. Here's the finished product in action: Inside my canvas I have a Menu. The two little dudes are children of Menu and positioned at 12 and 3 o'clock, and only the one at 3 has the locking behavior. All I'm doing is rotating Menu's z-axis via its RectTransform. Your menu control should be controlling Menu's rotation, which can be done with overriding the rotation with one generated via one of the static Quat methods. *This is what leper means by zeroing it out. BirdOfPlay fucked around with this message at 04:10 on Jan 5, 2018 |
# ? Jan 5, 2018 04:04 |
|
E: nm
|
# ? Jan 5, 2018 04:27 |
|
I mostly just figured it out, although I'm still a bit frazzled about the anchor positions and pivots in the Unity UI system. As for not having to do the initial sin/cos bit at all, I assume what I should be doing it taking each item, anchoring it a radius above my center, and then rotating it by it's index * Count/2pi around the Z axis from the center or something. Is that what you're alluding to? Edit: What really got me was that I had to specifically set my ring center object's RectTransform anchor position to (0, 0). It would otherwise put it in a strange place. The HUD canvas had a centered anchor and pivot, and I would have assumed attaching a child object with a default RectTransform would put it smack in the middle but noooooo. Rocko Bonaparte fucked around with this message at 07:44 on Jan 5, 2018 |
# ? Jan 5, 2018 07:41 |
|
BirdOfPlay posted:Also, there's simpler ways to get the points of a circle that don't require 2 * n trig function calls. This statement led me to spend several hours playing around with circles and what little knowledge i have of finding arbitrary points in a circular orbit without trig functions and uh, as enlightening as that was I didn't figure out what you're alluding to. Everything I checked pretty much said "just do trig functions on the angle and center" so I'm stumped I guess. Reveal to me your secrets. I did learn that looking at any arbitrary point on an orbit you're on, presuming you know your own angle from the center, is just (angle1+angle2)/2 + 90 (with maybe some variation if a1+a1>=360 i guess idk im bad at math. from there i figured out you can get some other angles without trig functions, and maybe figure out the distance between you and said other point without trig functions (a big maybe actually), and presumably there's some other fuckery that i came to conclude was probably more complex than just doing some trig calls so aaaaa why didnt i pay attention in schoooool
|
# ? Jan 5, 2018 13:24 |
|
The point was that you shouldn't be DIRECTLY calling trig functions if you can avoid it. The native transform methods may use trig on the back end, but they're super optimized (I actually don't think they do, though. Unity uses quaternions for all that rotation nonsense).
|
# ? Jan 5, 2018 14:30 |
|
^Well, that particular bit was that you didn't need to find the sine and cosine of every interior angle of a circle to get your values. In general though, it is better to just let Unity handle it, rather than rolling your own. Even in my little 2D shooter, I'm using a muzzle child object to represent were a shot is spawn and how it should be oriented. I don't need to figure out where the "out" direction and position is, because the Transform of the muzzle moves and rotates with the gun/character. I can even just roll a random Quaternion rotation from a range of rotations (via a lerp) and multiply that to the right of the muzzle's rotation to simulate spread.Tiler Kiwi posted:This statement led me to spend several hours playing around with circles and what little knowledge i have of finding arbitrary points in a circular orbit without trig functions and uh, as enlightening as that was I didn't figure out what you're alluding to. Everything I checked pretty much said "just do trig functions on the angle and center" so I'm stumped I guess. The key is that it wasn't for arbitrary points on a circle, but equidistant points to form a circle. Remember your Linear Algebra and rotations. Making a unit circle is just (1, 0) rotated around the center. Here's a little pseudo code for it. Where pointCount is just how many points you want on your circle. code:
Also, it may be that making a hundred trig calls (for a 50-point circle) is no big deal, but BirdOfPlay fucked around with this message at 21:11 on Jan 5, 2018 |
# ? Jan 5, 2018 21:06 |
|
BirdOfPlay posted:Here's the finished product in action:
|
# ? Jan 5, 2018 21:53 |
|
revolther posted:I think they want everything to stay vertically oriented and readable, in your example all the little rocket bikes would stay facing left to right as they rotate. In Unreal you could just stick em to a thing, rotate the thing, and update their individual globalrotation or localrotation to zero each frame of the transition. ... That's exactly what's happening here. Granted the one that starts at 12 isn't locked, but I also said that in the post.
|
# ? Jan 6, 2018 00:24 |
|
BirdOfPlay posted:List<Vector3> Circle ... Oh, neat! I thought that such a thing was what you were getting at, but I wanted to make sure, just in case there was some super clever math trick I hadn't learned. I did decide, tho, that Circles are Cool, so it wasn't a total waste of time.
|
# ? Jan 6, 2018 06:40 |
|
BirdOfPlay posted:Remember your Linear Algebra and rotations. Even my linear algebra stuff was just matrices out the rear end. Edit: It was the damndest thing because I majored in computer engineer. For all my courses, I survived basically because I could model everything I needed in my equations but would botch solving for X. I got my lower grades in the courses where the professor valued starting wrong and calculating that correctly than starting right and calculating incorrectly. ...yeah. Rocko Bonaparte fucked around with this message at 07:36 on Jan 7, 2018 |
# ? Jan 7, 2018 07:34 |
|
Rocko Bonaparte posted:Nah there was no way I was going to be figuring that one out. I was absolutely behind in high school math when a lot of this was first introduced and I never really recovered on the algebra side. Calculus was interesting though because everybody basically had to start from scratch so I did great... except when things got a little involved in the arithmetic. I wish I could find a good algebra diagnostic to figure out what stuff I honestly never really learned. This is a really good video series that you can watch casually. It focuses only on the ideas and almost never bothers you with the numbers and letters: https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab
|
# ? Jan 7, 2018 09:24 |
|
|
# ? May 11, 2024 07:56 |
|
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.
|
# ? Jan 7, 2018 23:59 |