|
FateFree posted:No I already use perlin noise to generate the map, so now I have an island with sand and grass and transition tiles in between. I want to layer a large, grass texture block over all the green grass pixels to make them look nicer. And similary layer a large sand texture pattern over all the yellow pixels. I'm a little bit confused still, how about a screenshot of the pixels or whatever? I'm not getting why they have to pixels -> texture pattern overtop or whatever but it seems like an easy problem to solve, it just depends on how your stuff is actually structured.
|
# ? Sep 19, 2013 05:46 |
|
|
# ? Jun 1, 2024 04:46 |
|
xgalaxy posted:So I guess Unity 4 still doesn't quite work correctly with namespaces. Unormal posted:I haven't had any issues with namespaces; that said Unity has an infinite number of bizarre bugs, so I wouldn't rule it out. Perhaps you've got a naming conflict somewhere?
|
# ? Sep 19, 2013 08:48 |
|
Strumpy posted:I just had a look in the bug database and we don't have anything about namespaces not working properly (afaik they should 'just work') if you raise a bug with simple repro project and give the the bug number I'll send it off to one of the scripting team, you might be hitting some weird corner case. I thought namespaces didn't play nice with Monobehaviors? EDIT: Oop, right, that was supposed to be fixed with 4. Apparently there are still some caveats, though: http://answers.unity3d.com/questions/361976/are-namespaces-supported-in-unity-4.html It appears there are still issues with multiple classes in a single file being in namespaces, and some other stuff. Zizi fucked around with this message at 19:08 on Sep 19, 2013 |
# ? Sep 19, 2013 19:05 |
|
I'm working on a space game with a Sims-like ship designer in Unity (c#), and I'm debating how best to store the ship data. It's pretty much a straight 3D grid of cubes, basically voxels. My experience is mostly with roguelikes and I'd have used a two-dimensional array to store the board data in the past, but I'm wondering if there's a better way to do it, particularly in 3D? Would a hashtable with a Vector3 as the key make sense? I'm leaning towards that since Unity is all Vector3's all over the place anyways, and a hashtable seems preferable to full arrays since a spaceship will have a lot of empty space around it. edit: Screwed around a bit, and came up with this code:
SlightlyMadman fucked around with this message at 23:30 on Sep 19, 2013 |
# ? Sep 19, 2013 23:09 |
|
SlightlyMadman posted:I'm working on a space game with a Sims-like ship designer in Unity (c#), and I'm debating how best to store the ship data. It's pretty much a straight 3D grid of cubes, basically voxels. My experience is mostly with roguelikes and I'd have used a two-dimensional array to store the board data in the past, but I'm wondering if there's a better way to do it, particularly in 3D? You can certainly do it that way-- I don't know offhand if there's a downside to it. I have a system much like this in one of my projects, and personally, I just went with a 3D jagged array, since I expect the whole thing to be filled most of the time anyway, and you can still access everything with a Vector3 if you want.
|
# ? Sep 20, 2013 01:15 |
|
Zizi posted:You can certainly do it that way-- I don't know offhand if there's a downside to it. I have a system much like this in one of my projects, and personally, I just went with a 3D jagged array, since I expect the whole thing to be filled most of the time anyway, and you can still access everything with a Vector3 if you want. Yeah, that's certainly a more straightforward way about it and I've always used it for dungeon environments. The structure really only needs to be a cube containing the ship, not the whole environment of course, but even then, draw a box around a space ship and it's mostly empty space around it. The only downfall I've thought of so far, is that if I want to scan a "slice" I'd have to either make a bunch of ContainsKey calls with newly created Vector3 objects, or look through every element and check it's key.
|
# ? Sep 20, 2013 01:46 |
|
SlightlyMadman posted:Yeah, that's certainly a more straightforward way about it and I've always used it for dungeon environments. The structure really only needs to be a cube containing the ship, not the whole environment of course, but even then, draw a box around a space ship and it's mostly empty space around it. That's definitely a downside compared to jagged array, since C# means you don't have to store Array lengths and can just run a foreach on the chunks you want by accessing them directly. On the other hand, I'm dealing with ship internals, not the structure of the ship itself. In my case, each ship design has a set number of internal decks, corridors, and slots that you install lifesupport, storage, sensors, engines, etc into. On the other hand, with your Dictionary, you could always scan slices using LINQ to Objects, which would look something like code:
|
# ? Sep 20, 2013 06:54 |
|
LINQ is very useful for writing compact code, but no, it definitely doesn't have any performance benefits. If anything, it actually incurs a slight penalty. SlightlyMadman, if access of slices is a common operation (i.e. more common than mutation of the ship itself), you could consider maintaining a parallel data structure which is organized by slice. There's a memory cost, of course, but I doubt it's substantial.
|
# ? Sep 20, 2013 14:46 |
|
Orzo posted:LINQ is very useful for writing compact code, but no, it definitely doesn't have any performance benefits. If anything, it actually incurs a slight penalty. I personally think it looks like rear end too, and I've seen extremely high-traffic websites brought to their knees by the overhead of seemingly simple linq queries. It can perform as well as native code in many cases, but it's sometimes weirdly suboptimal in seemingly normal circumstances. Orzo posted:SlightlyMadman, if access of slices is a common operation (i.e. more common than mutation of the ship itself), you could consider maintaining a parallel data structure which is organized by slice. There's a memory cost, of course, but I doubt it's substantial. I was actually just debating an array of Vector2 dictionaries, where the array would be the deck number (z-index) and the Vector2 would be the x-y coordinate. It might look a little awkward, but the game will mostly be dealing with one deck at a time (and that would be the only slice normally taken), and accessing "Cubes[z][new Vector2(x, y)]" isn't much worse than "Cubes[new Vector3(x, y, z)]". It still solves the problem of eliminating wasted empty space just as effectively, since there won't be entire empty decks. There's probably some memory overhead of storing multiple dictionaries, but that shouldn't be a big deal since there won't generally be more than a few decks. I can't really think of any other drawbacks, except that it just feels a bit odd.
|
# ? Sep 20, 2013 15:10 |
|
We game jammed again! August's theme was "an Oasis song" so we picked Fuckin' in the Bushes. Give it a shot! http://ghostcrabgames.com/jams/bang-buster/
|
# ? Sep 20, 2013 15:11 |
|
SlightlyMadman posted:I personally think it looks like rear end too, and I've seen extremely high-traffic websites brought to their knees by the overhead of seemingly simple linq queries. It can perform as well as native code in many cases, but it's sometimes weirdly suboptimal in seemingly normal circumstances. Second, there's actually nothing mysterious about them. At my job, before they even existed, our group had actually implemented most of them in an algorithms helper class which became mostly obsolete when Microsoft released their extension methods. If you have reflector or resharper, the code isn't at all obfuscated, you can just click and see how they're just wrapping basic loops in nice methods. '.Select' is just shorthand for iterating through a list given a Func<T, X> and extracting values out of a list, for example.
|
# ? Sep 20, 2013 15:55 |
|
I absolutely agree with you there, I use the lambda orm stuff all the time. It's also much more obvious exactly what you're doing, and there's nothing that you can do in sql style linq that you can't do with it. I mostly use it for simple entity database interactions (anything complex usually gets a stored procedure), and the object relations in particular work great.
|
# ? Sep 20, 2013 16:07 |
|
Hey everyone, I have a couple questions I was hoping a Unity expert might be able to help me with, so I don't spend an hour spinning my wheels when I could be Getting Stuff Done. I know barely anything about the Unity interface/libraries, and am most comfortable when working in MonoDevelop with existing C# principles. I have a single-"scene" project that I inherited from another engineer with a mostly empty scene with a few objects holding all of the game's initialization scripts. I was wondering, is there a clean way for me to: Make a brand new scene, and have that be the starter/initial scene. When a user presses one of several start buttons on the new initial scene, the original, complex scene that I inherited is loaded up and made active, only with a parameter that varies depending on what button was pressed. I don't wanna break any of these existing scripts while experimenting, since not all of them have documentation. While I'm sure it's something I could EVENTUALLY figure out on my own with Google and documentation and such, if anyone could point me in the right direction on a general way to tidily do this, it would be a HUGE help and time saver.
|
# ? Sep 22, 2013 03:59 |
|
CuddlyZombie posted:Make a brand new scene, and have that be the starter/initial scene. Assuming it's just using standard Unity stuff:
Order them so that your new scene is index 0 and the old scene is index 1 quote:When a user presses one of several start buttons on the new initial scene, the original, complex scene that I inherited is loaded up and made active, only with a parameter that varies depending on what button was pressed. Make your GUI(do a tutorial or something to get buttons for this) call: code:
|
# ? Sep 22, 2013 04:28 |
|
Ooh, thanks! That all sounds simple enough,Obsurveyor posted:You can set static values in a game class that manages the parameter that you want to vary. I'm not sure if there's more "Unity" way to do that. So to confirm, a static value is static across the entire unity project, and not just in a given scene? If so then perfect, I've been worrying a lot over nothing.
|
# ? Sep 22, 2013 04:32 |
|
CuddlyZombie posted:So to confirm, a static value is static across the entire unity project, and not just in a given scene? If so then perfect, I've been worrying a lot over nothing. If you create a member in a class that is static, it doesn't change across instances of the class.
|
# ? Sep 22, 2013 04:37 |
|
Obsurveyor posted:If you create a member in a class that is static, it doesn't change across instances of the class. Oh okay, so I can just make a class called StaticVariables or something, then give that a static string called foo in my first scene, set an instance of that class's foo string to "bar" in my first scene, and if I later make another instance of StaticVariable in my second scene and get its foo variable, it'll return "bar"? Beautiful, thank you so much!
|
# ? Sep 22, 2013 04:42 |
|
Static variables do not change between scene loads. The one big caveat to that statement is that Unity GameObjects will be invalidated when you load a scene, unless you tag them to not be destroyed on scene-change by calling http://docs.unity3d.com/Documentation/ScriptReference/Object.DontDestroyOnLoad.html
|
# ? Sep 22, 2013 05:45 |
|
CuddlyZombie posted:Oh okay, so I can just make a class called StaticVariables or something, then give that a static string called foo in my first scene, set an instance of that class's foo string to "bar" in my first scene, and if I later make another instance of StaticVariable in my second scene and get its foo variable, it'll return "bar"?
|
# ? Sep 22, 2013 05:47 |
|
Unormal posted:The one big caveat to that statement is that Unity GameObjects will be invalidated when you load a scene, unless you tag them to not be destroyed on scene-change by calling http://docs.unity3d.com/Documentation/ScriptReference/Object.DontDestroyOnLoad.html I'm not sure I understand why this is necessary, if after my first intro screen I have no reason to return to it. Even if the first class instance gets destroyed, the static foo will still have the same value, right? Orzo posted:Better yet, make the class itself static and you won't waste resources instantiating anything. Static classes are a thing; they must have all static methods and member variables. Is this any different than a singleton?
|
# ? Sep 22, 2013 06:05 |
|
CuddlyZombie posted:Is this any different than a singleton? Not really. Singletons don't use any resources until they're used for the first time. It sounds like you're going to be using it right away, so it probably doesn't matter which you use.
|
# ? Sep 22, 2013 06:46 |
|
Obsurveyor posted:Not really. Singletons don't use any resources until they're used for the first time. It sounds like you're going to be using it right away, so it probably doesn't matter which you use. Cool, thanks. Well, it sounds like I have a few different options that'll each get the job done. I appreciate the help guys.
|
# ? Sep 22, 2013 07:30 |
|
Obsurveyor posted:Not really. Singletons don't use any resources until they're used for the first time. It sounds like you're going to be using it right away, so it probably doesn't matter which you use. Or you can do it with the same syntax as the static class through implementing a bunch of static get/set methods, but you can skip that entirely with the static class.
|
# ? Sep 22, 2013 10:31 |
|
roomforthetuna posted:The static class is a little bit less fiddly to work with, in my experience. But that's maybe only true if you're a bit lazy about the OO-ness - accessing the static variables like "StaticClass.thing=1" is something you can do with the static class and is more unwieldy with the singleton. (StaticClass.Instance.thing=1 perhaps?) That's the main reason I use them over statics.
|
# ? Sep 22, 2013 14:42 |
|
Shalinor posted:The singleton method exposes the class to the inspector, since it's on an object. Meaning you can tweak values and assign prefabs and the like.
|
# ? Sep 22, 2013 17:11 |
|
seiken posted:
This totally worked! Thank you so much!
|
# ? Sep 22, 2013 17:46 |
|
roomforthetuna posted:Aha, that is a good reason. I generally prefer tweaking values in the code, but being able to assign prefabs is certainly an advantage if that's something you want to do with a global var. I used to be of the same mindset, but there are certain areas that seeing your changes live will save you so, so much time on. Unity makes it so easy, once you can wrap your mind around it you'll really thank yourself for taking advantage of it. For example, I was working on a unity fighting game - after switching to inspector based hit box timing / positioning I could implement a character in a single day of fiddling instead of two or three days of fine tuning and trial and error. I've even been taking the time to implement quasi wysiwyg editors into most of my non unity products these days - it's a huge initial investment but you'll end up saving so much time in the end.
|
# ? Sep 22, 2013 23:32 |
|
So I was watching a demo of the UbiArt tech for Rayman Legends. I wanted to know if anyone here has any thoughts, or possibly links to blogs, articles, or papers on how they do what they call 'smart textures' for the ground as demonstrated here: https://www.youtube.com/watch?v=W9c8dTRNg20&t=780s My current naive thinking would be to calculate the angle at the control points and use that as a key into a look up table of the swap-able textures. Stretching could be accomplished by tiling the texture across the length and/or having variations that it blends into / on top of the texture. The end caps would just be 'capped' textures that are blended on top of the base texture. Does that sound about right?
|
# ? Sep 23, 2013 01:14 |
|
xgalaxy posted:My current naive thinking would be to calculate the angle at the control points and use that as a key into a look up table of the swap-able textures. Stretching could be accomplished by tiling the texture across the length and/or having variations that it blends into / on top of the texture. The end caps would just be 'capped' textures that are blended on top of the base texture.
|
# ? Sep 23, 2013 01:20 |
|
They said in the video that it's a mesh, and the blocks are curved at the control point, so it's probably just a randomized tile mesh with caps at the end.
|
# ? Sep 23, 2013 02:36 |
|
superh posted:I used to be of the same mindset, but there are certain areas that seeing your changes live will save you so, so much time on. Unity makes it so easy, once you can wrap your mind around it you'll really thank yourself for taking advantage of it.
|
# ? Sep 23, 2013 16:29 |
|
Anybody else use git with unity? I set up a project, and used a default .gitignore for unity, with the following:code:
|
# ? Sep 23, 2013 16:57 |
|
SlightlyMadman posted:When I open up the project on another computer though, the scene is completely empty. My game script and camera and everything like that are gone. I'm guessing that's in a file that's getting ignored somehow, but I'm not seeing where it is to put it back in. Did you set Version Control to "Meta Files" under Project Settings->Editor Settings? There's also a new Asset Serialization Mode to force text which would probably help git patches but I haven't tried it yet.
|
# ? Sep 23, 2013 17:40 |
|
SlightlyMadman posted:When I open up the project on another computer though, the scene is completely empty. My game script and camera and everything like that are gone. I'm guessing that's in a file that's getting ignored somehow, but I'm not seeing where it is to put it back in.
|
# ? Sep 23, 2013 17:48 |
|
SupSuper posted:Did you actually open the scene from the Assets after opening the project? The last-open scene doesn't carry across computers, so if there is none Unity will just open a new project with a blank scene. I'll second this as almost certainly the problem. Just open up the scene file on the other computer, and you should be good to go. It's just opening with a new default blank machine on the first open on the other computer.
|
# ? Sep 23, 2013 17:50 |
|
Ahh yeah that sounds like exactly it. I'll check it out again tonight when I get home, thanks for the tip! I'm still pretty new to unity so I didn't think about that.
|
# ? Sep 23, 2013 18:22 |
|
Does anyone have any info on when Unity 4.3 drops? What's the general take here, get 2D-toolkit and work with that or just wait for the update? (For a project that's supposed to be done in a couple of weeks.)
|
# ? Sep 24, 2013 23:35 |
|
DancingPenguin posted:Does anyone have any info on when Unity 4.3 drops? If 2D Toolkit were expensive, hey, wait, but... it really isn't.
|
# ? Sep 24, 2013 23:54 |
|
Yeah I wouldn't wait for 4.3 especially for a small project. There are beta versions out there for 4.3 already but its hard to say when it'll hit for everyone else. The author of Rage Spline is the one they hired to head up the 4.3 2D so I dunno if using that might make it easier to transition to the regular Unity support when its released.
|
# ? Sep 25, 2013 00:00 |
|
|
# ? Jun 1, 2024 04:46 |
|
DancingPenguin posted:Does anyone have any info on when Unity 4.3 drops? Do you have a pro license? If so you'll be able to do a ton of fancy stuff with the new 2D part. If not, just stick with 2dtoolkit. Even once 4.3 goes live, you aren't really gaining much over 2dtoolkit so porting over won't be much of a benefit versus just sticking with 2dtoolkit. I've played a little with 4.3 beta and while it replaces a lot of 2dtoolkit, the really nice stuff like the sprite sheet optimization is all saved for pro license holders unfortunately.
|
# ? Sep 25, 2013 00:41 |