|
Inverness posted:Yes. I see when you create a component you have RF_Transient set, which might be the cause of this since PIE likely uses the serialization mechanism for copying the world. I removed RF_Transient and no improvement, and during PostLoad event in-game some calls like GetNumChildrenComponents return incorrect values.
|
# ? Feb 22, 2015 09:58 |
|
|
# ? Jun 7, 2024 08:48 |
|
Dozeworthy posted:I removed RF_Transient and no improvement, and during PostLoad event in-game some calls like GetNumChildrenComponents return incorrect values. code:
I did some digging around to see how AddInstanceComponent() is used: code:
Inverness fucked around with this message at 17:05 on Feb 22, 2015 |
# ? Feb 22, 2015 16:59 |
Can anyone explain serialization errors in Unity? In a fashion that isn't totally over my non-programmer head? I'm getting a "serializaton depth limit exceeded" error thrown on play. It's generated by a block of code within an external Unitypackage I'm using in a project, and I'm 99% sure I can't actually access any of the source code in the package, so as far as I can tell, I'm stuck with these serialization errors. Do I need to worry? It doesn't appreciably affect performance, but I don't have any objective way of verifying that right now.
|
|
# ? Feb 22, 2015 20:26 |
MockingQuantum posted:Can anyone explain serialization errors in Unity? In a fashion that isn't totally over my non-programmer head? I'm getting a "serializaton depth limit exceeded" error thrown on play. It's generated by a block of code within an external Unitypackage I'm using in a project, and I'm 99% sure I can't actually access any of the source code in the package, so as far as I can tell, I'm stuck with these serialization errors. Do I need to worry? It doesn't appreciably affect performance, but I don't have any objective way of verifying that right now. Caveat: I'm far from a Unity expert. If you're serializing something, you can imagine taking each of the pieces of it and laying it out flat as a text file. For a simple stricture 'myPoint', that might be just writing down the x and y coordinates. If your structure references OTHER structures, you have to flatten them out, too. myPointSet, if serialized, means writing down the serialized versions of each of the 'myPoints' inside. I'm GUESSING that since the depth limit is exceeded, there's a cycle somewhere. A -> B -> A. So to write A out as a flat file, you need to serialize B. But to write out B you need to serialize A. Repeat ad nauseum.
|
|
# ? Feb 22, 2015 20:59 |
|
Cycles are a trivial problem for any non-retarded serialiser. I sure hope that isn't it.
|
# ? Feb 22, 2015 21:21 |
|
Jo posted:Caveat: I'm far from a Unity expert. For example, it might just legitimately serialize more than 7 layers of objects. More likely is that the asset has private/protected fields that would cause an infinite loop if they were serialized. According to that link, even though private/protected fields aren't serialized unless you explicitly mark them as such, Unity will act as if they are and throw up that error unless you mark them as the opposite with the [NonSerialized] attribute.
|
# ? Feb 22, 2015 21:21 |
|
Jo posted:Caveat: I'm far from a Unity expert. On the one hand, Unity is definitely dumb enough to follow A->B->A and exceed depth that way. On the other hand, Unity has an even stupider problem with its serializer. It fills in every field with dummy objects, which can lead to an exponential amount of dummy objects, so it limits the depth of objects to seven. And yes those errors are probably going to break something.
|
# ? Feb 22, 2015 21:30 |
|
A general Unity FYI:code:
code:
code:
code:
Edit: Fixed spelling etc for clarity. One more: code:
I actually left that one out because it used to have a bug where it'd throw an error if your coroutine had finished running and you tried to StopCoroutine it. The coroutine class gives no information on its state, so you had to remember to set it to null when your coroutine ended if you wanted to know if you should stop it or not later. However, it looks like that was just fixed. I'm on version 4.6.3f1 and it seems to be OK to call StopCoroutine on a Coroutine that's finished running now. Nition fucked around with this message at 02:25 on Feb 23, 2015 |
# ? Feb 23, 2015 00:37 |
|
Nition posted:StartCoroutine(MyCouroutine()); I assume the typo is not important in this example but it makes sense why this wouldn't stop: these are separate invocations of the method, a new IEnumerator would be returned for each. quote:IEnumerator myCoroutine = CoroutineTest(); Is this some crazy C# compiler Unity hack? I haven't tried it but this doesn't look like working code to begin with.
|
# ? Feb 23, 2015 00:54 |
|
Obsurveyor posted:I assume the typo is not important in this example but it makes sense why this wouldn't stop: these are separate invocations of the method, a new IEnumerator would be returned for each. No hacks, just a variable unfortunately named after a function. That's my guess too. Unless there's a persistent reference to that enumerator (the last example), or the implementation of your coroutine has some sort of shared state, you're getting a new one each time you call it. rarbatrol fucked around with this message at 01:09 on Feb 23, 2015 |
# ? Feb 23, 2015 01:07 |
|
I think some of that is expected behavior in C#, but some of it is certainly a horror from an implementation standpoint. I'm not a Unity or C# wizard by any stretch, though, so I'd appreciate if someone could correct anything I might get wrong.Nition posted:StartCoroutine("MyCouroutine"); Stops because Unity is finding your Coroutine via the string, and then maintaining a reference to the instance of your running Coroutine so it can be stopped via the string. It only works because Unity is silently maintaining that reference for you. The annoying thing here is that it's unclear how you would manage concurrent instances of the same coroutine like this, but it's a convenience function so some limitations are to be expected. This probably should have been built as a separate function with a name that would signal this kind of difference in behavior from what happens below. Nition posted:StartCoroutine(MyCouroutine()); Coroutines work by creating an instance of a function as basically its own class. You're starting the Coroutine by passing in the function, but it doesn't work to stop it because the function itself does not have a reference to the currently running coroutine function. This is expected behavior from an OOP standpoint. The horror here is that they didn't build their convenience function above as a wrapper for this function instead of as a different constructor. Nition posted:IEnumerator myEnumerator= MyCoroutine(); This is expected behavior. Again, StopCoroutine is not passing in a reference to an instance of a running coroutine. The reference its passing in is to the function definition itself. Nition posted:IEnumerator myCoroutine = CoroutineTest(); This is a little unintuitive, but also makes sense to me. You create a reference to your coroutine. When you StartCoroutine it replaces this reference to your function definition with a reference to the actual running coroutine. The reference is called the same thing in both lines, but what it's pointing to is changing. There probably should be better signposting on how StartCoroutine is going to behave for different input types, though. Basically Unity is trying to make using Coroutines convenient, but in doing so has obscured some of the underlying mechanics in a way that can lead to misunderstandings. Unity is filled with this kind of stuff. It feels like much of the library is convenience functions they wrote so that their tutorials would be easy to write. It swear like half the articles about programming in Unity I read are like, "the manual/tutorial says do it like <x>, but this is (bullshit/slow/weird/limited/wrong). Here's the way you do it properly..." The Vector3.Lerp official tutorial still has a pretty example. ErIog fucked around with this message at 01:45 on Feb 23, 2015 |
# ? Feb 23, 2015 01:07 |
|
Inverness posted:My first suggestion is to call AddInstanceComponent() after your call to AddOwnedComponent(). The instance components property is actually serialized. AddInstanceComponent doesn't seem to be a member of AActor, and I can't find any reference to it in the documentation. Where did you find that code?
|
# ? Feb 23, 2015 01:11 |
Dylan16807 posted:On the one hand, Unity is definitely dumb enough to follow A->B->A and exceed depth that way. Hmm, okay. Well there's nothing I can do, I guess, except not use the package. I haven't been able to pinpoint what element of it is throwing the error. I put it in as bug report to the developer, now I wait...
|
|
# ? Feb 23, 2015 01:11 |
|
Sorry, I totally messed up my spelling etc in that Unity example. I've fixed it to read how I meant it to read now, and added one more. Coroutine myCoroutineReference = StartCoroutine(MyCoroutine()); StopCoroutine(myCoroutineReference); Stops. Added in unity 4.6. I actually left that one out because it used to have a bug where it'd throw an error if your coroutine had finished running and you tried to StopCoroutine it. The coroutine class gives no information on its state, so you had to remember to set it to null when your coroutine ended if you wanted to know if you should stop it or not later. However, it looks like that was just fixed. I'm on version 4.6.3f1 and it seems to be OK to call StopCoroutine on a Coroutine that's finished running now. Nition fucked around with this message at 02:24 on Feb 23, 2015 |
# ? Feb 23, 2015 01:32 |
|
Dozeworthy posted:AddInstanceComponent doesn't seem to be a member of AActor, and I can't find any reference to it in the documentation. Where did you find that code? In earlier versions you need to add the component to the SerializedComponents array in AActor which is public. There is also a helper method: code:
|
# ? Feb 23, 2015 02:21 |
|
That worked! Thanks.
|
# ? Feb 23, 2015 02:33 |
|
Old post but I thought I'd write back here.Flownerous posted:I'm not familiar with Unity's system so this is not going to be that useful but there should be a way to extract motion from a bone in the animation? Then the animation would be centered around that bone and you get a vector which can be used to move the game object. I think I found this. In the inspector view with the imported model, I went to the "Rig" section, and there was a field for a root node. Under that, it had awareness of my armature and the root bone. The tip of the root bone was at the center of mass, so I am seeing how well that worked. I have other Unity-specific questions now if somebody familiar with it can answer. Can I group animation states together? I have various idle animations I'd like to fluctuate between. However, when I start into another animation, I don't want to have to draw states out from all of the idle animations into these new states. The idles all start and end at the same position. Is there a way to see just a model's specific animations when assigning them to the states? In the asset view, I'm getting a raw dump of all possible animations. I have another model imported, and it's obnoxious to wade throw the different model's animations in the general list that I presents to me. If it matters, I import these models from Blender, and it's taking in the animations as actions from Blender. I am wondering if I should be representing my data differently.
|
# ? Feb 23, 2015 08:38 |
Rocko Bonaparte posted:Old post but I thought I'd write back here. You can probably make an animation state with a blend-tree as a sub-node. See this: https://www.youtube.com/watch?v=HeHvlEYpRbM The different is, instead of blending based on 'direction' or something, you can probably generate a random number each time so it will blend randomly between your idles.
|
|
# ? Feb 23, 2015 18:39 |
|
SnowblindFatal posted:Plz patch in more features. We gonna lan this mofo in like a month or two. It'd need a small tweak to generate its own client IDs, as those come from PHP on page load and embedded to the page to be passed back through the websocket to authenticate, meanwhile half the client ID becomes your object ID. I feel like a lot of people see the login screen and balk at giving a password, even though my db is more secure than most forums'. Maybe I'll just make it optional. And yes, Thunderstruck, I do keep the console open and watch for people connecting to play with :3
|
# ? Feb 23, 2015 22:29 |
|
Ranzear posted:It's possible I could put some code out if you know how to get Node.js going. I keep as much of it shared between client and server as possible using a symlink to the libs directory. It gets a little funny when I change something in the player class and don't restart the server and they start arguing what the state is, but the server has authority outside of the input and position properties (and quite a bit of enforcement on the latter). Your game is fun even though I'm bad at it . I'm apparently permanently dead now, though.
|
# ? Feb 23, 2015 23:34 |
|
Ranzear posted:It's possible I could put some code out if you know how to get Node.js going. I keep as much of it shared between client and server as possible using a symlink to the libs directory. It gets a little funny when I change something in the player class and don't restart the server and they start arguing what the state is, but the server has authority outside of the input and position properties (and quite a bit of enforcement on the latter). Just unload whatever. Maybe I'll get lucky and get it running without problems.
|
# ? Feb 23, 2015 23:55 |
|
Ranzear posted:I started a 'quick' prototype for my major project that in four cracked-out days turned into almost a standalone game in itself. That was great fun Ranzear!
|
# ? Feb 24, 2015 00:00 |
|
ZombieApostate posted:Your game is fun even though I'm bad at it . I'm apparently permanently dead now, though. I've set it up to be more fun with a ton of people, sniping each other from the fog and whatnot, but even mano a mano is pretty interesting. Still haven't seen more than five players at once, and that was classmates. Still not sure what to do about >150ms ping. If you have too much forward-simulation (lag correction) the firing cycle gets really glitchy, but I've used NEWT to play pretty well up to that. Like I mentioned, this thing kinda turned into its own beast now, but it's been really helpful for finding major issues (Safari hates mp3) and working out minor technical things viz. not applying latency to the forward-sim of your own (local) ship. BillyJoe here? You were really jittery. Platform? Browser? Ranzear fucked around with this message at 00:07 on Feb 24, 2015 |
# ? Feb 24, 2015 00:01 |
|
I noticed that the laser jumps back slightly to a previous position when it actually fires if you're spinning while charging. It also sometimes it looked like you clipped through the laser without it playing the hit sound/taking damage. But I was right around that 150ms ping you're talking about. It just made it a little harder to judge where I should be aiming. Do you have anything like lag compensation? If I understand you correctly, your forward-sim is input prediction from that article?
|
# ? Feb 24, 2015 01:26 |
|
Yeah, forward-sim is the simulation since the last frame, and for non-local objects it also adds half your ping as latency compensation. Aside: This is in comparison to 'reverse-sim' on the server where the game state is rolled back to the client's and pretty much retconned with their inputs. I've avoided this for being too To solve some of the major sync issues above 150ms ping I tried capping that addition of half of your ping at 80ms, so once you're over 160ms you start seeing the usual latency effects. It's a tradeoff against inconsistent firing cycles. I could stand to raise this to 100ms. The lazer jumping back is your aim direction getting locked at 3/4 charge which is more for consistency, but that might be removable now that lag compensation is far better then it was. Do note that the final firing direction is very consistent across clients though. I'll try getting rid of the aimlock and see if it stays consistent. So that >150ms consistency might not be coincidental in being 1/4 the firing charge time, but it's more likely related to the 144ms major tick rate (minor tick rate is 24ms). Tick rate shouldn't really affect positional authority though. So the aimlock could be reduced down to the minor tick rate of 24ms if final firing direction isn't consistent without it. Ranzear fucked around with this message at 01:58 on Feb 24, 2015 |
# ? Feb 24, 2015 01:53 |
|
Ranzear posted:Yeah, forward-sim is the simulation since the last frame, and for non-local objects it also adds half your ping as latency compensation. I thought the aiming locking at some point was a feature and a very good one! Gave your opponent the chance to dodge it like a platformer boss's attack!
|
# ? Feb 24, 2015 02:21 |
|
What I should do is get the hell on with it and give rotation rate towards the aim direction which slows as you charge and is also coupled to the energy bar. This would give more purpose to forward movement having more thrust and whatnot. To go with that, I'd grab the thrust direction instead of aim direction for applying dash.
|
# ? Feb 24, 2015 02:31 |
|
I think the rotation isn't wrapping around properly. i.e. if the mouse position is just below straight left, and you move it just above straight left, then the ship will do a very long counter-clockwise rotation instead of a short clockwise rotation.
|
# ? Feb 24, 2015 02:51 |
|
OneEightHundred posted:I think the rotation isn't wrapping around properly. i.e. if the mouse position is just below straight left, and you move it just above straight left, then the ship will do a very long counter-clockwise rotation instead of a short clockwise rotation. Yeah, I was still working on it when you dropped in. That sign flip is a bitch and it took me too long to remember how to do it right. All good now, though needs some tuning. Fun times: I like to put <!doctype html> at the top of my php files so I can preview them with a drag into chrome, but this causes the window innerWidth and innerHeight to be wildly misreported and cause scrollbars to appear. So stupid and weird. Ranzear fucked around with this message at 05:07 on Feb 24, 2015 |
# ? Feb 24, 2015 04:45 |
|
Is there a difference between scripting a mesh in Unity versus importing one? I'm trying to create a quadsphere, and I'm not sure how to do it from scratch with C#. Are there any downsides to creating a polysphere in Blender and then importing that?
|
# ? Feb 24, 2015 18:25 |
|
I'm working on a project in Unity and I want to store/retrieve data from an XML file. I was wondering if anyone could point me at a relevant tutorial for using XML as a database solution within Unity, Google is throwing up a lot of garbage answers.
|
# ? Feb 24, 2015 21:53 |
|
ModeSix posted:I'm working on a project in Unity and I want to store/retrieve data from an XML file. Just look up "C# XML serialization". There's nothing special about Unity and XML unless you're looking to serialize Unity objects to XML and even then, it's probably easier to start with regular C# object serialization and then figure out the Unity gotchas, if any. My personal opinion: You should use JSON(see Json.NET) instead of XML.
|
# ? Feb 24, 2015 21:59 |
|
Unless you need the extra features of Json.Net the community made MiniJSON outperforms it in every imaginable way. Surprising for a 1 file json (de)serializer that exists in a github gist instead of a proper repo. Json.Net is slow and eats a ton of memory, just fyi.
|
# ? Feb 24, 2015 22:17 |
|
UE4 4.7 is out, and dang does it have some cool stuff: https://www.unrealengine.com/blog/unreal-engine-47-released Blueprint merging! BabelFish fucked around with this message at 22:32 on Feb 24, 2015 |
# ? Feb 24, 2015 22:27 |
|
xgalaxy posted:Unless you need the extra features of Json.Net the community made MiniJSON outperforms it in every imaginable way. Surprising for a 1 file json (de)serializer that exists in a github gist instead of a proper repo. Json.Net is slow and eats a ton of memory, just fyi. Definitely JSON for anything you don't have to use human eyes on. Can be a lot smaller too. BeamDuel was made just to have a handle on how much JSON I could cram through a websocket. Answer: A lot.
|
# ? Feb 25, 2015 02:06 |
|
xgalaxy posted:Unless you need the extra features of Json.Net the community made MiniJSON outperforms it in every imaginable way. Surprising for a 1 file json (de)serializer that exists in a github gist instead of a proper repo. Json.Net is slow and eats a ton of memory, just fyi. Thanks for this, very good to know. I've only ever used Json.NET for playing around so performance wasn't a huge deal. I see the huge memory usage in the profiler now though.
|
# ? Feb 25, 2015 03:00 |
|
Ranzear posted:Definitely JSON for anything you don't have to use human eyes on. How so? I would say JSON (and XML) are for when you DO need human eyes on it. If not, and you want maximum performance (and profiling shows serialization as your bottleneck), use a binary format like Protobuf, Cap'n Proto, or SBE.
|
# ? Feb 25, 2015 05:11 |
|
XML is for when someone forced you at gunpoint to use XML. Don't protobufs and cap'n proto have optional human-readable encodings?
|
# ? Feb 25, 2015 05:13 |
|
Subjunctive posted:XML is for when someone forced you at gunpoint to use XML.
|
# ? Feb 25, 2015 05:15 |
|
|
# ? Jun 7, 2024 08:48 |
|
Subjunctive posted:XML is for when someone forced you at gunpoint to use XML. XML is sometimes also useful for when you need schema validation or structured queries and transforms. This doesn't happen that much in game dev. XML is also way more readable to designers than JSON is. JSON is readable to developers, but not to designers, because lots of designers have worked with HTML at least a little, but JSON is more out there. I use SimpleJSON a lot, because I can just paste that one file into a project where I need some json parsing, and I'm off to the races with minimum fuss. http://wiki.unity3d.com/index.php/SimpleJSON
|
# ? Feb 25, 2015 05:19 |