Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

The Random Tips Thread

  • 30-07-2014 7:08pm
    #1
    Registered Users, Registered Users 2 Posts: 454 ✭✭


    Been meaning to start a thread for a while where we can dump the random things we learn about development in the hope they might be of use to someone else. They could be specific to an engine, or not.

    To kick things off, here's something (fortunately) encountered today concerning the Unity webplayer. Haven't made a web version before, so pardon me if this is common knowledge.

    Most portals seem to have width restrictions of around 800 pixels, but you're probably going to want to allow the player to play in fullscreen. This instruction would seem to be the obvious remedy:

    Screen.SetResolution(Screen.width, Screen.height, true);

    But instead of increasing the pixel height/width of the monitor, this seems to take the dimensions of the webplayer (in this case 800, 450), and stretches it across the display. Needless to say, it looks pretty bad.

    If you're using a GUI Matrix to resize gui components, it seems fine to do something like: Screen.SetResolution(1920, 1080, true); even if the target monitor is smaller/has a different aspect ratio, and it looks a lot better.


Comments

  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    Also Unity webplayer related, and likely only relevant if you've never released a web version before.

    The first scene in which a call to Resources.Load() is made causes the webplayer to stream all assets that are acquired through Resources.Load(). So if you have 10 megs of assets in Resources, and you make a call to Resources in in scene 0, the game won't start until the 10 mb of assets has been streamed.


  • Registered Users, Registered Users 2 Posts: 8,450 ✭✭✭RedXIV


    More a game development in general tip, but regardless how ambitious you are, start small


  • Registered Users, Registered Users 2 Posts: 3,831 ✭✭✭Torakx


    Ok a general tip from me. But I think possibly the most important one, with regards to motivation.
    Embrace all your mistakes and failures(everywhere in life too) on the road to any goals. Without those failures, the road stops and you fall into an abyss.
    The road is paved of failures, held together by our ability to adapt to them.
    So keep failing, aim to fail(reach for the sky) again and again. You will "accidently" succeed, through the process of elimination.
    This links in to the idea of starting small. When you re-iterate a process you perfect it or refine it. Lots of small failures = building the road faster. One big long failure = a very wide road, but slow forward progress overall. Both are a benefit.
    the wide road could be more stable and solid. Soa balance is my preference. I am working on both small games and a secondary large game at the same time now, for all these reasons and more.

    I personally often want to congratulate people on their failures, but I think it might be taken the wrong way :D


  • Registered Users, Registered Users 2 Posts: 1,062 ✭✭✭AirBiscuit


    (Unity)
    Apparently either using Instantiate() or using Audio incorrectly on Windows Phone 8 causes a performance hit, best avoid unless you have Pro to use the Profiler


  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    Another Unity one. If you are want to get rid of the input section of Unity's launcher (useful if you are using something like CInput, or making your own solution for changing input in-game) you can modify the launcher's GUI.

    Scroll down a few posts for the tutorial.

    http://forum.unity3d.com/threads/remove-input-section-from-launcher.141438/


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    Found these links useful for understanding A*, and implementing it for tile based games.

    Video intro: https://www.youtube.com/watch?v=KNXfSOx4eEE

    Basic implementation video: https://www.youtube.com/watch?v=BG7Bc3C-W-k

    General info & step by step implementation article: http://www.policyalmanac.org/games/aStarTutorial.htm

    More advanced/comprehensive article: http://theory.stanford.edu/~amitp/GameProgramming/


  • Registered Users Posts: 63 ✭✭Kevin Murphy


    Also Unity webplayer related, and likely only relevant if you've never released a web version before.

    The first scene in which a call to Resources.Load() is made causes the webplayer to stream all assets that are acquired through Resources.Load(). So if you have 10 megs of assets in Resources, and you make a call to Resources in in scene 0, the game won't start until the 10 mb of assets has been streamed.

    This is true but if you click 'Streamed' on the Build Settings for web player within Unity, then it will start up the first scene as soon as the first scene is loaded, and then continue loading.
    This is nicer for the user as it gets them looking at your menu (usually your first scene) faster and by the time they've checked it out, the rest is probably loaded.


  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    Yes, streaming does help get something up in front of the player faster. AFAIK, it won't help with with calls to resources though. Vaguely recall reading something about Unity being unable to distinguish which resources assets are used in which scenes, so it just holds up until it streams the whole resources folder.

    If this is the case, combining streaming with less reliance on Resources, and deferring the call to resources until later will get things running much faster.


  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    Another simple tip for Unity & C#. If you've made a class and added it to a gameobject, you might have noticed that its fields don't show up in the inspector. Here's a quick way to change that.

    1. Add using System;
    2. Add [Serializable] above the class declaration.
    3. Field must be public

    using UnityEngine;
    using System;

    [Serializable]
    public class ThisClass
    {
    public int thisIntWillShowInInspector;
    }


  • Registered Users Posts: 70 ✭✭brianorourke


    Another unity one,

    print("You can add <color=red>colour</color>, <b>bold</b> and <i>italics</i> to the debug log")

    Enjoy!


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    http://www.sorting-algorithms.com/

    Shows how various sorting algorithms perform with different numbers of elements and current levels of sorting.


  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    Another unity one,

    print("You can add <color=red>colour</color>, <b>bold</b> and <i>italics</i> to the debug log")

    Enjoy!

    Cheers for this one. Using it to highlight key info in tooltips.


  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    Here's a script for setting the anchors in UGUI to the edges of the ui component:http://answers.unity3d.com/questions/782478/unity-46-beta-anchor-snap-to-button-new-ui-system.html (check the accepted answer). Instead of manually lining up the anchors, this script will do it with a keypress.

    Dragging the anchors to the edges of a component means it will always take up the same x & y percentage of the screen space (and I think be positioned at the same % of x / y screenspace). Haven't used UGUI a huge amount yet (though early impression is that it's pretty nifty and a great time saver), but this seems similar to using a GUI matrix in the old Unity UI.


  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    Think Unity have begun packaging Visual Studio (of which the community edition is free, given certain conditions) with new downloads of Unity.

    Switched over to VS recently because MonoDevelop was causing too much hassle (project options were grayed out, so couldn't choose a more recent version of .net framework, among other things).

    Intellisense seems less reliable in VS, becoming disabled more frequently, but overall it's been less headache than Mono.

    You need to add these files to your project, to get VS working with Unity (These are for VS 2013, there are different files for each version): https://visualstudiogallery.msdn.microsoft.com/20b80b8c-659b-45ef-96c1-437828fe7cf2

    Also, the class view in VS requires you to find the file you are working on in order to display a navigation aid/summary of the class, rather then just updating based on the currently open file in the document outline in Mono. This is frustrating if you used Mono's document outline a lot, but there's a neat plugin for VS that adds this function, called CodeMaid (It's the spade component).

    You can find it here: https://visualstudiogallery.msdn.microsoft.com/76293c4d-8c16-4f4a-aee6-21f83a571496


  • Registered Users, Registered Users 2 Posts: 3,831 ✭✭✭Torakx


    I switched to Sublime text instead of mono develop. It has lots of features that make coding a bit more enjoyable for me. To be honest, I mostly like the themes and intuitive features. I don't know if it hooks up to Unity as well as mono, to show certain errors or hints. But I do prefer it now.


  • Registered Users, Registered Users 2 Posts: 32 oisincar


    Yeah I also switched to Sublime. I'm looking to learn vim at some point so it seems like a good steppingstone (it has a mode with the same hotkeys as vim). The minimap function is amazing as well; it gives you a shrinked version of the current file along the right edge, so you can find where you need no be in a file based on the shape of your code... And is also very hard to explain.


  • Registered Users, Registered Users 2 Posts: 1,062 ✭✭✭AirBiscuit


    I'm fine with VS, been using it from the first day I learned to code.


  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    Script for copying the transform of a gameobject in Unity. Allows you to quickly copy and paste scale, pos, and rotation. Handy if you have to align a lot of objects.

    http://wiki.unity3d.com/index.php?title=CopyTransform


  • Registered Users Posts: 8 HellSpark


    For character artists there's a new model painting tool called substance painter, it's really good loads of features and a single licence is less than 150 dollars. You can do things like paint heightmap information directly onto your model and you can export your finished maps. Also there's integration with Unreal engine 4, using the substance plugin. If your a modeler you can also check out Michael pavolovich, he's very good and shows a lot of his techniques for making high res models in zbrush,he also has a few tuts on substance painter.


Advertisement