• Unity3D - Discussion
    5,004 replies, posted
Time travel procedural map generation
[code] Sprite[] tileMapSprites = AssetDatabase.LoadAllAssetsAtPath(Path.Combine(fullFilePath,tileOptions[selectedTileMap])).OfType<Sprite>().ToArray(); [/code] I have a PNG which I turn into a multiform sprite at "fullFilePath" and then try to load them all into a sprite array. However every time I try to load the tileMapSprites always returns 0 count. The folder path is correct. This is what the folder looks like: [img]http://puu.sh/fTh5b/a30c94fac2.jpg[/img] I have tried to get this working but it doesn't want to work. For some reason I can't figure this out for the life of me.
Have you placed them in the "Resources" folder? ([url]http://wiki.unity3d.com/index.php/Special_Folder_Names_in_your_Assets_Folder#.22Resources.22[/url]) My question now. I'm making a inventory system. My objects have a Item component which holds the item. When the player interacts with it, it grabs the component, adds it to the inventory (which is just a List<Item>), then destroys the item gameobject. But this also destroys the item. Anyone has a idea how to add the item to the list by value?
[QUOTE=Arxae;47141349]My question now. I'm making a inventory system. My objects have a Item component which holds the item. When the player interacts with it, it grabs the component, adds it to the inventory (which is just a List<Item>), then destroys the item gameobject. But this also destroys the item. Anyone has a idea how to add the item to the list by value?[/QUOTE] In my game I have an items ini file which stores all the relevant information for the item and it has a unique ID number for it. I parse the ini file and make a dictionary<int, Item> where the key is the ID number for the item. So my player inventory is just a List<int> of the ID numbers for the player's items, so when I want to do stuff with an item, I just get the Item instance from the dictionary.
[QUOTE=Arxae;47141349]Have you placed them in the "Resources" folder? ([url]http://wiki.unity3d.com/index.php/Special_Folder_Names_in_your_Assets_Folder#.22Resources.22[/url]) My question now. I'm making a inventory system. My objects have a Item component which holds the item. When the player interacts with it, it grabs the component, adds it to the inventory (which is just a List<Item>), then destroys the item gameobject. But this also destroys the item. Anyone has a idea how to add the item to the list by value?[/QUOTE] Components shouldn't exist without a GameObject. Try using ScriptableObject instead of MonoBehaviour. They can maintain data but lack the events of a normal component but don't need to be attached to a GameObject.
I've got a question about you all, regarding open-world optimization. Currently already on it's bare-legs. Creating 4 GameObjects which are "GalaxyObject"s. Each one contains a List<> of an other GameObject containing stars, blackholes and etc within a List<>. The Stars and then planets do the same. Constantly collapsing down to smaller details, growing bigger. But of course increases the RAM usage. To manage them all I've three ScriptableObjects assigned to corresponding objects. One manages the galaxies and takes care of the generation of the galaxies and all of it's contents. The second takes care of the sectors and will manage the rendering and loading of sectors inclusive it's content based on where you are looking at. The last takes care of the stars and all of their stellar bodies they contain. I've thrown up a quick sketch of the construction of the objects, for those who need better clarification: [IMG]http://i.imgur.com/SlFEg11.png[/IMG] Now to the question: What way would be the effective way to kill [extensive] RAM usage? I've got a constant I/O loading in my mind: Saving what is unneeded/out-of-interest to display in a file and loading what is needed from same said file. Instead of storing it all at once to make more room needed for other big features and mechanism that has to be stored in the RAM memory. I'm taking to mind that using 3-4 galaxies with around 1,000,000 stars each as a medium. I need to find a way to optimize the usage and code before I move on to smaller, yet important, things such as planets and moons. [B]TL;DR[/B]: What's the best way to optimize extensive RAM-usage when you have over 1,000,000 of non-rendered GameObjects? I currently have Managers set up for further development.
I have a small problem which idk how to fix since I never used drag and drop before but hopefully any of you did. Basically because of OnDrag when I click the object that has this script attached to it, it changes the object position to 0,0,0. [code] public class TestScript: MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler { public static GameObject itemBeingDragged; public static int fenceIndex; private Vector3 startPosition; public void OnBeginDrag(PointerEventData eventData) { itemBeingDragged = gameObject; startPosition = transform.position; fenceIndex = int.Parse(transform.FindChild("Index").GetComponent<Text>().text); } public void OnDrag(PointerEventData eventData) { transform.position = Input.mousePosition; } public void OnEndDrag(PointerEventData eventData) { itemBeingDragged = null; transform.position = startPosition; } } [/code]
[QUOTE=Karmah;47137184]Time travel procedural map generation[/QUOTE] I mean, time travel could be added into the story easily. I don't think I want to have procedural maps though.
[QUOTE=BoowmanTech;47142712]I have a small problem which idk how to fix since I never used drag and drop before but hopefully any of you did. Basically because of OnDrag when I click the object that has this script attached to it, it changes the object position to 0,0,0. [code] public class TestScript: MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler { public static GameObject itemBeingDragged; public static int fenceIndex; private Vector3 startPosition; public void OnBeginDrag(PointerEventData eventData) { itemBeingDragged = gameObject; startPosition = transform.position; fenceIndex = int.Parse(transform.FindChild("Index").GetComponent<Text>().text); } public void OnDrag(PointerEventData eventData) { transform.position = Input.mousePosition; } public void OnEndDrag(PointerEventData eventData) { itemBeingDragged = null; transform.position = startPosition; } } [/code][/QUOTE] I can't see that you're translating cameraposition to world position. Does it truly set the object's position to 0,0,0, or is it offscreen?
[QUOTE=Dromlexer;47142224]I've got a question about you all, regarding open-world optimization. Currently already on it's bare-legs. Creating 4 GameObjects which are "GalaxyObject"s. Each one contains a List<> of an other GameObject containing stars, blackholes and etc within a List<>. The Stars and then planets do the same. Constantly collapsing down to smaller details, growing bigger. But of course increases the RAM usage. To manage them all I've three ScriptableObjects assigned to corresponding objects. One manages the galaxies and takes care of the generation of the galaxies and all of it's contents. The second takes care of the sectors and will manage the rendering and loading of sectors inclusive it's content based on where you are looking at. The last takes care of the stars and all of their stellar bodies they contain. I've thrown up a quick sketch of the construction of the objects, for those who need better clarification: [IMG]http://i.imgur.com/SlFEg11.png[/IMG] Now to the question: What way would be the effective way to kill [extensive] RAM usage? I've got a constant I/O loading in my mind: Saving what is unneeded/out-of-interest to display in a file and loading what is needed from same said file. Instead of storing it all at once to make more room needed for other big features and mechanism that has to be stored in the RAM memory. I'm taking to mind that using 3-4 galaxies with around 1,000,000 stars each as a medium. I need to find a way to optimize the usage and code before I move on to smaller, yet important, things such as planets and moons. [B]TL;DR[/B]: What's the best way to optimize extensive RAM-usage when you have over 1,000,000 of non-rendered GameObjects? I currently have Managers set up for further development.[/QUOTE] store them on the disk when they aren't needed alternatively use procedural generation
[QUOTE=war_man333;47144600]I can't see that you're translating cameraposition to world position. Does it truly set the object's position to 0,0,0, or is it offscreen?[/QUOTE] So I have 2 screenshots to show you before I click it and after I click it. [b]Before[/b] [url=https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-15_12-27-48.png][img]https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-15_12-33-28-thumbnail.jpg[/img][/url] [b]After[/b] [url=https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-15_12-28-01.png][img]https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-15_12-33-28-thumbnail.jpg[/img][/url]
[QUOTE=BoowmanTech;47144892]So I have 2 screenshots to show you before I click it and after I click it. [b]Before[/b] [url=https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-15_12-27-48.png][img]https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-15_12-33-28-thumbnail.jpg[/img][/url] [b]After[/b] [url=https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-15_12-28-01.png][img]https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-15_12-33-28-thumbnail.jpg[/img][/url][/QUOTE] Now I'm not sure, but perhaps it's worth to look into this: [url]http://docs.unity3d.com/ScriptReference/Camera.WorldToScreenPoint.html[/url] [url]http://docs.unity3d.com/ScriptReference/Camera.ScreenToWorldPoint.html[/url]
I've been working a bit on a better particle system for Unity. I'd like to add things like beams, vector fields, particle attractors, orbits, better trails (that also work well during slower motion), and particle events. I'm going deep into letting your customize your orbits, allow mesh particles, segmented beams, and a full programming accessible API. Would any of you be interested in a product like that? [editline]15th February 2015[/editline] And a better UX in general, I don't really enjoy working with Shuriken tbh. For example, you're much more easily able to combine particle emitters into a single particle system. And every particle emitter operates on particle affectors (think UE4's Cascade modules) [editline]15th February 2015[/editline] btw if you happen to have any feature requests for a better particle system, do them now :v:
[QUOTE=DarKSunrise;47144731]store them on the disk when they aren't needed alternatively use procedural generation[/QUOTE] Actually. I'm using procedural generation to build up the whole universe inclusive other gameplay elements such as enemy empires, alien races/lifeforms and other concepts currently on the paper. Then it will be saved in it's own folder and then loaded into the game. Just like Dwarf Fortress, but in space.
[QUOTE=Asgard;47144928]I've been working a bit on a better particle system for Unity. I'd like to add things like beams, vector fields, particle attractors, orbits, better trails (that also work well during slower motion), and particle events. I'm going deep into letting your customize your orbits, allow mesh particles, segmented beams, and a full programming accessible API. Would any of you be interested in a product like that? [editline]15th February 2015[/editline] And a better UX in general, I don't really enjoy working with Shuriken tbh. For example, you're much more easily able to combine particle emitters into a single particle system. And every particle emitter operates on particle affectors (think UE4's Cascade modules) [editline]15th February 2015[/editline] btw if you happen to have any feature requests for a better particle system, do them now :v:[/QUOTE] Vector fields seem like cool stuff. They need to be dynamic (the vector field is parented to the transform or something), so you can parent vector field to the helicopters (for example). And, what about scalar fields? (that are also dynamic). This scalar field can multiply one of the particles property - velocity, color, &#916;time... Just imagine having some kind of "force shield", that when particles blow into it, they slow down - because the strong scalar field inside "force shield" is multiplying &#916;time component before it is applied to the position (pos = vel * &#916;time).
[QUOTE=Fourier;47145228]Vector fields seem like cool stuff. They need to be dynamic (the vector field is parented to the transform or something), so you can parent vector field to the helicopters (for example). And, what about scalar fields? (that are also dynamic). This scalar field can multiply one of the particles property - velocity, color, &#916;time... Just imagine having some kind of "force shield", that when particles blow into it, they slow down - because the strong scalar field inside "force shield" is multiplying &#916;time component before it is applied to the position (pos = vel * &#916;time).[/QUOTE] I really like the idea of scalar fields!
[QUOTE=Asgard;47145261]I really like the idea of scalar fields![/QUOTE] Thanks! Will the scalar/vector field be custom? Like, you set up field like "sphere/box" with radius/dimensions and pass your own custom function or how?
[QUOTE=Fourier;47145285]Thanks! Will the scalar/vector field be custom? Like, you set up field like "sphere/box" with radius/dimensions and pass your own custom function or how?[/QUOTE] It'll definitely be custom. I just need to think of a good format for passing vector fields, or a way to customize them with one or a couple of textures. [editline]15th February 2015[/editline] I might go with .FGA for vector fields to support UE4 vector field compatibility
[QUOTE=Asgard;47145328]It'll definitely be custom. I just need to think of a good format for passing vector fields, or a way to customize them with one or a couple of textures. [editline]15th February 2015[/editline] I might go with .FGA for vector fields to support UE4 vector field compatibility[/QUOTE] That is smart choice as I googled a bit and I see that you can make custom vector field inside 3DS MAX. (not to mention already made vector field from UE4).
Is there a smarter way to work with concurrent delays? I don't want to create new booleans and coroutine methods for every thing I want to delay... that's a lot of code in the end. [code] protected void ReplenishAttributes() { if (ReplenishNow) { StartCoroutine(ReplenishDelay()); Attributes.HP += Mathf.CeilToInt(Attributes.Strength/10f); Attributes.Stamina += Mathf.CeilToInt(Attributes.Agility / 10f); Attributes.Mana += Mathf.CeilToInt(Attributes.Intelligence / 10f); } } IEnumerator ReplenishDelay() { ReplenishNow = false; yield return new WaitForSeconds(1f); ReplenishNow = true; } [/code]
snip
I originally posted this on the Unity3D answers page, but since I've only received 4 views in 5 hours I've pretty much given up hope. Here's the link if anyone's interested: [url]http://answers.unity3d.com/questions/901905/unity-ignoring-custom-assembly-upon-build.html[/url] Aaand, my actual question: "Protobuf recently stopped working for me whenever I build. I'm able to reimport the assembly which will fix all compiler errors, I'm even able to play the scene without any issues what so ever, however, as soon as I make a build I get a ton of errors telling me the namespace 'Protobuf' cannot be found? I've put the .dll file in Assets/Assemblies." So yeah, anyone know what's going on?
[QUOTE=Doom;47147454]I originally posted this on the Unity3D answers page, but since I've only received 4 views in 5 hours I've pretty much given up hope. Here's the link if anyone's interested: [url]http://answers.unity3d.com/questions/901905/unity-ignoring-custom-assembly-upon-build.html[/url] Aaand, my actual question: "Protobuf recently stopped working for me whenever I build. I'm able to reimport the assembly which will fix all compiler errors, I'm even able to play the scene without any issues what so ever, however, as soon as I make a build I get a ton of errors telling me the namespace 'Protobuf' cannot be found? I've put the .dll file in Assets/Assemblies." So yeah, anyone know what's going on?[/QUOTE] I'm not so experienced in this matter but if it's C#, I give it a shot. 1. Have you included the "using (namespace)" in the files using the .dll's classes and definiations? 2. Have you included the .dll in the .sln's references?
[QUOTE=Dromlexer;47145097]Actually. I'm using procedural generation to build up the whole universe inclusive other gameplay elements such as enemy empires, alien races/lifeforms and other concepts currently on the paper. Then it will be saved in it's own folder and then loaded into the game. Just like Dwarf Fortress, but in space.[/QUOTE] Since the entire process of creating a procedural universe relies on a seed, hypothetically you only need to store just the seed(s) and build/destroy the areas around the player as they travel through the game.
[QUOTE=Dromlexer;47147505]I'm not so experienced in this matter but if it's C#, I give it a shot. 1. Have you included the "using (namespace)" in the files using the .dll's classes and definiations? 2. Have you included the .dll in the .sln's references?[/QUOTE] Yes to both. EDIT: Actually, going through all the errors, they appear exactly at the using namespace directive
[QUOTE=Asgard;47144928]I've been working a bit on a better particle system for Unity. I'd like to add things like beams, vector fields, particle attractors, orbits, better trails (that also work well during slower motion), and particle events. I'm going deep into letting your customize your orbits, allow mesh particles, segmented beams, and a full programming accessible API. Would any of you be interested in a product like that? [/QUOTE] Just to repeat the question, would there actually be interest in a product like this? I'd rather not waste my time working on something that won't sell
[QUOTE=Asgard;47150290]Just to repeat the question, would there actually be interest in a product like this? I'd rather not waste my time working on something that won't sell[/QUOTE] I for one would like better trails.
[QUOTE=war_man333;47150677]I for one would like better trails.[/QUOTE] Trails are kinda unrelated to particles, but they're something that I really wish Unity did better. I "tried" the Better Trails package on the Asset Store to see if it fit my needs and it really didn't. My ideal trails package would allow you to dynamically set the initial velocity of the trail points, allow discontinuous trails (shut them on and off with the correct breaks in between), give scripting access to each of the points on the trail so they can be manually moved (important!), allow a color gradient be used to color trail points based on lifetime, and ditto for size. As for specifically particles, I complain about a lot of things with particles when I'm using them but I can never remember what those complaints are when I'm not working on them.
Would it be at all possible to use the existing particle system and LineRenderer/something else to make trails that act more like particles? I know you can get direct access to the particles currently alive in a particle system, perhaps could you make them invisible and draw trail-like lines between them or something? I haven't actually tried this yet, and I can foresee a whole bunch of problems with it (not least of which is LineRenderer not being all that great.) Just thought I'd throw the idea out there.
[QUOTE=foszor;47147507]Since the entire process of creating a procedural universe relies on a seed, hypothetically you only need to store just the seed(s) and build/destroy the areas around the player as they travel through the game.[/QUOTE] I've built the seed system to be an array of integers which, when together, they make up a long string of numbers where parameters (created by UnityEngine.Random) are stored as numbers and are separated with a semi-colon. All of them always start with the their ID. Example of the structure I'm using for the StellarObjects. id:name:type:distance:angle:tilt:time:mass:moonid which when saved would be 231:2,1,0:0:45112:180:21:45:872000:671 A planet with the ID 231 and a name created by putting the 3-vector in 3 Dictionaries. The type is 0, a planet. The distance from their sun is 45112 thousand kilometers... and so on. Where the 671 is the id of one it's moons. If it's more than one moon. They will be separated by comma (,). Using this code to extract the seed. Located in the class where StellarObject inherits from. [code] protected virtual int[] ReadSeed(string seed) { string[] tmptokens = seed.Split(':'); int[] tokens = Array.ConvertAll<string, int>(tmptokens, int.Parse); return tokens; } [/code] But my next question is, as I'm not very well experienced with game-design grade programming. I think the most efficient way to assign the Tokens is through a foreach loop. But all of the parameters are separated datatypes. I've tried putting them in an object[] without success.
Sorry, you need to Log In to post a reply to this thread.