• Unity3D - Discussion
    5,004 replies, posted
I wanted to try Unity again and a bit of programming in general and I thought it would be fun to recreate something similar to Lego Rock Raiders but watered down and simplified. I wrote a script that reads through a PNG file and creates a level based on the size of the image and colour of each pixel. I got it mostly working, but I'm getting holes in the generated level. [IMG]http://puu.sh/eWRI7/804b2b1612.jpg[/IMG] As far as I can see the holes only appear when Black, White, and Yellow are all touching each other, but I have no idea why this happens. I've tried changing the colour of the yellow incase it was clashing with the white but nothing changed. Heres the code I've written, it's a bit messy and probably not the best way to do what I want, but I wrote it myself and almost got it working so I'm proud if it . [code]using UnityEngine; using System.Collections; public class createLevel : MonoBehaviour { // The texture to read public Texture2D testmap; // The colour being checked. public Color mapRGB; // The hieght and width of the image in pixels public int mapX; public int mapY; // Tiles that'll be used public Transform floor; public Transform rock; public Transform gold; // On startup, void Start() { // load the selected PNG file, Resources.Load<Texture2D>("Assets/textures/testmap"); // and get it's height & width. mapX = testmap.width; mapY = testmap.height; int pointX = 0; int pointY = 0; // While theres pixels left to check, while(pointY < mapY) { // and theres still pixels in the current row to check, while(pointX < mapX) { // get their color, mapRGB = testmap.GetPixel(pointX, pointY); // and then place the matching tile down. // If the pixel is black, if (mapRGB == new Color(0,0,0)) { // place down a rock tile in this position. Instantiate(rock, new Vector3(pointX * 10, 0, pointY * 10), Quaternion.identity); } // If the pixel is while, else if (mapRGB == new Color(1,1,1)) { // place down a floor tile in this position. Instantiate(floor, new Vector3(pointX * 10, 0, pointY * 10), Quaternion.identity); } // If the pixel is yellow, else if (mapRGB == new Color(1,1,0)) { // place down a gold tile in this position. Instantiate(gold, new Vector3(pointX * 10, 0, pointY * 10), Quaternion.identity); } // when I add this line, the empty squares are filled up // by rock tiles, whixh means this code goes over those pixels, // but dosn't place any tiles. Werid. // else // Instantiate(rock, new Vector3(pointX * 10, 0, pointY * 10), // Quaternion.identity); // Move on to the next pixel. pointX++; } // Once finished, move on to the next row. pointX = 0; pointY++; } } } [/code] Any clues what might be causing these holes? I have no idea.
perhaps the texture is getting compressed or resized by unity or something
[IMG]http://puu.sh/eXkuz/a904e708b3.jpg[/IMG] Yup, that was the problem, thanks a ton!
[QUOTE=foszor;46997998]Has anyone come across a proper method for making a secure connection to a website? I know how to create an interface between the database and the client (i.e. PHP script) but how can I ensure its a game client connecting to the PHP script and not someone dicking around?[/QUOTE] You can't. At that point security through obscurity is the only way. You could use another layer of asymetric encryption for communication with the server. But whatever your program does, someone else can emulate it.
[t]https://dl.dropboxusercontent.com/u/26809665/after_hours.gif[/t] It might not look like much, but this player controller took me a while, but its good to be finally learning how to use unity. I need to refine it more though, jumping is a little strange. I've now added realistic falling physics, let me know what you guys think. [t]https://dl.dropboxusercontent.com/u/26809665/phyxics_skillllzzz.gif[/t] [t]https://dl.dropboxusercontent.com/u/26809665/more_physics.gif[/t] The magnitude increases the more distance you fall, until you reach terminal velocity (which is 700)
God, I can't even run this basic collider script. MonoDevelop won't open it when I click, and it isn't providing any public spaces to paste components into, so shit like Light.Intensity or GetComponentwon't even function. It's such a simple problem but so infuriating. edit: Oh god this shit is so awful. Nothing is working. Just to check it wasn't a code error, I copied and pasted a basic tutorial script off unity.com. It didn't work. So either my MonoDevelop is fucked or my Unity is. aaaaaaaaaaaaaaaa
[QUOTE=PaperBurrito;47008760]God, I can't even run this basic collider script. MonoDevelop won't open it when I click, and it isn't providing any public spaces to paste components into, so shit like Light.Intensity or GetComponentwon't even function. It's such a simple problem but so infuriating. edit: Oh god this shit is so awful. Nothing is working. Just to check it wasn't a code error, I copied and pasted a basic tutorial script off unity.com. It didn't work. So either my MonoDevelop is fucked or my Unity is. aaaaaaaaaaaaaaaa[/QUOTE] Use VS2013 for painless development, Monodevelop sometimes likes to refuse to save scripts.
[QUOTE=TheMasterLurk;47009819]Use VS2013 for painless development, Monodevelop sometimes likes to refuse to save scripts.[/QUOTE] MonoDevelop's just generally a piece of shit anyway. VS2013 community edition works just fine and is free to boot.
Hey Maaki, have you heard anything about the feature you need in order to release the FPS kit? Is there anything that the community can do in order to help out? I can't find anything on trello about the feature even though Fholm said it was coming.
[QUOTE=Velocet;47011679]Hey Maaki, have you heard anything about the feature you need in order to release the FPS kit? Is there anything that the community can do in order to help out? I can't find anything on trello about the feature even though Fholm said it was coming.[/QUOTE] Haven't heard anything at all. It's up to Fholm at this point I think, to create a redistributable stub version of Bolt.
So, for a book I'm working on I had a nice Final Fantasy style turn-based RPG combat demo working in Unity. Then some things happened, seeing gameplay of Sonic Dark Brotherhood, a DeviantArt painting for an RPG style Sonic, a discussion with someone in said comment section about how Sonic Dark Brotherhood was really crappy and that Sonic Team ought to give Square Enix the rights to make a Sonic RPG (the same way they made the Super Mario RPG on SNES), which turned to a discussion about a Sonic RPG fangame... And then, on a whim, I did [I]this [/I]to my turn based combat demo. Why? I've got absolutely no clue. Because I can, I guess. [video=youtube;VpbqsKWEw0k]http://www.youtube.com/watch?v=VpbqsKWEw0k[/video]
[t]http://puu.sh/f8m1p/4bd7790ed7.jpg[/t] Decided to do some UI today, I still need to clean up the notifications a little bit.
- snip, useless rant - - snip, even more useless rant, looks like I fucked up my whole project SVN wise -
Has anyone here upgraded a large scale project from unity 4.5 to 5.0 (b21)? If your project used physics, what were the things you had to change? Do you have any quick tips on the difference in behavior of unity 4 physics vs 5? If there are any sets of rules I can quickly make a script out of to iterate over every object that would be cool. e.g change of mass scale or something.
Well you can expect stuff to break, this is all I can say :(
[QUOTE=Fourier;47026890]Well you can expect stuff to break, this is all I can say :([/QUOTE] I've already upgraded and stuff did break. The problem is that it is a massive scale project and I wish I had a set of rules I could work with instead of manually tweaking every object.
[QUOTE=AtomiCal;47026955]I've already upgraded and stuff did break. The problem is that it is a massive scale project and I wish I had a set of rules I could work with instead of manually tweaking every object.[/QUOTE] Well, tweak one object, see what is wrong, make script to fix all other objects. It's dangerous road but fastest one
I don't know if the unity guys already mentioned this somewhere but I was reading the comments on [url=http://blogs.unity3d.com/2015/01/21/addcomponentstring-api-removal-in-unity-5-0/]this[/url] and I saw this comment: [QUOTE][QUOTE]Since you are cleaning up the API, and since we finally got our hands on the new Unity GUI, how about a redesign of the input manager? It’s a real pain if you want to allow the player to re-bind keys in-game (a standard feature of modern PC games), the configuration window in the editor feels hacky (lots of “magic values” in string properties) and the API for this window is not public, which prevents us from at least writing better input configuration editor windows.[/QUOTE] The Input Manager is being completely overhauled – it won’t be ready for 5.0 but should be in a 5.X release. (Believe me, having implemented in-game key rebinding for a Unity title, I feel your pain on that one…) FWIW, it’s not that the editor API for the Input Manager is not public, it’s that there is no editor API for the Input Manager. The Inspector for the Input Manager makes changes via the SerializedObject/SerializedProperty system, which is available to you as well.[/QUOTE]
Sometimes the simplest decisions make me feel like a fucking genius. I was working on a completely rewritten version of the turn based combat engine. One concept is that each character involved in combat as an IActionSelector module, which is responsible for deciding and enqueuing that character's action (all actions are run in sequence after all characters have decided their action). The idea being that I can create separate modules for AI action choosing, and for player action choosing. The interface, by the way, looks like this: [code] public interface IActionSelector { IEnumerator ChooseAction( GameCharacter character ); } [/code] So I was about to go and write an action selector module for players, which would call into the UI and basically tell it to display an action selection menu. Then it hit me. Why not just make my UI implement the IActionSelector module? Then I don't have to worry about writing this whole interface between the UI and the action selector, because the UI [I]is[/I] the action selector. Better yet, because it's a nice generic interface, my player character doesn't give a crap how it's actually implemented behind the scenes.
If I create a game object from within another game objects script, does the new one inherit the position of the creator?
[QUOTE=Richy19;47029950]If I create a game object from within another game objects script, does the new one inherit the position of the creator?[/QUOTE] No.
[t]http://puu.sh/fahGx/455cab97ae.png[/t] I love Awesomium. My game is almost complete, I'm having a little troubles trying to deal with the inventorys UI right now ( I'm using a hacky JSON approach to send it to Awesomiums WebUI ), everything right now is pretty much stuck together with duck tape.
Whoops, no its created at 0,0,0 but if I make it the child of a game object it apears as if its position is - of the parents position
[QUOTE=Pelf;47029013]I don't know if the unity guys already mentioned this somewhere but I was reading the comments on [url=http://blogs.unity3d.com/2015/01/21/addcomponentstring-api-removal-in-unity-5-0/]this[/url] and I saw this comment:[/QUOTE] This is big news. Input is a huge pain in the ass if you want to do it properly.
Heil Debug.DrawLine [img]http://zippy.gfycat.com/FriendlyBoilingIsopod.gif[/img]
does anyone know how to have a uGUI panel that blurs everything behind it? none of the 3 methods I found with google worked for me.
Good news [t]http://i.imgur.com/eR7UTjj.png[/t]
Hello, I have problem with this shit.. [img]http://i.imgur.com/Xai0OEz.png[/img] Anyone has idea why is this happening? [code] //animator is attached/set, if it wouldn't be, I would get NullReferenceError public Animator animator; //I call this command somewhere from the code animator.Play("steerLeft", 0, formula); [/code]
Try SteerLeft Steer Left and _steerLeft maybe? You can inspect the name of your states by changing the inspector window to debug mode. Click on the little thing in the top right corner of the inspector and select debug. It will display a list of states when your animator state machine is selected.
[QUOTE=Felheart;47039877]Try SteerLeft Steer Left and _steerLeft maybe? You can inspect the name of your states by changing the inspector window to debug mode. Click on the little thing in the top right corner of the inspector and select debug. It will display a list of states when your animator state machine is selected.[/QUOTE] Here. Btw this one is in layer 1 right, since 0 is base layer, correct? [img]http://i.imgur.com/NTYNr8u.png[/img] Also tried your suggestions, no luck whatsoever.
Sorry, you need to Log In to post a reply to this thread.