|
Suspicious Dish posted:Isn't this like the fifth ui rewrite they've done UI toolkits are hilariously hard to develop, they're in a constant state of being completely rewritten. The "ugh this code all sucks let's start over from scratch" reaction is obviously a thing that happens to all code but with UI stuff it's another level of hell.
|
# ? Dec 11, 2019 19:21 |
|
|
# ? May 25, 2024 06:53 |
|
Suspicious Dish posted:Isn't this like the fifth ui rewrite they've done Writing "one UI to rule them all" is pretty tricky
|
# ? Dec 11, 2019 19:32 |
|
TooMuchAbstraction posted:OK, use TextMeshPro for your text. You can write scripts to adjust character transparency on the fly or do things like make it bounce, change color, etc. Thanks for the overview, I'm probably making this harder on myself by wanting to create everything in code. God, I wish UIElements was in a useable state. The project I'm working on is converting a webapp to Unity, so it would be way easier.
|
# ? Dec 11, 2019 19:55 |
|
Tip posted:Thanks for the overview, I'm probably making this harder on myself by wanting to create everything in code. If nothing else, you're increasing your iteration time by having to run the game each time you want to look at your UI. Being able to visualize things in the editor is pretty nice. But it is possible to create UI entirely from code. Make an empty GameObject, add a layout controller to it like VerticalLayoutGroup or GridLayoutGroup, add items as children to the panel's gameobject, set those items' pivots/sizes/anchors (some of these will be set automatically by the layout controller, depending on its settings).
|
# ? Dec 11, 2019 20:04 |
|
TooMuchAbstraction posted:If nothing else, you're increasing your iteration time by having to run the game each time you want to look at your UI. Being able to visualize things in the editor is pretty nice. Well, what I'm working on right now isn't really general UI, but it is flat text so I'm using the UI system. The main component of my game involves randomly generated text scrolling over 3d backgrounds.
|
# ? Dec 11, 2019 20:08 |
|
KillHour posted:Now it's all CSS and generic web-based stuff. Zaphod42 posted:Writing "one UI to rule them all" is pretty tricky
|
# ? Dec 13, 2019 09:27 |
|
OneEightHundred posted:Ughhh. If there's one thing everybody should have learned from Scaleform, it's "don't I know that I only ever really post here anymore to say this, but game UI dev sucks because game UI systems are universally terrible for actually making UIs in. If this new Unity UI is web standards (I haven't read about it yet) then it could be really good, but I'm sure Unity will find a way to gently caress it up. Scaleform was great. Chromium would be god-tier.
|
# ? Dec 13, 2019 15:01 |
|
dupersaurus posted:I know that I only ever really post here anymore to say this, but game UI dev sucks because game UI systems are universally terrible for actually making UIs in. If this new Unity UI is web standards (I haven't read about it yet) then it could be really good, but I'm sure Unity will find a way to gently caress it up. UI dev sucks everywhere. I developed with xlib a long time ago and it was just as bad. Everything that's replaced xlib has been agony too. As soon as you get beyond the hello world button demo, it all becomes a mudpit. Chromium or anything that implemented a DOM would definitely be a massive upgrade. html+css can be painful but it's the least bad layout system I've ever encountered.
|
# ? Dec 13, 2019 15:36 |
|
I've shilled for it before, but we've had a good experience with Dear ImGui, which is a lot like Unity's IMGUI.
|
# ? Dec 13, 2019 16:15 |
|
dupersaurus posted:I know that I only ever really post here anymore to say this, but game UI dev sucks because game UI systems are universally terrible for actually making UIs in. If this new Unity UI is web standards (I haven't read about it yet) then it could be really good, but I'm sure Unity will find a way to gently caress it up. Last 2 games I worked on had a lot of AR-style 3D UI and it was made much less painful by the UI system understanding what "3D" is. Godot's approach is also nice because the barrier between the game world and UI doesn't really exist, so there's much less fudging with a "UI system" that exists in an entirely separate universe.
|
# ? Dec 13, 2019 19:25 |
|
OneEightHundred posted:I think it's a bad idea because it's largely defining the limits of its feature set in terms of what a web page can do, and like with Flash, W3C is not going to expand the feature set of the web to accommodate things that a game needs. Sure, sometimes you need more than a render target stuck in 3D space somewhere. There are things that require engine assistance, or even an intermediary engine-level UI component. But when you eventually get down to "and now I need to draw some 2D stuff", what more do you really need? And that's not talking about menu-level interfaces, which the web model is made for.
|
# ? Dec 13, 2019 20:10 |
|
dupersaurus posted:Sure, sometimes you need more than a render target stuck in 3D space somewhere. There are things that require engine assistance, or even an intermediary engine-level UI component. But when you eventually get down to "and now I need to draw some 2D stuff", what more do you really need? For example, I never have to worry about making a high-contrast HUD for a desktop application and I'd be an rear end in a top hat if I did. If I were making a space game, there's multiple panels of that stuff all over the cockpit and it looks like it belongs there.
|
# ? Dec 13, 2019 20:39 |
|
the shop inventory dialog in diablo 2 is probably more complicated than the gmail ui tbh and somehow gmail runs at 2fps
|
# ? Dec 13, 2019 21:02 |
|
Fun fact: in C# the dynamic keyword is supported by Windows and Android, but not iOS. Time to rewrite a ton of code!
|
# ? Dec 13, 2019 23:06 |
|
Tip posted:Fun fact: in C# the dynamic keyword is supported by Windows and Android, but not iOS. Time to rewrite a ton of code! I'm assuming if I use a library that has that in it that I'd also get screwed if I target iOS...
|
# ? Dec 14, 2019 01:14 |
|
dupersaurus posted:Sure, sometimes you need more than a render target stuck in 3D space somewhere. There are things that require engine assistance, or even an intermediary engine-level UI component. But when you eventually get down to "and now I need to draw some 2D stuff", what more do you really need? quote:which the web model is made for. I'd say the "web model" is much more made for page layout than UI, especially the kind of UI you'd want in a game. Suspicious Dish posted:the shop inventory dialog in diablo 2 is probably more complicated than the gmail ui tbh and somehow gmail runs at 2fps OneEightHundred fucked around with this message at 21:05 on Dec 14, 2019 |
# ? Dec 14, 2019 20:53 |
|
Rocko Bonaparte posted:I'm assuming if I use a library that has that in it that I'd also get screwed if I target iOS... Yeah, which might include anything that targets C# 4.0 or higher, and 4.0 was released in 2010.
|
# ? Dec 15, 2019 00:57 |
|
Tip posted:Yeah, which might include anything that targets C# 4.0 or higher, and 4.0 was released in 2010. What about async/await? Is that kosher? I am not really thinking about iOS but I am wondering about assumptions I have made for this async-await-aware .NET Python interpreter I have been toying with for embedding scripting into my game project. And yes, I know that's hosed up. I had other reasons to try it...
|
# ? Dec 15, 2019 19:29 |
|
Rocko Bonaparte posted:What about async/await? Is that kosher? Async/await was added in C# 5, so later than the dynamic keyword, but it appears to be supported on iOS according to this article: https://docs.microsoft.com/en-us/xamarin/cross-platform/platform/async I'd suggest maybe throwing together a quick test and running it on iOS before putting too much time into it. I'm using Unity and just sticking to 2.0 because Unity promises all features will work on all their supported platforms. quote:Cross-platform compatibility Rocko Bonaparte posted:I am not really thinking about iOS but I am wondering about assumptions I have made for this async-await-aware .NET Python interpreter I have been toying with for embedding scripting into my game project. And yes, I know that's hosed up. I had other reasons to try it... Running a python interpreter in your game sounds like the kind of thing that might run afoul of Apple's policies. I think it's fine if you're only running included scripts, but if you're allowing code entry or externally loading scripts in anyway you'll probably have problems. Life would be so much easier if I didn't have to worry about Apple.
|
# ? Dec 15, 2019 20:21 |
|
Tip posted:I'd suggest maybe throwing together a quick test and running it on iOS before putting too much time into it. I had previously been just using IEnumerable coroutines in the code but it get really, really hideous. Every time I entered a code block that could possibly be implemented with something asynchronous, I had to wrap it in a foreach to run it out to get the result. This would create a cascade of foreach's up and up and up. I prototyped async-await instead and found a lot of code collapsed down into one-liners that had all that crap before. I think it's still a mess if I'm recursing on an async method, but I imagine that's also a problem in native C#. quote:Running a python interpreter in your game sounds like the kind of thing that might run afoul of Apple's policies. I think it's fine if you're only running included scripts, but if you're allowing code entry or externally loading scripts in anyway you'll probably have problems. I kind of assume this is a problem elsewhere. If I'm using that for my game scripting and not necessarily pushing some modding API, is that okay? If I don't have the standard library implemented at all for general programming, is that fine? I can imagine it being a shitshow if I'm exposing file I/O calls to the entire filesystem or something.
|
# ? Dec 16, 2019 04:39 |
|
Rocko Bonaparte posted:I don't actually have an iOS-related device on which to test. It's just the normal thing: I ingest oxygen and food, then convert it into overengineering and analysis paralysis. So I worry about some non-existent opportunity cost from turning my back on a possible target platform for a project that I'll never finish. But it's still very important, of course. You don’t need to foreach coroutines in unity...?
|
# ? Dec 16, 2019 12:17 |
|
leper khan posted:You don’t need to foreach coroutines in unity...? Is there an alternative that works with .NET 2.0 outside of Unity? That was the original environment before I bumped it up to get async-await.
|
# ? Dec 16, 2019 15:31 |
|
Rocko Bonaparte posted:What about async/await? Is that kosher? Async-await works on android and iOS just fine, since the release of the updated .NET for Unity the teams at the company I work at have been moving over to async-await as quickly as possible for all asynchronous methods. Generally speaking it really improves the flow of the code for asynchronous calls such as those involving HTTP requests or any of the new Addressables API. You just need to be aware of the gotchas, such as remembering to pass in cancellation tokens and setting up try-catch on all async void methods (or lose your exceptions). Unless you're porting to something obscure I'd recommend getting into using async-await and the other nice features of newer .NET.
|
# ? Dec 16, 2019 16:47 |
Rocko Bonaparte posted:Every time I entered a code block that could possibly be implemented with something asynchronous, I had to wrap it in a foreach to run it out to get the result. Rocko Bonaparte posted:Is there an alternative that works with .NET 2.0 outside of Unity? That was the original environment before I bumped it up to get async-await. Could you give a brief example of this? I'm not sure what you mean here, but it doesn't sound offhand like something that should be necessary.
|
|
# ? Dec 16, 2019 17:08 |
|
I think a foreach block implicitly wraps a try/catch? That or they wanted to handle the return value manually instead of letting unity handle it for some reason.
|
# ? Dec 16, 2019 17:14 |
|
Ruzihm posted:Could you give a brief example of this? I'm not sure what you mean here, but it doesn't sound offhand like something that should be necessary. Edit: If you're just talking about the foreach syntax in play, then every time I was invoking a function call that could possibly be pre-empted, and I wanted the result, then I'd have to foreach the call to tick it out before I get the final result. Edit edit: The more trivial blocks would look like this (from my history): code:
code:
I tried to get some ideas about how to approach this from the .NET thread, but I never got much traction. Something like six months ago, there were some job postings inside my company to do some deep internal stuff in Python. Meanwhile, I wanted to do some kind of scripting for my game project, and would have preferred Python. I didn't want the calls in the scripts to block. IronPython was not set up for that and a test IronPython 3.x async branch I got much longer ago didn't help either. So I figured I'd mess around with the Python ANTLR4 grammar and make my own little thing to hopefully help me towards either a job change or an OCD hobby thing (or both). My goal was to have something like tasklets a la Stackless Python, so I didn't want to defer to Unity's task switching for scheduling if I could help it. Also, I was developing independent of Unity even if it was my hobby target, so I didn't have StartCoroutine and things like that anyways. This is definitely overkill and for whatever little me could manage would have just been fine if I was writing this all in C# and skipping out on a scripting language. I started with using IEnumerables and a lot of yielding. Every time I hit a spot where I could call into something that may-or-may-not wait, I'd have to make that foreach sandwich. For what it's worth, I can do most of the basic grammar and do basic interactions with blocking calls. The bonus is that I think I can embed the REPL as a console, serialize my script state when saving, and reconnect to in-flight operations when reloading. I also know a lot more obscure Python internals trivia. On the down side, that internal hiring manager doesn't seem to care about personal projects and is looking for some Python internals PhD unicorn. All in all, it's probably only good for hitting that "working on language stuff" item on the programmer bucket list. Well, that and having a certain sense on when I should use a parser instead of piles of regular expressions whenever something like that comes up professionally. Rocko Bonaparte fucked around with this message at 00:09 on Dec 17, 2019 |
# ? Dec 16, 2019 17:55 |
|
Rocko Bonaparte posted:
off the top of my head, you can probably yield return the result of the function: code:
|
# ? Dec 17, 2019 07:31 |
|
LordSaturn posted:off the top of my head, you can probably yield return the result of the function: Right now I think with this async-await implementation I switched to that it'll to keep it going in the same frame a little longer, but I haven't seen what happens inside Unity proper. It just looks so far like I'm able to manage all the scripts from a master scheduler, all running on the same thread. How well would an IEnumerable approach have worked if intermediate code wanted an actual return result? There's a few situations where the script is not what is actually try to extract a result, but intermediate code using the calling API into objects to get something it needs. Granted, I am thinking I want to nuke most of that and make it illegal for my sake... Edit: I'm not really looking for a means to revert to use IEnumerables if async-await is generally working, so nobody has to worry about it unless they really want to pick on details. I'm fine talking about that, but the details behind the switch are now getting hazy. I also feel like I kill these threads when I talk about these shenanigans. I'm probably better off doing my mad science in a project.log, but that's probably about as good as having myself on everybody's ignore list. Rocko Bonaparte fucked around with this message at 08:06 on Dec 18, 2019 |
# ? Dec 17, 2019 22:17 |
|
I need a bit of maths advice. I have a collection of points on a sphere, and I would like to build a bounding circle on that sphere that encompasses all the points. This is effectively building a minimum bounding circle, but on the surface of a sphere. Can anyone point me at the maths I need to go read up on? I feel like I could do something clever with quaternions, but I can't be the first person to solve this, and I would much prefer to use someone else's solution. e.g How do I calculate the centre and radius of the circle below, which encompasses the red points.
|
# ? Dec 19, 2019 09:07 |
|
It seems like Welzl's algorithm (which computes the bounding circle on a Euclidian plane) is trivially portable to your spherical scenario? I guess the big complication with a sphere is that any circle on the surface could be drawn in two ways, but you can resolve that easily if you can constrain your points such that the true bounding circle is always less than half the sphere. Jabor fucked around with this message at 09:23 on Dec 19, 2019 |
# ? Dec 19, 2019 09:21 |
|
It occurs to me that on a sphere, finding the bounding circle is equivalent to finding the largest circle that doesn't contain any of the points, so you might be able to do better by constructing the voronoi diagram on the sphere and checking which vertex allows you to place the largest circle. Which would also work for the case where the bounding circle is larger than a single hemisphere.
|
# ? Dec 19, 2019 09:48 |
|
If you're working with a 2d projection its simply a matter of finding the mid-point of all the points, and then calculating the largest distance from that to any red point and then setting the radius to that or slightly greater than that. But if you have to do it in 3d on the sphere it becomes more complicated, although related to the above. Things to consider, does it have to be perfect, or just guarantee that it contains all points? Also, are the points always fairly clustered? If a point is on the other side of the sphere then the circle ends up wrapping around the sphere and poo poo gets weird.
|
# ? Dec 19, 2019 10:05 |
|
Zaphod42 posted:If you're working with a 2d projection its simply a matter of finding the mid-point of all the points, and then calculating the largest distance from that to any red point and then setting the radius to that or slightly greater than that. This only provides reasonable results if the points are uniformly distributed. As a counter-example: imagine you have the points roughly on the corners of a triangle. Two corners are clusters of 100 points each, and one corner is a single outlier point. The midpoint of the set is on the edge between the two clusters, but you'd want the center of the triangle for your bounding circle. It seems to me a little dangerous to think of this as finding the minimum bounding circle, since any arbitrarily small circle on the sphere will bound all the points on one side of it. You should still be able to adapt the 2D smallest-circle algorithms if you want, but you'll probably need to be a little careful. Another way to think of the problem is that you're looking for a cutting plane that divides your sphere into two parts: one with points and one without. You want to cut so that part with the points is as small as possible. That cut will be touching at least two of the points, possibly three. If the number of points is small (say, at most 10) you can just run the naive solution of checking all the cuts defined by point pairs and triples without it being a problem. Doing so is O(n^4) so it gets intractable pretty quick, though. To prune the number of cuts to consider one approach I can think of is to consider the convex hull of the points. The optimal cut will be the plane of a triangle of the hull or the plane of a great circle that touches an edge on the hull. I think it will specifically be the cut that's on the edge/triangle on the hull that's closest to the center of the sphere, but I'm not 100% on that. Not sure that approach is necessarily easier though.
|
# ? Dec 19, 2019 13:58 |
|
I'm not sure this is even possible without some limitations. If you imagine the red points are on every "pole" (i.e. two for each axis, where that basis vector leaves the sphere) you've given yourself an impossible situation because you can't bound all points. If you assume they all lie on one hemisphere I'm not sure I have an algorithm, but I'm pretty sure you're essentially finding the vector such that, in spherical coordinates, the two farthest points have equal distance, and this distance is minimized. That vector is then the normal to your cutting plane, and the circle is where it intersects those extreme points on the sphere. I'm very tired so the following may be crockery, but I think if you're guaranteed to be on a hemisphere, you can find the two farthest points from each other in quaternion/rotational distance, and then choose the normal to the line between them that also points outward from the center of the sphere. The rub then is finding the largest distance which can be done in O(n^2) but probably has some better way I'm blanking on, I don't think most nearest neighbor family algorithms are well equipped to handle farthest distance out of the box, but most can be modified to handle it (I think there's a paper on doing it with R-trees). For a Small Enough™ collection of points, it's probably faster to brute force than build the tree and do farthest neighbor queries anyway. Linear Zoetrope fucked around with this message at 14:55 on Dec 19, 2019 |
# ? Dec 19, 2019 14:44 |
|
E:nvm
|
# ? Dec 19, 2019 14:54 |
|
Linear Zoetrope posted:I'm not sure this is even possible without some limitations. If you imagine the red points are on every "pole" (i.e. two for each axis, where that basis vector leaves the sphere) you've given yourself an impossible situation because you can't bound all points. It's possible even in this scenario, any circle that has all of the poles on the outside will be a "bound" of sorts. You can't really talk about the smallest one, since you can make the circle arbitrarily small and it'll still be a valid cut. For the not-on-a-hemisphere case you're looking to construct the largest circle you can with the same properties. Thinking on it a little more I think you can view the problem as finding the point on the convex hull of points that's closest to the center of the sphere. If the closest point is on an edge then the best cut is a great circle connecting the two points connected by that edge. If the closest point is on a polygon then the best cut is the plane of the polygon. I suspect that you can go from computing the entire hull to instead randomly sample point triples and accept them they provide a new closest point to the center until you've found the optimum, which is an adapted Welzl's algorithm.
|
# ? Dec 19, 2019 15:16 |
|
Unity question: I am making a page to view pieces of lore.Right now this system (not locked into this), is an array of bools with true if that piece has been unlocked. fine. each piece of lore has a text file and clicking a button to display it in a text box is fine and easy, but is there a way that I can get an array of strings (each entry name) as a list of buttons on a scrollable side panel type thing in a script? I'd then need to pass the name on the button to the loader script. I haven't really worked with UI/Canvas before. Thank you.
|
# ? Dec 22, 2019 02:16 |
|
Make a prefab with an attached script that knows where the text, button, etc are. Hand the prefab to another script, and have it instantiate the prefab once per bit of lore.
|
# ? Dec 22, 2019 02:32 |
|
Anyone in the Blender to Unity3D/Unreal workflow pipeline have any suggestions for lipsync'ing a character model? I'm using Rigify (I paid for Autorig pro but it had too many issues) and it seems like animating any kind of dialogue by hand will get tedious fast. I could just not bother and save a lot of time but I am at least curious about the process.
|
# ? Dec 22, 2019 03:23 |
|
|
# ? May 25, 2024 06:53 |
|
There's an addon called Rhubarb that does automated morph lipsyncing.
|
# ? Dec 22, 2019 09:18 |