text:
How about fitting into gaming industry with Design and Development mindset and seeking for a masters degree?
Might be the question is a bit weird but that's what I'm focused on and want to discuss about obtaining a masters degree to fulfill my dreams to work as both designer and developer.
I work as a programmer with 5 years of experience and I code in C, C++, C#. Back home I design Application UX, Logo, Banners, Website graphics, Write small software for personal needs or friends and yes I like to play games.
Now, holding a bachelor degree in Computer science and professional experience I want to opt for a Masters degree abroad(probably in Europe) with focused subject(may be Game design/development). Now my problem is that I do not like to do a formal Computer science masters as it would be a traditional process of learning computer systems. As well as I don't like mathematics in dept, having said that I do use calculation and business logic a lot in my programs but I'm not very much fond of them. So basically I'm a design creativity guy with developer mindset. I developed quite a few windows applications on my own and some of them are live on Softpedia.
So I like to pursue my future with the mix of both. Is there any way for me to fit into game industry? If not what would be better for me rather than continue only programming job profile?

If you want to develop games, you need math. And a lot of math.

Check out unity3d.com  you can get a good overview of the game development industry, also check the tutorials and you will see if your knowledge and skills are suited for it

It seems this is a two part question.

Where could I fit into the gaming industry?

As the gaming industry is still quite new, I'd say it's still quite flexible as to how you would go about getting into it. There is a lot of tips on this if you do a google search. Basically tho, since the rise of indie development, there are two routes:

Apply for a job at a company, these come in all sizes, from one to thousands of people. Sure a nice degree will help you, especially for the bigger companies, but the most important part I'd say is that you can showcase your skills through a portfolio or experience. If you are really good at something, you will be able to get a job, and this is especially true in the gaming industry.
Go indie. i.e. start on your own and make games, or join others who are doing the same. This is a very popular route in the past years and very many people are doing it, thus there is a lot of competition, not to mention that finishing a game, getting it sold and running a company are huge challenges. It's become easier tho with easy to learn tools such as Unity and Unreal engine, and distribution platforms such as Steam and the appstore.

What masters degree should I take to focus my game developer career?

I think this question is very country & university specific as you are a bit limited to where you are willing to study. Say you can study anywhere in the world. Looking through the whole worlds university programmes is quite a daunting taks, but I'd search for any schools offering game development bachelors and see what they offer in masters degrees.
Masters degrees tend to be a bit more specific tho, and I think you'd end up choosing a specialty that isn't really game specific, but rather computer engineering.
In the end tho, as I stated in the answer above, if you really want to get into the industry you should really just become really good at what your doing and build a portfolio and apply for jobs. I think that would help you a lot more than a degree.

Thanks for the comment. I will edit the question a bit according to your points. But in brief I'm looking forward to a Master degree abroad specially in Europe. And currently I'm well placed in my country within the IT industry which I'm doing for the past 5+ years.


text:
Sprite editor "minimum size" feature alternative in Unity 5
As you know , unity has been removed its minimum size feature in sprite editor multiple auto slice mode. In some pics Unity discovers a lot of tiny rubbish sprites for example as 4x3 or 10x5 pixels. Is there anyway to set minimum size for good auto slicing in Unity 5?

let me say that I don't know any way to set a minimum size. You might already know everything I'm telling you, but I figured I could try.
One way to "fix" it would be deleting those "wrong sprites" using CMD + delete if you're on a Mac (it may be only delete on Windows). Plus, is it possible that when creating the sprite in Photoshop/Krita/Gimp/Anything else you accidentaly drew a tiny line or point that you can't see but is still seen as sprite? It happened to me more than once. Just delete carefully around the shapes you want to keep.
Hope this can help even if I don't have a direct answer.

Thanks to your suggestions, but I'm looking for some automation inside Unity.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Should I Have a Ridiculously Easy First Level?
I am making a game based on a grid and filling in certain squares with certain colors according to some rules. It is level-based, and the difficulty of a level is determined by the size of the grid and how many colors you have to fill in. Should the first level be ridiculously easy to allow players to get used to the UI?

The two possible answers are Yes, or No.  Either way, that is your decision to make as a game designer.  Everything else is merely someone else's opinion.

Put it this way: if your first level is too easy and players breeze through it, they get to the harder levels quickly. If it's too hard and they bounce off it, they never see your other levels at all. As jgallant says though, ultimately the difficulty curve you choose is up to the kind of game you want to make. Games like Kaizo Mario start off already hard to clearly set expectations: "this is a game that will try to beat you," and that's as valid a design direction as any other.

Here is a really good example from the creator of Super Mario. He explains that the first level was designed to introduce the player to the base concepts of the game. It's a very good video. https://youtu.be/zRGRJRUWafY There is actually quite a bit of psychology in the design of the first level.
You should also look at Classical Conditioning, aka "Pavlovian Conditioning". https://en.m.wikipedia.org/wiki/Classical_conditioning Essentially, you allow the player to discover what "feels good" and "feels bad". In the video, when the player hits a block they receive a coin. This is a reward; they now know that hitting those blocks gives rewards, so they would like to try it again. And inversely, falling into a hole or into water(if applicable to your game), will result in death, which naturally is a bad thing, thus they now know that they should refrain from doing it again.

This is more of a comment than an answer. Though to add to what you say, there is also a nice video on the Super Metroid space lab level and how it is actually a "silent tutorial".

@lozzajp Updated with more information.

Super Mario World 1-1 is a good example of a silent tutorial. But it is still not as "super easy" as most tutorials of more modern games. In SMW 1-1 it is entirely possible for an inexperienced player to die a lot. In modern game tutorials the player is often in no danger at all or at least has to actively try to play bad enough to lose.

Usually you should.
The purpose of the first level(s) is to make the player familiar with the controls, UI and most basic game mechanics. The first challenge for the player to beat should be how to control the game, then to understand the game, and then to actually play it competently. It's great when you can mark each of these steps with a success milestone in form of a complete level.
For further research I recommend the video Tutorials 101 by Extra Credits.
However, keep in mind that game design is more of an art than a science. There are no absolute rules in game development. Sometimes you need to muddle this progression for the sake of immersion and storytelling. And sometimes it can be refreshing for the player to get pushed out of their comfort zone and challenge them from the first second on.

Not really.
It's highly recommended to have ridiculously easy ( and few ) mechanics in the first level. Make the first few player mechanics easy ( introduced in the first level ) to understand and learn - this generally allows a broader range of people to play.
You can make it challenging, though. As long as the overall mechanics are simple - you can make players work to actually win.
All endless games embrace this concept ( Threes, 2048, Flappy Bird, Temple Rush and so on ). It's vital to make the game rules easy to understand ( especially at the start of the game ), but that by now way means you should have a trivial game/level to play.

I personally don't think it should be "ridiculously" easy because if it is too easy then it would give the impression to the player that the whole game lacks any challenge.
I think it would be best to have a slightly more simple introduction to the game's mechanics so the user finds it easy to pick up the controls, just make sure they can easily pick up how to play and that they will learn how to play, but it should have a little challenge (not too much, but a little) to engage the player more.

Thanks. But what if the controls are deliberately hard?

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Multiplace instances of an object in Game Maker with a variable changing
I want to do a level selection menu in GameMaker. There's one button for each level. Clicking on the button 1 take you to level 1, button 2 take you to level 2 and so on.
But if I duplicate the first button, all of the buttons will get you to level 1. Is it possible for multiple instances of the same object to have different variables?

If you placed all the buttons in the room editor then you can define variables in instance creation code (room editor -> RMB on an instance -> Creation Code).
If you created all the buttons via code, you can easily define different values, like this:
for (var i=0; i<10; i++)
{
    var obj = instance_create(50 + i*50, 50, obj_button);
    obj.level = i; // all the instances will has different value
}


text:
LIBGDX Image tearing
I'm making an game in libGDX and I have been noticing some image tearing when camera is moving. Note that it happens only when the game is maximized and the camera x position is less than screen width and camera y position is less than screen height. Here's a GIF showing what is the problem The color errors are not the problem here, it is the GIF fault

I figured it out. It was to do with float rounding(or something to do with floats atleast). After casting them to ints it works without problems.

Disabling CPU sync and enabling vsync could fix your issue.
config.useCPUSynch = false;
config.vSyncEnabled = true;

There is more discussion of this over on reddit if that doesn't work.

config.useCPUSynch doesn't exist


text:
VBO Performance issues
I'm making a 2D Tile based game in OpenTK at the moment. Performance was really bad (laggy and slow) with direct drawing, so I switched to VBOs. The performance hasn't changed, it might even be slower than it was.
I render the tiles from a list, but use a single VBO.
public void DrawTiles()
        {
            foreach(Tile t in Tiles)
            {
                if(t != null)
                {
                    GL.Color4(System.Drawing.Color.White);
                    GL.BindTexture(TextureTarget.Texture2D, Global.LoadTexture(t.TileTexture.Path, 1));
                    var i = (CellNum * CellSize) / 2;
                    GL.PushMatrix();
                    GL.Translate((t.Position.X * CellSize) - i, 0, (t.Position.Z * CellSize) - i);
                    var x = CellSize;
                    verts = new Vector3[8]
                    {
                        new Vector3(0, 0, 0), new Vector3(0, 0, 0),
                        new Vector3(x, 0, 0), new Vector3(1, 0, 0),
                        new Vector3(x, 0, x), new Vector3(1, 1, 0),
                        new Vector3(0, 0, x), new Vector3(0, 1, 0)
                    };

                    GL.EnableClientState(ArrayCap.VertexArray);

                    GL.EnableClientState(ArrayCap.TextureCoordArray);

                    GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
                    GL.BufferData<Vector3>(BufferTarget.ArrayBuffer, (IntPtr)(Vector3.SizeInBytes * CellNum), verts, BufferUsageHint.StaticDraw);
                    GL.BindBuffer(BufferTarget.ArrayBuffer, 0);

                    GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
                    GL.VertexPointer(3, VertexPointerType.Float, Vector3.SizeInBytes * 2, 0);
                    GL.TexCoordPointer(3, TexCoordPointerType.Float, Vector3.SizeInBytes * 2, Vector3.SizeInBytes);
                    GL.DrawArrays(PrimitiveType.Quads, 0, verts.Length / 2);
                    GL.Flush();
                    GL.PopMatrix();
                }
            }
        }

That method is called in OnRenderFrame, CellSize and CellNum tell me how big the tiles are supposed to be and how many there are each side of the grid. Even if I run say a 20 tile grid, my program is incredibly laggy.
Does any one know a more efficient way to render these tiles, or better yet, speed up my current method?

The important thing to realise, as you've discovered, is that VBOs aren't a magic wand that makes everything run faster under every circumstance.  Specifically, you're only going to see a meaningful performance improvement with VBOs if you're bottlenecked on getting your vertex data from the CPU to the GPU.  If you're not so bottlenecked, then the potential performance improvement that VBOs offer doesn't apply to you.
It's quite safe to assume that drawing 20 quads is not so bottlenecked; glBegin/glEnd code is perfectly fine for this kind of workload, unless you have an actual reason to do otherwise (such as wanting to use a core profile).  Remember: Quake used glBegin/glEnd code in 1996, drew several hundred polygons per frame, and ran plenty fast enough on hardware of that time.
You've also discovered that a bad VBO implementation (and your's is one) can run slower than glBegin/glEnd code.  The way to use a VBO properly is to batch up a lot of vertices then submit them all in a single draw call.  So rather than filling a VBO with a single quad at a time, instead you pre-allocate a large VBO (how large? depends on your program, but several hundred or even thousand quads would not be unreasonable), fill it up, then make a single glDrawArrays call with it.
If the data doesn't need to change then you just reuse the VBO from the previous frame.  There's definitely no need to recreate it.
So given that you've not got a bottleneck that's adressable by a VBO, yet you're still running slow, it's obvious that you must be bottlenecked elsewhere.
Looking over your code, I can see a number of things that are candidates for improvement, but the main one that jumps out at me is your Global.LoadTexture call.  Are you reloading textures from disk every frame?  Yes, that would make it slow.
A second thing is your use of the old matrix stack.  For your use case, this gets you nothing in terms of performance - don't get the idea that just because it's a GL call it means it runs on the GPU, because the old matrix stack doesn't.  Furthermore, you're inserting state changes between each draw call that will prevent the driver from being able to batch up work (you've another case of this I'll come to later).  Get rid of that and just put the final positions directly into your glVertex calls (or VBO); your GPU will thank you for it.
Thirdly, that glFlush call is completely unnecessary and is once again preventing the driver from batching up work.  Get rid of that too.
So, sort these out first, retaining your old glBegin/glEnd code, and then you'll be able to determine if glBegin/glEnd code is actually a problem for you or not before doing anything else.

Wow, that has to be one of the best answers to any question I've asked. Upvotes for this one guys. Thanks though man, I'll get on to these thing now.

Okay, I removed the things you said, but the major one was Global.LoadTexture. When removed, my program ran just as fast as not rendering anything at all. Sir, you are a god among men.

It's also good to note that even Minecraft still uses immediate mode for its rendering. Each chunk is compiled into a display list after being triangulated and optimized, and rendered via occlusion culling. Hell, my current game uses the same principle, in that rooms segments are combined together into a single display list. The performance I am seeing is phenomenal, too.

The problem is that the basic buffer object API - the one introduced in GL_ARB_vertex_buffer_object and promoted to core in GL 1.5 - is just so bad that unless your data is absolutely static you're probably better off using client-side arrays or immediate mode instead.  The D3D equivalent doesn't have these problems, and the GL API has been patched many times with extensions and core revisions to fix it's original limitations: VAOs, attrib binding, map buffer range and buffer storage all make it look like the API it should have been from the beginning.


text:
Shader or No Shader?
I have a question about something I don't really understand.
In OpenTK, should I have shaders? Is it frowned upon not to? What are the pros and cons of having shaders?
Can I go perfectly fine without having anything to do with vertex or fragment shaders?

In OpenTK, should I have shaders?

Generally yes; however, it largely depends on the context. See below for why.

Is it frowned upon not to?

Generally yes; however, it largely depends on the context:
If your game uses lighting: Yes
If your game doesn't use lighting: No, it's not necessary.

What are the pros and cons of having shaders?

Bobobobo's answer at https://gamedev.stackexchange.com/a/22069/91298 answers this; however, I'll try to give a more in-depth explanation.
Shaders uses the texture, available light sources, and the camera position to color the objects in your scene appropriately. This results in objects casting shadows and carrying shades. Without it, everything carries a monotone color. The underside of a desk is the same color as the top side regardless of a floor or ceiling light. A character casts shadows that shrink and elongate as they pass by lights. Vehicles and large objects carry different shades on thier various faces that gives them character. Lighted objects, such as rockets, or energy pulses light up their surrounding area.
Alternatively, if you're designing a game without lighting, such as a puzzle game (luxor comes to mind) then it's not strictly necessary. That being said, adding lighting would give any 3d or 2d objects character which may improve User Experience. Using Luxor as an example, the marbles are 3d. Add lighting, and the 2d field simulates depth.

Can I go perfectly fine without having anything to do with vertex or fragment shaders?

Technically: Yes. Shaders merely add coloring to the scene. If user experience isn't a big deal, then you can live without it. If you're new to this, then I'd recommend you try a few TK tutorials using shaders. Once you understand how to make them, then you can determine if the extra work you invest will be worth the UX they add to the game.
As an example, Minecraft has an option to turn off shaders. If you have the game, try flipping it on and off. In some places the difference is minute; in others, and with detailed textures, it's makes an incredible difference.

Sorry to say but shaders do much more than "merely add coloring", you talk like all shaders do is add lighting and coloring. Shaders do everything on a modern GPU.... Like expanding a point into a quad, tile based light culling, particle simulations, noise generation for terrain. Without shaders nothing get drawn unless you are using the old fixed function pipeline. There is lots of miss information in this answer.

If all I need to do is render textured quads, have some basic lights and possibly small particle effects, are shaders are good idea?

Yes 100% you want shaders, shaders are what make your game look unique I really cant even imagine not using shaders. I'm not sure how the samples are for openTK but I started with XNA then once I had that down I moved over to sharpDX so since 2010 I have been using shaders. I would start with a sample that has some stuff you want and then pull it apart and rewrite it so u understand how it works.

Please make another answer if this one isn't correct

@DenverP. if all you want are textured, alpha blended quads and basic post-FX you don't need shaders. Even without shaders, you have the option to render to texture and have vast array of alpha blending modes, stencil testing, which allows to create wide variety of post-processing FX. Great many 2D games from SNES, Sega Genesis GBA, PS1, Dreamcast, PS2 era didn't have "shaders" in the traditional sense.

@JBeurer Please make this into an answer, to make it easier for others


text:
Turn Based AI Algorithm (Small Board, Two Steps)
This is my Game-Board:

-> The Red Balls are the AI-Controlled Actors.
-> The Blue Balls are the Player-Controlled Actors.
-> The Yellow Cells are the locations, from which the Red Balls can attack.
-> Each Red Ball can do 2 actions: move-move, move-attack, attack-attack.
-> At no time there can be 2 minions on one cell, but a minion can arrive on a cell another just left.
Its the AI's turn. Its planning the whole turn for all minions, each of them has the two moves.
The objective is to maximize the number of melee attacks, which can performed in a single turn (2 actions) on the player balls.
Problem I have in my current (brute-force) implementation:

Sometimes it is advisable for a minion to move, although it is already in a melee position, to make space for another minion, which can then move into melee range aswell.

Example:

In this situation its more effective for the front minion to move once, so another minion can move into melee range as well.
Do you know an effective algorithm for this job? Thank you for your time!

Your first step would be to calculate all possible moves for each AI unit without regard for other AI units, rate each move by tactical and strategic considerations and order them by rating so you got a first, second, third etc. choice per unit. Then you need to find the solution with the best overall happiness. I am pretty sure that this last step is a quite well-researched optimization problem in computer science. I just can't remember how it was called.

Thanks. Would you mind to elaborate on this, maybe in an answer? :)

I would if I could remember how that problem was called so I could look up how it is usually solved. I don't write incomplete answers.

I understand and appreciate this.

Alpha-Beta pruning: https://en.wikipedia.org/wiki/Alpha%E2%80%93beta_pruning
is commonly used for those scenarios. Depends how do you want to your game behave, you can choose another algorithm.
Difficulty of the game (as strong the opponent is) is how deep the AI goes in tree or size of stack.

The problem is that we are dealing with a game here where a "turn" means that the AI player makes a move with every single one of their units and each move affects the available options of the other units. The number of possible move combinations a player can make on their turn grows exponentially with the number of units they control. A search tree is not an appropriate solution for this problem because there are just too many possible options, even with optimizations like alpha-beta pruning.


text:
How can I launch the Unity Editor and open a specific project from C# code?
I created a very simple console application:
namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            // The project I want to open
            var arg = @"""-projectPath C:\Users\Administrator\Downloads\New Unity Project""";

            // Start Unity and open the project
            Process.Start(@"C:\Program Files\Unity\Editor\Unity.exe", arg);
        }
    }
}

But only the Unity Editor is launched; the specified project is not opened.
What do I need to modify to launch the project?

I've tried with and without the extra quotation marks but nothing happened.

Since the path to the project contains spaces, I would surround it with quotes.

did you mean to write @"\"-projectPath C:\Users\Administrator\Downloads\New Unity Project\"" ?

This might be a better question for the SuperUser StackExchange, as your problem isn't specific to game development, it's just about formatting your command line arguments correctly.
When you write arg like this:
var arg = @"""-projectPath C:\Users\Administrator\Downloads\New Unity Project""";

That's equivalent to typing this into your command line:
Unity.exe "-projectPath C:\Users\..." (etc)

As Hellium points out in the comments above, you want the quotation marks around the path, not the whole command line argument string. Like this:
var arg = @"-projectPath ""C:\Users\Administrator\Downloads\New Unity Project""";

Then in the command line it looks like this:
Unity.exe -projectPath "C:\Users\..." (etc)

Yes, I was thinking of posting on StackOverflow. Thank you for your help. This solved my problem.


text:
Cube Translation Looks All Wrong
I'm making a very simple cube in OpenTK and it seemed to be going fine until I tried to move it around. Moving it along the X Axis seems to elongate the cube, not the result I hoped for.
My Vertex Shader
#version 330

in vec3 vPosition;
in  vec3 vColor;
out vec4 color;
uniform mat4 modelview;
void
main()
{
    gl_Position = modelview * vec4(vPosition, 1.0);
    color = vec4( vColor, 1.0);
}

My Fragment Shader
#version 330

in vec4 color;
out vec4 outputColor;

void
main()
{
    outputColor = color;
}

How I make modelview
    Matrix4 c = Matrix4.LookAt(Game.camera.Position, new Vector3(Game.camera.X + 1f, 0, Game.camera.Z + 0f), new Vector3(0, 1, 0)) * Matrix4.CreatePerspectiveFieldOfView(
    (float)(0.5 * Math.PI),
    (float)1366 / 768,
    0.1f,
    1000.0f); * Matrix4.CreateTranslation(Origin);
GL.UniformMatrix4(Game.uniform_mview, false, ref c);

What I'm doing here is adding 0.01 to Origin.X while moving the camera the opposite direction.
Does anyone know why it produces this result? Thanks in advance for your help.
EDIT: Multiplied matrices by perspective * view * model

This weird line seems to blink in and out as I move the camera around.
EDIT 2: Matrix Printout
(0, 0.9999995, 0.001019571, 0.001019367)
(0, 0.001019367, -1.0002, -0.9999995)
(0.5622255, 0, 0, 0)
(1207.66, -0.9999995, 980.9957, 980.9995)

are the marices in the correct order?  I'd usually expect perspective * view * model...

@realUser404 apologies, I wasn't referring to that, I meant the modelview in the question above, i.e. c = lookat * proj * trans.  I'd usually expect it to be something like proj * lookat * trans

Sorry for the delay on getting back to you guys, it's 6:52AM here. I will try switching my matrices around, see if that works.

I just switched the matrices around, and I'm getting a weird green line that blinks on and off, I'll post a gif.

seems like a weird result.  Another thing that may be a typo:
1000.0f); * Matrix4.CreateTranslation(Origin);

is there supposed to be a semicolon before the * here?

also you are using OpenTK which uses transposed matrices by default (see this question) which may explain the matrix weirdness.

Oh yeah, that was me removing commented out lines in my code, not what I had written in the actual code.

Okay I changed it back to model*view*proj, but now I'm just getting the same result again...

did u change back to the original, i.e lookat * proj * trans or did you try trans * lookat * proj

I tried trans * lookat * proj and I'm getting the result in the first gif

Can you somehow post the content of the modelview matrix?

How do you suggest I do that?

print the 4x4 float numbers in the matrix(s) to txt file/console/dubugoutput, then post them here.

Added matrix numbers.


text:
Reading a word list into an array
I am making a simple hangman game, I have a small list of words in a .txt file separated by new lines. I put the word list into the assets folder. How can I find the path to the word list so I can use:
string[] wordlist = System.IO.File.ReadAllLines("pathToFile");

Or is there another solution of converting the word list into a string array?

https://docs.unity3d.com/Manual/StreamingAssets.html. Like the answer I have little to no exp with Unity, found this link with a search engine, as you should be doing before asking

Please consider researching your question, before posting. Questions that show no research effort may receive down votes.

Use the Streamreader to load in the text in unity or set it as a text asset and parse it directly. This forum post should help give you an idea of what to do:
https://forum.unity3d.com/threads/read-from-textasset-line-by-line.327422/

This actually worked better for me cause the unity compiles my text file. This way I can access it even if it's encrypted.

This answer would be better if it included at least a summary of the method(s) suggested in the linked thread, so a user doesn't need to read through all the back-and-forth discussion at the link to follow it, and so that the answer is robust even if the linked thread is deleted or changes address. It would also be good to clarify that the thread recommends not using a StreamReader, but instead using Unity's TextAsset functionality.

I have little experience with Unity, but it appears as though you can use Application.dataPath to obtain the correct path.
Here it is at the API.


text:
On button click wait
I have a button I got from google material design asset pack which has a ripple animation when pressed. I'm using the button's click option in the inspector that calls a method that switches scenes. But when I tap the button it switches the scene immediately and feels unnatural since the animation hasn't finished the button ripples animation.
I tried using co-routines. Made the button call a method in which I call a IEnumerator method (since the button can't directly call a co-routine) and then switch the scene. But that doesn't work since it starts the co-routine and switches the scene, the co-routine never pauses the code and never finishes (probably because I loaded a new scene and the object that carries the script isn't transferred).
Code example:
The method that gets called when I tap a button:
 public void OnButtonTap()
 {
     StartCoroutine(Wait(0.2f));
     SceneManager.LoadScene("OnePlayerGameIntro");
 }

The wait coroutine:
 public IEnumerator Wait(float seconds)
 {
     yield return new WaitForSeconds(seconds);
 }

There's another good answer to a similar question here, showing how to make a generic "Wait, then to this Action" coroutine.

Here is the method with the coroutines.
 public void OnButtonTap()
 {
     StartCoroutine(LoadSceneAfterDelay("OnePlayerGameIntro", 0.2f));
 }

 public IEnumerator LoadSceneAfterDelay(string sceneName, float seconds)
 {
     yield return new WaitForSeconds(seconds);
     SceneManager.LoadScene(sceneName);
 }

Coroutines can't pause the "main thread" of Unity. A coroutine is a parallel execution of a piece of code and runs "independently" of the main thread.

I used invoke and it worked, I'm probably going to use this since I can use the method and don't have to create 2 methods for every scene change.

Yes you have, one to call Invoke, the other to call the SceneManager. Anyway, it's up to you ;)

But when I want to load a scene in an another place I need to write it just once and call the method to load. Could write a singleton to access the method from the main script.

Use the Invoke method. Invoke is used to trigger another method, but it allows us to pass a float value, representing a "wait" before the method runs.
Note that Invoke takes a string for the method name. Simple type out the name of the method with no enclosing brackets inside double quotation marks, as shown, in the example. Also note that you can not call methods that take parameters, in this way.

///Opens the scene immediately.
public void OpenScene
{
    // put your logic to open the scene here
}

///Opens the scene after a 0.3 second delay.
public void OpenSceneWithWait()
{
    Invoke("OpenScene", 0.3f);
}

If you're using Unity animations you could take advantage of Animation Events. This will allow you to trigger code at a specific point in an animation. This should allow you to be more accurate than using a co-routine or invoke method.
https://docs.unity3d.com/Manual/animeditor-AnimationEvents.html


text:
Disable spaces in InputField
This is straight forward. I have an input field and I want to restrict the user of inputting any spaces. I was thinking to make a script that checks if the user typed in a space and then remove it, but is there a simpler way of doing this?

Change the font of that input field, don't include the space ASCII character code in the font import file. So that means setting the offset to 33. That should be it for not letting the user see space inputs.
Of course, they will still be inputting spaces (just not seeing them) but you can filter them out when they send the string for whatever you need it for. I don't really have time to test this right now but if you do let me know and I'll do the same if I test it.

@Leon Laci : Have you even tried to make some research ? http://gamedev.stackexchange.com/questions/134541/how-to-only-allow-one-space-in-an-inputfield/134554#134554

I'm still new to unity and c# so I don't understand most of the code and how to use it in my case, but I will try to make it work for me.

There is an easy solution IF you only require alphanumeric characters (alphanumeric characters include: a-z,A-Z,0-9). In the input field, change the content type to alphanumeric. This will only allow letters and numbers, not spaces.

You can also try out the other options too.
Otherwise, if you require symbols too, you will have to use a script with a checking function that removes spaces. This would be initiated by the On Value Changed, which you can also se in the image.
I can quickly code an example script if you want me to.
EDIT:
OK, I have made an example script and will show you how to use On Value Changed.
Start by making a new c# script called 'UpdateInputField' and replace the text with this:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;// this is needed to use the 'InputField'

public class UpdateInputField : MonoBehaviour
{
    InputField IF;
    void Start()
    {
        IF = GetComponent<InputField>();//get the input field
    }
    public void UpdateField()
    {
        string text = IF.text;//get text from input field
        text=text.Replace(" ","");//fliter spaces from text
        IF.text = text;//set the text in the input field to the filtered text
    }
}

Go and add this script to the input field object.
Next, click on the + sign on 'On Value Changed':
Then click on the bottom left box. In the window that appears, find the input field object in your scene and select it.

After that, click on the top right box and select UpdateInputField, UpdateField()

And that should be it!
The OnValueChanged part automatically calls the UpdateField() function in the script whenever the input field is typed into. The UpdateField() function will then filter any spaces from the text and then set the text in the input field to the filtered text.

I don't know how the on value change works, I was first thinking making a update method that checks if there are empty spaces.

@Gnemlock I have updated my answer with an example

My solution to disable 'tab' symbol in input field. You can disable any other symbols
using UnityEngine;
using UnityEngine.UI;

public class ConsoleInputController : MonoBehaviour
{
    private InputField consoleInputField;

    // Start is called before the first frame update
    public void Start()
    {
        consoleInputField = GameObject.Find("ConsoleInputField").GetComponent<InputField>();
        // Sets the DisableTabValidate method to invoke after the input field's default input validation invoke (default validation happens every time a character is entered into the text field.)
        consoleInputField.onValidateInput += delegate(string input, int charIndex, char addedChar) { return DisableTabValidate(addedChar); };
    }

    private char DisableTabValidate(char charToValidate)
     {
         //Checks if a tab sign is entered....
         if (charToValidate == '\t')
         {
             // ... if it is change it to an empty character.
             charToValidate = '\0';
         }
         return charToValidate;
     }
}

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
How would I process accelerometer data to use it for camera rotation?
I'm using Three.js to make a web-based 3D first-person game.  I would like the player to be able to control the camera rotation with their device's accelerometer.
The sensor data is received via the DeviceMotionEvent event listener. Here is an example of what it returns:

How should I proceed with this?

This question is too light on details. Please edit it to explain more - what kind of sensor are you using (IMU, MARG, etc), and which stage of the process do you need help with? Reading input from the sensor? Performing sensor fusion or smoothing? Transforming that motion data into a rotation representation? Scripting your camera to follow this rotation? Or something else? It's a bit much to ask for a ready-made "complete solution" - show us what you have so far & where you're stuck.

@DMGregory edited it. do you need more details?

@DMGregory probably I need to set camera's yaw and pitch. basically, the same thing you would set with a mouse in most FPS games, but with accelerometer.

So, would it be fair to describe your problem as "how do I convert from an acceleration vector to a camera angle?" In that case, you should explain what kinds of device motion should translate into what kinds of camera motion (as with many geometric problems, images probably help here). In particular, I note that your rotation rate data is null. Without this, you won't be able to determine whether the device is rotating around the axis of gravity, so your proposed camera control scheme should take that into account.

@DMGregory There's nothing wrong with this DeviceMotionEvent object, in particular that the RotationRate is null.

Isn't there a sensor, that measures rotation?

I've attempted to clarify with an edit, as this question has 2 votes to close it as "unclear what you're asking", but I think it has potential. Does the result reflect your intention? Requests for further clarification: Have you tried processing the motion data event in some way already and gotten stuck? Do you know how to rotate the camera independently any motion data already?

You don't need to use the accelerometer, there's already a way to get the device's orientation with the deviceorientation event:
addEventListener("deviceorientation", function(e) {
    // This function is called when the phone rotates
    // e.alpha is the angle around the y axis (yaw)
    // e.beta is the angle around the x axis (pitch)
    // e.gamma is the angle around the z axis (roll)
});

If you really want to use the accelerometer, then here's how to do it:
Take the acceleration vector and subtract it from the accelerationWithGravity vector, the result is the gravity vector. This always points down (except if you are in space), so you can normalize the vector, get the angles of it and negate them. This should result in the orientatiom of the device.


text:
2D HUD over 3D scene
I'm trying to create a 2D Heads up Display for my players in a 3D OpenTK environment. How I'm doing it is by drawing my 3D elements and then running this code.
GL.MatrixMode(MatrixMode.Projection);
GL.Ortho(-0.5, 0.5, -0.5, 0.5, 1, 100);
GL.LoadIdentity();
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
//Disable all depth stuff
GL.DepthMask(false);
GL.Disable(EnableCap.DepthTest);
GL.Disable(EnableCap.CullFace);
//Pass texture to shaders
GL.ActiveTexture(TextureUnit.Texture0);
GL.BindTexture(TextureTarget.Texture2D, TextureImg.Handle);
GL.Uniform1(GL.GetUniformLocation(Game.pgmID, "texUnit"), 0.0);
GL.Uniform1(GL.GetUniformLocation(Game.pgmID, "texture"), 1.0);
//Enable vertex attributes
GL.EnableVertexAttribArray(Game.attribute_vpos);
GL.EnableVertexAttribArray(GL.GetAttribLocation(Game.pgmID, "texcoord"));
GL.EnableClientState(ArrayCap.VertexArray);
GL.EnableClientState(ArrayCap.TextureCoordArray);
//MVP matrix is only translation of HUD position
Matrix4 c = Matrix4.CreateTranslation(new Vector3(Position.X, Position.Y, 0)) * Matrix4.CreateScale(0.1f);
GL.UniformMatrix4(Game.uniform_mview, false, ref c);
//Send vertices and uvs to shader
GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(verts.Length * Vector2.SizeInBytes), verts, BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(Game.attribute_vpos, 2, VertexAttribPointerType.Float, false, 0, 0);

Vector2[] uvs = new Vector2[]
{
    new Vector2(0,0),
    new Vector2(1,0),
    new Vector2(1,1),
    new Vector2(0,1)
};

GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(uvs.Length * Vector2.SizeInBytes), uvs, BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(GL.GetAttribLocation(Game.pgmID, "texcoord"), 2, VertexAttribPointerType.Float, false, 0, 0);
//Draw
GL.DrawArrays(PrimitiveType.Quads, 0, 4);
GL.UseProgram(Game.pgmID);
//Make sure I can render 3D again
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
GL.DepthMask(true);
GL.Enable(EnableCap.DepthTest);

It works exactly how it's supposed to, except the quad that I draw to the screen is slightly stretched out. It's annoying the absolute heck out of me, and I have no idea what I'm doing wrong.
Edit: Picture

Ypu always create a new array buffer everytime you render something? That's going to take up a lot of memory overtime.

Are you talking about the UVs? I'll put them in my class instead. It does seem inefficient now that I think about it.

GL.Ortho creates a screen that is as wide and tall as you specified it. In your case both the width and height is 1 unit.
Because your screen is wider than taller, a width unit is bigger than a height unit, and thus the square becomes stretched.
You need to get the screen's sizes, calculate it's aspect ratio (width / height), then you need to set the left clipping plane to -aspectRatio / 2 and the right to simply aspectRatio / 2. You also need to load the ortographic matrix after the identity matrix.
You should store aspectRatio somewhere in case you wnt to put something at the edge of the screen, because that's not 1 anymore.

A simple and well thought out answer, just the kind I like. Up-vote for this one :)

I just tried what you said, but unfortunately the stretched out quad persists. GL.Viewport seemed to have some effect. If I set it to GL.Viewport(0,0,800,800) I can render the quad perfectly, but only in the left hundred pixels.

@Denver do you call GL.Identity before it?

Yes, I do call GL.Identity() before the Ortho call. Which looks like this now. GL.Ortho(-aspectratio, aspectratio, -aspectratio, aspectratio, 1, 100);

@Denver You need to set only the left and right to aspectratio, the top and bottom should be -0.5 and 0.5.

After a lot of searching about, the answer was amazingly stupid. All I needed to do was send the translation of my HUD element multiplied by an orthographic matrix to the shader. The code looks like this for other people with my problem.
Matrix4 c = Matrix4.CreateTranslation(new Vector3(Position.X, Position.Y, 0)) * Matrix4.CreateScale(100) * ortho * Matrix4.Identity;
GL.UniformMatrix4(Game.uniform_mview, false, ref c);


text:
Does decreasing rendering resolution also decrease the amount of polygons in my 3d models?
When lowering my game resolution I reduce the pixel count of the final rendered output image, does the 3d model I use to render the final image also lose polygons?

No your meshes do not lose polygons. Only the amount of fragments generated by the polygons will be reduced. If you think about it, where would the polygons go? You still need all of them to make sure you have correct result when rendering your scene. Even the sub-pixel sized polygons are usually included in final image.
In some cases though, the rendering can be optimized a bit to find and discard polygons that are way too small to be affecting the rendering result. But in these cases the mesh data should be pre-processed before rendering.

What exactly are these fragments? This reduction affects the 3d model in game quality?

Fragments are basically pixels. After fragments have been generated, they are run on against a fragment shader (pixel shader in directx) and then the fragments on the same pixel on screen are blended together, or if no alpha blending is applied then just the closest fragment to the screen is applied. You should read about this pretty basic stuff from somewhere, like here: https://www.khronos.org/opengl/wiki/Rendering_Pipeline_Overview

Also part 3.4 of this link may be useful: https://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

There's also a minimum limit of fragment per triangle, which is around 3-4.

In an in game perspective, changing the resolution from 1920x1080 to 800x600 makes the 3d model lose details?

Yes, because the same amount of polygons is covering less pixels. The end-result is in lower detail because of that, even though the amount of polygons remain the same.


text:
Cocos2dx launcher - how do I set a newer engine version?
Why doesn't Cocos(V3.10) detect my newer engine version (3.14) which I downloaded and placed into the engine folder? ( I mean the launcher, the all-in-one version where you can create your project much easier)
thanks in advance!

Probably you are talking about the cocos studio launcher. It is a cancelled project, they dont give more support to it.
However, you can still using cocos studio for GUI/level designing and then importing it to your 3.x newer version.


text:
Inverse Kinematics using Pseudoinverse Jacobian
I'm having problems solving IK with Jacobian Pseudoinverse method.
What I do is:

At each local joint frame q_i of the chain q calculate the cross product between rotation axis (taken from local transform) and joint-to-end-effector vector (end-effector is transformed to q_i coordinates):
// for each joint q_i -> to parent iteration

// Get Local Joint Position and Rotation Axis
lTransform = ... // local transform of i-th joint
if (lTransform.Decompose(s, q, t)) {
    q.AxisAngle(lRotationAxis, angle); // quaternion, XMQuaternionToAxisAngle
}

// Transform End-Effector To Local Joint Coordinates
lEndPosition = Vector3::Transform(lEndPosition, lTransform); // each iteration is updated to-parent
lJointToEnd = lEndPosition - lTransform.Translation();
lResultAxis = lRotationAxis.Cross(lJointToEnd);

jacobian(0, i) = lResultAxis.x;
jacobian(1, i) = lResultAxis.y;
jacobian(2, i) = lResultAxis.z;
jacobian(3, i) = lRotationAxis.x;
jacobian(4, i) = lRotationAxis.y;
jacobian(5, i) = lRotationAxis.z;

Set up desired change in position dX = globalObjective - globalEndPosition (fill the rest with zeros [orientations]).
Calculate configuration dQ with jacobian pseudoinverse:
jT = jacobian.transpose();
inv = (jacobian * jT).inverse();
jpinv = jT * inv;

dQ = jpinv * dX;

So what exactly is dQ? Each value should represents a local change in i-th joint.

Is it the angle of rotation around rotation axis in local joint frame?
Or maybe translation value along cross product?

I tried applying both variations above updating local joint transform with simple matrix multiplication and none of this works. The end-effector position seems to be moving very randomly - at each iteration it's very different.

I need to calculate this locally, because the end-effector does not always represent a leaf of the skeleton.

The answer is this:

Jacobian needs to be calculated globally. For each joint in global coordinates rotation axis needs to be calculated as a cross product between joint-to-end and joint-to-target. The vector that goes into the Jacobian position field is a cross product between joint-to-end and rotation axis - it is a vector along which movement needs to be made (wikipedia under "angular velocity" names it: cross-radial component).
// For each joint (except end-effector)
JointPosition = ToWorld(jointChainID[j]).Translation();
JointToEnd = EndPosition - JointPosition;
JointToTarget = TargetPosition - JointPosition;

// Calculate Rotation Axis
RotationAxis = JointToEnd.Cross(JointToTarget);
RotationAxis.Normalize();

// Cross-Radial Vector
Result = JointToEnd.Cross(RotationAxis);

// Jacobian column entry
jacobian(0, j) = Result.x;
jacobian(1, j) = Result.y;
jacobian(2, j) = Result.z;
jacobian(3, j) = RotationAxis.x;
jacobian(4, j) = RotationAxis.y;
jacobian(5, j) = RotationAxis.z;

The result dQ contains rotation angles for each joint along RotationAxis (in global coordinates). Then I apply changes locally (this is weird, as I apply global changes to local joint coordinates, but somehow this works):
// Apply changes to local skinning matrices
// For each joint (except end-effector)
     jointID = JointChainID[j];
     gTransform = Matrix::CreateFromAxisAngle(cache.RotationAxes[j], ToRadians(dQ(j)));
     SkinningLocal[jointID] = gTransform * SkinningLocal[jointID];


text:
Unity Vertex shader recalculate renderer bounds
I've made a simple billboard gpu instancing vertex shader that manipulates the verticies of an object based on the projection matrix. The problem is that the renderer bounds does not update to encapsulate the object. If the objects render bounds goes out of view the objects dissapears because of frustrum culling, is there a way to recalculate the render bounds after manipulating the verticies or manually manipulate the bounds to be the maximum size that the object that be.

You can't recalculate the bounds in the vertex shader itself (culling happens before we've even decided to send those vertices to the GPU), but we can manually set the bounds in a C# script:
// Note: this copies the mesh, to avoid changes rippling out and affecting
// all instances of it, including the asset in your project folder.
// If you're sure you already have a unique mesh, you can use .sharedMesh
// to avoid creating a copy.
Mesh mesh = GetComponent<MeshFilter>().mesh;
mesh.bounds = new Bounds(center, size);

As you say, if you set up these bounds to encapsulate the maximum volume any of your vertices might occupy, then it won't be frustum culled as long as any part of that zone is within the camera's frustum.


text:
Unity3D CrossPlatformInput StandardAsset Multitouch
I have a small game I am working on, and I am trying to add touch support to it.  Before I try to add that into the real game I wanted to do a test run on a small project.  The project consists of a capsule to be the player, and the application accepts movement from a on screen joystick, and accepts a button click from a UI button.  The button triggers the attack, and the joystick triggers the movement.
Both of these controls work as designed but they will not work together, meaning I can do one or the other.  I was hoping to use the standard asset as to not re-invent the wheel for speed...
below is the code that "Should" be triggering when both controls are used, just as a note this same code works when I use mouse and keyboard together so this is something to do with the mobile stuff..
using UnityEngine;
using System.Collections;
using UnityStandardAssets.CrossPlatformInput;

public class PlayerController : MonoBehaviour
{
    public float playerSpeed = 10f;
    Transform weapon;

    // Use this for initialization
    void Start ()
    {
        weapon = transform.FindChild("Weapon");
    }

    // Update is called once per frame
    void Update ()
    {
        DirectionalMovements();
        ButtonPresses();
    }

    void ButtonPresses()
    {
        if (CrossPlatformInputManager.GetButtonDown("Fire1"))
        {
            weapon.GetComponent<Sword>().AttackOne();
        }
    }

    void DirectionalMovements()
    {
        float moveVertical = CrossPlatformInputManager.GetAxis("Vertical") * playerSpeed * Time.deltaTime;
        float moveHorizontal = CrossPlatformInputManager.GetAxis("Horizontal") * playerSpeed * Time.deltaTime;

        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        transform.Translate(movement, Space.World);

        if (movement != Vector3.zero)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(movement.normalized), playerSpeed);
        }
    }
}

Any thoughts would be greatly appreciated.. I just do not see why both controls are not picked up here.

any errors being thrown  ?

No errors at all, just only accepts one control or the other when using touch.  But the same code works fine when using mouse and keyboard

This is kind of a stupid question but does the device support multi touch ?

Yep it does testing with a Surface Pro 4, and a Nexus 6P

Just wanted to be clear I am using the standard asset CrossPlatformInput asset, and the SingleJoystick prefab for the controls.  This has a single joystick and a button, the only change I have made to the standard prefab is renaming the Jump button to "Fire1" so that it triggers my in my code.

reloaded the asset package and deployed it again, and it magically worked.

not sure what fixed it but i reimported the asset package and redeployed.. this fixed it


text:
Error: Cannot create FMOD::Sound instance for resource sharedassets0.resource when splitting application binary in Unity
I'm trying to publish an Unity app to the PlayStore. Since the size of the app is over the limit of 100MB, I need to split the binary. So I selected the option Split Application Binary in Unity.
However, when I try to launch this application (either by downloading it on the Playstore or putting the .apk and the .obb directly on my device from my computer), I get the following errors on Android SDK monitor:
01-24 11:38:52.442: E/Unity(25004): Error: Cannot create FMOD::Sound instance for resource
sharedassets0.resource, (File not found. )
01-24 11:38:52.442: E/Unity(25004):
01-24 11:38:52.442: E/Unity(25004): (Filename:  Line: 882)
01-24 11:38:52.442: E/Unity(25004): Function SoundHandle::Instance::~Instance() may only be
called from main thread!
01-24 11:38:52.442: E/Unity(25004):
01-24 11:38:52.442: E/Unity(25004): (Filename:  Line: 25)

The application freezes at the "Made with Unity" splash screen.
This is not happening when I don't use the Split Application Binary option and put the .apk directly on my device from my computer.
I'm using Unity 5.4.0.


text:
LibGDX moving game window with mouse drag
TL;DR
How can I move window with mouse without tide effect.
Long Version
So when I tried to move my game window via InputListener(just to test if it would work). I got some strange result. The window goes back and forth between last two locations when mouse drags and while button is held.
Game Part
Gdx.input.setInputProcessor(new InputAdapter() {
    int b;
    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        b = button;
        // TODO Auto-generated method stub
        Rectangle.tmp.set(0, 0, 100, 100);
        if (Rectangle.tmp.contains(screenX, screenY)) {
            lastx = screenX;
            lasty = screenY;
            System.err.println("Touch ( " + screenX + " , " + screenY + " )");
        }

        return true;
    }

    @Override
    public boolean touchDragged(int screenX, int screenY, int pointer) {
        if (lastx != null && tr != null) {
            tr.translate(screenX - lastx, screenY - lasty);
            System.err.println("Drag  ( " + lastx + " - " + screenX + " , " + lasty + " - " + screenY + " )");
            lastx = screenX;
            lasty = screenY;
        }
        return true;
    }

    @Override
    public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        lastx = null;
        lasty = null;
        System.err.println("Up ( " + lastx + " , " + lasty + " )");
        return true;
    }
});

DesktopLauncher Part
Game.tr = new Translator() {

    @Override
    public boolean translate(int x, int y) {
        Display.setLocation(Display.getX() + x, Display.getY() + y);
        return true;
    }
};

PS: What I try&tried to make may look stupid.
Edit: Actually I noticed that window moves less than actual mouse movement.
Edit2: When I move the movement code to touchUp I get exact result as movement.

What exactly are you trying to do here? Move the game window? You can already do this by pulling the window normally as with any other window.

Yes that is why I said "what I try to make may look stupid.". The game window freezes when you try to move and I want to make a game where you move the window to translate camera so you play the game in your desktop actually. So I told myself if the whole thing is caused by window drag maybe I if I handle it would not cause freeze.

I see. I don't know if something like this would be possible since things like this is probably tied to your operating system, not Libgdx or Java. Someone correct me if I'm wrong.

actually if there is a way to get desktop coordinate system I would be able to move window accordingly.

So I changed my code as this.
Game Code
    Gdx.input.setInputProcessor(new InputAdapter() {
        int offsetX;
        int offsetY;
        @Override
        public boolean touchDown(int screenX, int screenY, int pointer, int button) {
            offsetX = screenX;
            offsetY = screenY;
            System.err.println("Touch (" + screenX + " , " + screenY + ")");
            return true;
        }

        @Override
        public boolean touchDragged(int screenX, int screenY, int pointer) {
            tr.translate(offsetX, offsetY);
            return true;
        }

        @Override
        public boolean touchUp(int screenX, int screenY, int pointer, int button) {
            offsetX = 0;
            offsetY = 0;
            return true;
        }
    });

Desktop Launcher Code
    MyGame.tr = new Translator() {

        @Override
        public boolean translate(int x, int y) {
            // WINDOW_HEIGHT is a static variable on launcher code. In my case that would be enough but there is Display.getHeight function if someone needs.
            Display.setLocation(Display.getX() + (Mouse.getX() - x), Display.getY() + (WINDOW_HEIGHT- Mouse.getY() - y));
            return true;
        }
    };

So instead of trying to use touchDragged to move window. I cache the relative location of my window where the mouse pressed. And move the window to catch that point. this may or may not change the fact that game would pause rendering or not cause I currently do not have anything to render.


text:
Pre rendered 3d
I am so confused on how to create isometric buildings ( like the ones in Clash of clans ) so I can use them in my project in Unity..What I've understood ( I think ) is the buildings are actually 3d models but rendered as 2d images..I have created lots of 3d models in Blender and I want them to look as the ones in the pic.. How can I do this?

(Image source)

Possible duplicate of Efficient method to export a lot of pre-rendered sprites from 3D models

You render them as a png/preferred image format from the angle you want from your 3d program. Shadows and everything is baked into your sprite. Then in Unity you import them as regular sprites and use that in 2d.
There's not really much more to it. I guess, you have to texture it etc, but that's not something you do in Unity anyway.

So render them in blender and save them as png?

Yeah, that's all you need. Obviously there are things you can't do with it that way, like rotate around the buildings or real dynamic lighting, but for an isometric game those are not needed anyway.

Check out this site here.
You can do this as 2D images, not 3D models being rendered 2D. They are actually 2D sprites that are just made in such a way with appropriate proportions and tools to make them appear as though they are 3-Dimensional. That's the point of isometric - "having equal dimensions".
The tutorials on that site use Illustrator so if you don't have that and intend to legitimately make these, then it's definitely a great tool to get, but there are free, lower quality, tools that do essentially the same stuff.

unfortunately I already created the 3d models..I dont want to do them again in Illustrator

Gotcha - well in that case go along the lines of what Nicki said

Probably what you need is orthographic projection. Orthographic projection maintains the distance between points and usually used for generation of minimaps in games. Blender should be able to render pictures with this mode. Please try it and tell if it helped your case


text:
Isometric tiles
I am trying to figure out what is the best way ( in terms of performance) to create a ground to place my 2d isometric sprites on..Should it be tiled ( using 2d sprites ) or just use a plane ( or terrain ) and add a texture to it?

Depends on what you are looking for besides performance. Purely from a performance stand point, terrain tends to be more memory heavy in Unity.

@n_palum so go with tiles?

It's more time consuming but performance it is not as intensive

@n_palum Do you play Clash of Clans?.If so, aren't those 2d tiles?

I used to. And yes I believe they are isometric tiles. So they appear 3D but are just 2D

@n_palum any way I can contact you directly?

If a textured plane meets your needs, then that sounds like a very simple solution worth trying. If it's not meeting your needs, can you give more details about what additional functionality you're looking for? There are hundreds of games using isometric tiles, implemented dozens of different ways, so it's hard to pick out a "best" approach without more details about what suits your game and your team's preferred workflows.

^ What @DMGregory said would be helpful... and I would prefer stuff to stay on here, not direct

@DMGregory The only use of my ground will be to place buildings on it ( isometric sprites ) and move them so should I go for the plane or tiles?

You still haven't described a situation that would demand more than a simple textured plane, if all you need is a background to layer sprites in front of. If you have a need that is NOT met by this solution, then you should edit you question to describe this situation. Without a specific problem to solve, there's no compelling reason to recommend any particular solution.

The best way is often whichever way you prefer. At the end of the day, you should not have performance issues as a result of dividing your background into smaller pieces. If it suits your design better, do it.


text:
Painting over a Quad
So I want to create a quad as a base for my game where I will put stuff on it ( trees rocks buildings etc ) ..Now how can I paint over the quad and put stuff on it?...Is it possible?
I wanted to use a terrain at first but I have been told there will performance issues and a quad would be a better choice. All sprites are going to be static too.

You can put stuff on it sure, but as far as painting, you may just want to 'paint' a texture in photoshop and then import it as a texture and lay it on the quad.

@n_palum so can I lay multiple textures on a quad?

You would have to use a project to do so but yes - https://docs.unity3d.com/Manual/class-Projector.html

You put stuff on it by...putting stuff on it. There's really no magic trick here. You take the thing you want to put on top of the quad (say, a mesh or a sprite), drag it from your assets folder into the scene view, and position it on top of the quad. Have you run into any particular difficulty doing this?


text:
Unity - Create terrain in Blender?
I am going to make a terrain ( not too big ) for my RTS and I was wondering whether to use Unity's terrain tool or create a terrain in Blender and import it to Unity?..I have been told that Unity's terrain is intense work for the mobile GPU..So would it be any good to make the terrain in Blender ( in terms of performance )?

See the comments on this previous question. As it was in that question, your best bet is to make a simple test of each version and try it on your target hardware. That will tell you whether the performance difference is serious enough for your scenario to be worth re-implementing Unity's terrain features for a custom mesh.

I don't know about performance but I guess that if you import terrain from blender it'll be just a mesh without terrain's LOD system, you'll need to write it yourself, same thing with grass and detail meshes, you'll need to make your own LOD system for them. It'll require extra work but I'm almost sure that it will be at least a little faster. If you can export terrain with big texture for it, it'll save processing power that is needed for splatmapping in shader.


text:
Make an object rotates by an arbitrary angle and rotates toward a target in Unity
I have an object facing up in Unity. I need it to move from point A to point B, without prior knowledge of where A and B are. So when I place it at point A, I need to rotate it toward point B. I used this:
this.gameObject.transform.rotation = Quaternion.FromToRotation(A.position, B.position);

However, before doing the movement, I also need to rotate the object by 90° around the X axis. I used this:
this.gameObject.transform.rotation = Quaternion.Euler(90.0f, 0.0f, 0.0f);

These two functions worked, but separately. When I try to use these two functions together, the last function called overrides the other.

you need to look into Coroutines so you start the second rotation after the first has finished.

I'm... pretty sure this is not a good solution. I need to create a quaternion from two quaternions, not use the two rotations one after another.

Thats not what you imply in your question. By saying "Make an object rotates by an arbitrary angle THEN rotates toward a target". I'm thinking you need to chain together two or more separate rotations.

Ok, I edited the title.

This should about do it I think. You can use the * operator to multiply quaternions together :
  float rotationAngle = 90 ;
        Quaternion qA = Quaternion.FromToRotation(A.position, B.position);
        Quaternion qB = Quaternion.AngleAxis(rotationAngle, Vector3.right);
        Quaternion qC = qA * qB;
        transform.rotation = qC;


text:
Can I place 3D objects on a 2D sprite?
I am creating a circular island for my game. I will be doing it in Photoshop, and importing it to Unity as a .PNG. Will I be able to place grids and buildings on top of it, like in RTS games, or must my island be a 3D model to do so?

When showing a sprite in Unity it actually creates a 3D object for you to display it. This is called billboarding, although it is a flat plane (so technically speaking 2D) it is still a object in a 3D world. Even setting unity to 2D it still is a 3D environment with the 3th axis/dimension locked.

Unity allows you to work with both 3D and 2D elements.
To answer your question, yes. You can place a 3D object on top of a 2D sprite. Simply dragging the two objects into a scene, together, will show you this. As per the grid, Unity does not have any such feature built in. We see a grid in the editor, but this grid is not visible in-game. As such, you will be creating the grid, yourself. Assuming you set it up to work, it will work. How you go about doing so is an entirely different question.

Alternatively, you could simply use the Terrain tool to make your island, and use the original image as it's texture.


text:
GameObject that should have a fixed speed keeps accelerating
I'm using a coroutine to make a GameObject move from a random point A to a random point B. The GameObject should move along this trajectory at fixed intervals and at a constant speed.
However, each time my coroutine that executes the movement is called, the GameObject is a little bit faster.
private IEnumerator movement () {

        // Initialize position and rotation
        float distanceX = endTransform.position.x - startTransform.position.x;
        float distanceZ = endTransform.position.z - startTransform.position.z;
        float angleAroundY = 90.0f - Mathf.Rad2Deg*(Mathf.Atan2 (distanceZ, distanceX));

        this.gameObject.transform.position = startTransform.position;
        this.gameObject.transform.rotation = startTransform.rotation * Quaternion.Euler (90.0f, angleAroundY, 0.0f);

        // Move from point A to point B
        while (this.gameObject.transform != endTransform.transform) {
            float step = speed * Time.fixedDeltaTime;
            this.gameObject.transform.position = Vector3.MoveTowards (this.gameObject.transform.position, endTransform.transform.position, step);
            yield return null;
        }
        yield return null;
    }

I checked and the step variable is constant.

Where and how do you set your speed? I cannot see this part of the code being faulty if step is really constant. Though, maybe you are incrementing the speed once you initialize the movement... The one thing I'm unsure of here is your while condition, are you sure it ever finishes? The transforms might never be hitting your !=. I'm actually sure they will never be the same, but for the sake of this not being my code, I'll keep the "might" intact. That could cause make the coroutine never stop and upon your next start of movement, firing the coroutine twice.

speed is a public variable of the class containing this coroutine. But since stepis constant each frame,speedmust be constant too (and it is, I checked with log). I'll check if the transform actually hit the!=`.

Okay, I edited the comment. Make sure the coroutine actually finishes.

You were right, the issue was the fact that i checked if the transforms were the same, while I should have checked if the positions are the same. this.gameObject.transform and endTransform.transform had different rotations.

I answered too, so we can close the topic.

Heads-up, you don't want to use fixedDeltaTime here. That gives you the duration of a physics/FixedUpdate step, but this isn't running in the physics/FixedUpdate step: yield return null means it resumes with the next Update step. You want Time.deltaTime here, and in fact it's generally safe to always use Time.deltaTime when you want to know how much time this run of the script is accounting for - if you try to read this version during a FixedUpdate step, Unity will return the fixedDeltaTime for you automatically.

Turned my comment into answer, to make the question answered.
The problem lies in the while loop never actually reaching it's condition.
Only the position is being manipulated but whole transform equality is being tested and the rotations do not match, obviously.
That in return never stops the coroutine and whenever the coroutine is called again, the position is going to be reset and now both of the coroutines are going to execute their MoveTowards code. Order to move once more, and it's happening thrice... On and on and on..
The movement seemingly stops, because MoveTowards will equal the target if it was going to overshoot. This can make one think, that the coroutine has finished.
It's a simple fix - check explicitly for positions:
while (this.gameObject.transform.position != endTransform.position)
{
    // MoveTowards
}


text:
Not see through models without adjusting clipping panels
I'm making a FPS game in Unity3d with a lot of weapons, but when I'm aiming I can see through the weapon. I know I can adjust the near clipping panel, but when I do that, my terrain starts flickering. Is there some solution?

Could you post scenes hots of the issues?

A common solution to this problem is to create a second camera that only renders a specific custom layer. Then, you simply put the weapon in that same layer. The environment and UI are drawn by the first camera, with its ordinary clipping planes, and the second one can be set up to correctly display the weapon without affecting any other parts of your scene.
Of course, the fact that your terrain is flickering when you adjust your camera's clipping planes might also point to another problem that might need looking into.

the fact that your terrain is flickering when you adjust your camera's clipping planes might also point to another problem that might need looking into.  eh not really. The distance of the clipping plane determines how detailed (or rather what the depth values represent in) the z-buffer, and logically depth value needs are different for small stuff close to the camera, like the weapon in your hand, than big stuff far away, like distant terrain.

You could render the weapon in a separate pass/camera, and just overlay the weapon onto the other view. In Unity this is pretty easy to do by adjusting stuff like the Clipping Mask and Clear Flags of the Camera.


text:
Identity the same component on all connected clients
I have a client-server architecture and a scene containing objects X, Y, Z, etc.
Each component needs to be identifiable so that messages sent from the server can be routed to the correct component it needs to. For example, I have 2 instances of Health component. Let's call them I1 and I2. I1 takes damage and the server updates its value and sends a message to all players to update the health of component I1 to 0.
For components that already exist in the scene when it is loaded, what I've done is assigned and serialized a unique ID at design time. But how can I handle components instantiated at runtime? For example, the same component could be instantiated on different clients but in different orders causing all the IDs to be out of whack.

Isn't this exactly what a NetworkIdentity is for? Why not use Unity Networking which provides this out of the box?

Thanks for your comment but as I said I am not using Unity Networking.

You may have missed the "why not" part — if you have additional constraints that make Unity Networking unsuitable for your case, it would be a good idea to include them in your question, as they might impact the kinds of solutions proposed. In particular, you should probably share some details of how you're currently instantiating objects across multiple clients, since any ID solution will likely need to be incorporated into that process, and if you're not using the standard methods then we can only guess at how your code does this.

The reason is because some of the code is ran outside Unity (the server side code) and I have plans to ditch Unity in the future. Also NetworkIdentity identifies an Object, but I would like to identify a Component.


text:
About to release a free game on Google Play Store, any legal considerations I should take into account?
I will release in the next few weeks a small free game on the Google Play Store. I was wondering if there was any important legal aspects I should consider before release.
Here's a few infos:

I'm doing this alone.
There's no code/graphic assets/gameplay concepts I would like to protect in particular. I don't have any issues with people copying something from my game.
I'm not sure right now, but maybe I'll add the possibility to make a small donation (so there will be IAP in a sense).
I'm using a music track from http://opengameart.org/. The author has specified that it wasn't necessary to credit him, though I would like to.

I suggest you consult with a lawyer. And that you take a look at this: Common legal pitfalls for GameDevs.

It actually depends on the license associated with whatever assets you use from other source.

I only use the music I mentioned in my question.

"There's no code/graphic assets/gameplay concepts I would like to protect in particular. I don't have any issues with people copying something from my game." This allows ppl to copy your game. If they decide to actually copy the game, make a small tweak and add in-app purchase, and invest their time and money on marketing, they could be making a lot of money for little effort. Don't release a game without copyright.

While a good question, it's a not a good question for this site. This would be more suitable for a forum or other site where people can provide various inputs that would be compiled into a list.


text:
Can GPU overload cause rendering inaccuracies?
It was supposed to be a continuous tube, made out of 5000 instanced rings of 60 cubes each (12 triangles each) on my integrated laptop intel GPU card using OpenGL 3.3.

That was what I got. The distortions you see can also be seen when rendering 1000 or 500 rings, albeit at much lower quantity and severity.
What is causing it? I've disabled polygon smoothing, and it helped immensely, but didn't eliminate the problem. I've also found out that vertex shader variables are highp by default. There is no front culling either.
Here it is how it is supposed to look (same rendering, but from front, where it is not distorted).

The FPS is about 10. NearZ is 0.01, FarZ is 100, also tried 1..1000, didn't change much, if anything.
Can this possibly be just because I render too many triangles and the solution would be to make less of them?
Shader codes:
const char *VERT_SRC_FSTR =
"#version 330 core\n"
"in vec3 pos;\n"
"flat out int vertexID, instanceID;\n"
"uniform vec3 mov[%d], eye;\n" // %d - RENDERER_MAX_INSTANCE_COUNT
"uniform mat4 proj, view;\n"
"void main(void)\n{\n"
"    vertexID = gl_VertexID;\n"
"    instanceID = gl_InstanceID;\n"
"    vec4 p = proj * view * vec4(pos - eye + mov[gl_InstanceID], 1);\n"
"    p.x *= %f;\n" // %f - inversed aspection ratio (9/16)
"    gl_Position = p;\n}\n";
const char *FRAG_SRC_FSTR =
"#version 330 core\n"
"flat in int vertexID, instanceID;\n"
"out vec3 clr;\n"
"void main(void)\n{\n"
"    clr = vec3(vertexID %% 2, 1, instanceID %% 2);\n}\n";

Is there anything else I can try? Could this be an issue with my driver/graphics card?
Edit: glxinfo excerpt:
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel Open Source Technology Center (0x8086)
    Device: Mesa DRI Intel(R) Bay Trail  (0xf31)
    Version: 12.0.6
    Accelerated: yes
    Video memory: 1536MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 3.3
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Bay Trail
OpenGL core profile version string: 3.3 (Core Profile) Mesa 12.0.6
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

Rendering code:
// Rendering draw function:
void rendererDraw(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glUniform3fv(renderer.eyeLoc, 1, rendererInput.eye);
    glUniformMatrix4fv(renderer.projLoc, 1, GL_FALSE, rendererInput.proj);
    glUniformMatrix4fv(renderer.viewLoc, 1, GL_FALSE, rendererInput.view);
    for (struct RendererDrawable *d = rendererInput.drawables; d->vao!=0; ++d)
    {
        glUniform3fv(renderer.movLoc, d->instanceCount, d->mov);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glBindVertexArray(d->vao);
        glDrawArraysInstanced(d->drawMode, 0, d->pointCount, d->instanceCount);
        glfwSwapBuffers(win);
    }
    glfwSwapBuffers(win);
}

Renderer header:
// Renderer public data:
extern struct RendererInput
{
    Vector eye;
    Matrix proj, view;
    struct RendererDrawable *drawables; // terminated by (drawable->vao == 0)
} rendererInput;

extern struct RendererOutput
{
    GLint posLoc;
} rendererOutput;

struct RendererDrawable
{
    GLenum drawMode;
    GLuint vao, pointCount, instanceCount;
    Vector *mov;
};

Drawable setup in engine.c:
void engineInit(void)
{
    rendererInput.drawables = calloc(2, sizeof(*rendererInput.drawables));
    // rendererInput.drawables[0] - the RING, which is being
    // drawn instanced multiple times with different offset (mov)
    rendererInput.drawables[0] = drawableCubeCircle();
    rendererInput.drawables[0].instanceCount = RENDERER_MAX_INSTANCE_COUNT;
    rendererInput.drawables[0].mov[0][0] = 0;
    rendererInput.drawables[0].mov[0][1] = 0;
    for (int i = 0; i < RENDERER_MAX_INSTANCE_COUNT; ++i) rendererInput.drawables[0].mov[i][2] = i;
    cameraInit();
    timerFrameReset();
}

A single ring being renderered correctly:

The issue here is not the ring itself, but their "chaining". As you can see in the pictures, most of the time it works correctly, but sometimes there are distortions. Since I'm not generating a mesh and instantiating them instead, the problem could only lie within:
for (int i = 0; i < RENDERER_MAX_INSTANCE_COUNT; ++i) rendererInput.drawables[0].mov[i][2] = i;
but I don't see it there.

My advice: Try it on a different OpenGL driver by a different GPU brand then make your own conclusions...

While not directly linked to your question, I wanted to suggest that you look into combining your rings together into single meshes, thus reducing the draw calls and total triangles being rendered. You could turn the entire side of that ring into only two triangles, instead of a million.

Also, can we see the way that you're generating these rings? there could be some sort of rounding error taking place.

In the game the pipe will be infinite and you will be traveling through it at a very high speed. The rings past you will be immediately moved to the back of the infinite pipe. What I can do, and am currently working on, is improving the rings themselves, eliminating walls that you can't see from the inside and using indexing.

Welcome to GDSE! Here,if you actually find an answer to your won question, you should write an answer and mark it as accepted instead of adding it to the question post, and renaming the title to 'solved'. You can write an answer to your own question, and mark is as accepted, it's a perfectly acceptable behaviour here :) And in fact, it is what's expected!

Yeah, no problem :) come back in two days if you can. Otherwise, it's no big deal! Thanks for the answer!

I forgot to initialize other offset vector array fields (x and y), leaving them undefined.
Before:
void engineInit(void)
{
    rendererInput.drawables = calloc(2, sizeof(*rendererInput.drawables));
    rendererInput.drawables[0] = drawableCubeCircle();
    rendererInput.drawables[0].instanceCount = RENDERER_MAX_INSTANCE_COUNT;
    rendererInput.drawables[0].mov[0][0] = 0; // <--- all other values undefined
    rendererInput.drawables[0].mov[0][1] = 0; // <--- all other values undefined
    for (int i = 0; i < RENDERER_MAX_INSTANCE_COUNT; ++i)
    {
        rendererInput.drawables[0].mov[i][2] = i;
    }
    cameraInit();
    timerFrameReset();
}

Fixed:
void engineInit(void)
{
    rendererInput.drawables = calloc(2, sizeof(*rendererInput.drawables));
    rendererInput.drawables[0] = drawableCubeCircle();
    rendererInput.drawables[0].instanceCount = RENDERER_MAX_INSTANCE_COUNT;
    for (int i = 0; i < RENDERER_MAX_INSTANCE_COUNT; ++i)
    {
        rendererInput.drawables[0].mov[i][0] = 0; // <--- fixed
        rendererInput.drawables[0].mov[i][1] = 0; // <--- fixed
        rendererInput.drawables[0].mov[i][2] = i;
    }
    cameraInit();
    timerFrameReset();
}


text:
Calculating position to position B with speed
I am trying to find out a formula that calculates the actual position of a player using his speed and a destination position.
These are the informations I have:

Vector3 (X,Y,Z) : Current position
Vector3 (X,Y,Z) : Destination position
float : Speed

I can manage to calculate the angle between these two vectors, but I can't find an efficient formula to calculate the exact position using the speed at each loop. Do you have an idea?
EDIT*
I finally found a formula, but it's not really working as I want...
private void WalkNew()
{
    float speed = 0.1f;
    float distX = this.DestinationPosition.X - this.Position.X;
    float distZ = this.DestinationPosition.Z - this.Position.Z;
    float distance = (float)Math.Sqrt((distX * distX) + (distZ * distZ)); // distance between A and B positions

    float time = distance / speed;
    float currentTime = Time.GetTickFrom(this.lastMoveTime);
    this.lastMoveTime = Time.GetTick();
    float percentage = currentTime / time;

    if (this.Position.IsInCircle(this.DestinationPosition, 0.1f))
    {
        // We arrived
    }
    else
    {
        this.Position.X += distX / percentage;
        this.Position.Z += distZ / percentage;
    }
}

Any thoughts about this formula ?
Thanks

Dividing by a percentage is not appropriate here. Why not use the formula given by Bálint in the answer below? It will work correctly, even with fractional speeds.

You subtract the current position from the destination position, this way you get a vector pointing to the destination.
You need to normalize this vector (divide it with it's length) and multiple with the speed. You get a velocity vector this way.
Finally you add this to the current position to get the new position.
In pseudo code:
currPos += normalize(dest - currPos) * speed

This way you don't need to uses that many costy function, such as atan2, cos or sin, only a square root.

Thanks for your answer, that's much easier than my old formula using cos and sin. Thank you, I still have an other question about the speed. My speed is between 0 and 1 (current speed is 0.1) so I shouldn't multiply but divide the normalized vector right?

@Eastrall Why is your speed between 0 and 1? You generally want to avoid division, because if by any chance speed becomes 0, then it'll probably throw an error

I choose 0 and 1 because I thought it would be simple to implement this kind of formula. Maybe it is better to multiply it by 100 to obtain a % ? like: 0.1 would be 10%; 0 => 0% ; 1 => 100% ; etc...

I've edit my main post with the formula


text:
Saving an array in GameMaker with DS Maps
I have the following issue. I'm creating a game with different levels. When the level is generated, an array of random number is generated for later use.
If the player leaves the game and come back later, I would like the array to be the same. So I'm trying to save the array when the level is generated. I was thinking about using the function ds_map_add_list(id, key, value).
I'm digging through the documentation, but I'm a bit lost and I have a few questions:

How do I create a list from a GML array?
If I create a DS Map with the following function inventory = ds_map_create();, what's the scope of the DS Map? Can I use it only in the object holding the code where it was created?

And why you need to make your array a map?

Is there a more convenient way to store an array?

Depends on what you are storing. May I suggest you to rewrite your question to know which ways you can save in a file your array, and what it is the content?

Use ds_grid for store 2D array or ds_list for store 1D array. Then you can use ds_..._write function for write data to string (and write that string into file, for example).
Many other ways are possible there, but it depend on what exactly you have in array, etc.
Simple example for 1D array.
/// array_write_as_list(array)

var array = argument0;
var data = ds_list_create();
for (var i=0; i<array_length_1d(array); i++)
{
    ds_list_add(data, array[i]);
}

var result = ds_list_write(data);
ds_list_destroy(data);
return result;

And usage of it:
var s = array_write_as_list(your_array);
// now you can write "s" to file, etc

For reading need to use similar way.

what's the scope of the DS Map? Can I use it only in the object holding the code where it was created?

Any data structures ds_... are global (and you need don't forget to destroy them, when it not need more), but variable, where you stored id of data structure, has own scope. For example, if you use var data = ds_list_create() then you can use data variable only inside current script (and you should destroy this data structure, otherwise there will be memory leak). If you use data = ds_list_create() then you can acces this data structure from any object, using data variable, like ds_list_add(obj_enemy.data, 100);, etc.

I needed something similar when I was collaborating with a friend on a simple shmup.  I was doing development and he was doing design.  I exposed various game constants in a plain-text .ini file.  He could edit them and modify the feel of the game without having to recompile the code.
I came to the same conclusion you did: I used ds_map.  Basically, on startup, my game would run scr_readIni.gml, which set a bunch of variables.  Here's an example:
globalvar options;
options = ds_map_create();
ds_map_add( options, "acceleration", "2.5,2.5" );
ds_map_add( options, "maxspeed", "4.0,4.0" );
ds_map_add( options, "subBeatFirePoints", "0.25,0.75" );
ds_map_add( options, "xPixelOffset", "-24,-24" );
ds_map_add( options, "yPixelOffset", "-24,+24" );

I scoped options as a global variable so that the appropriate game objects had access to it.  There's probably a more elegant method -- there is in most object-oriented languages -- but this was the approach I settled on.
After these variables were set, I'd check for the existence of my .ini file.  If it existed, I'd overwrite the variables I had just set with the ones stored in the .ini file.
if( file_exists( global.configFilename )){

    ini_open(global.configFilename);

    // Read variables : OPTIONS
    // (e.g. movement, allowed firing subbeats, etc.)
    ds_map_replace( options, "acceleration", ini_read_string( "options", "acceleration", options[? "acceleration"]));
    ds_map_replace( options, "maxspeed", ini_read_string( "options", "maxspeed", options[? "maxspeed"]));
    ds_map_replace( options, "subBeatFirePoints", ini_read_string( "options", "subBeatFirePoints", options[? "subBeatFirePoints"]));
    ds_map_replace( options, "xPixelOffset", ini_read_string( "options", "xPixelOffset", options[? "xPixelOffset"]));
    ds_map_replace( options, "yPixelOffset", ini_read_string( "options", "yPixelOffset", options[? "yPixelOffset"]));

    ini_close();

    return true;

// If .ini file doesn't exist, just return (default settings set above)
} else {

    return false;

}

Note that I ended up storing my arrays of reals as a string.  When I needed to use them again, I split the string by commas and cast them to reals via a function:
// ds_list_to_reals( input ds_list )
//
// Goes through each item and casts it to a real

inDsList = argument[0];

var i;
for( i = 0; i < ds_list_size( inDsList ); i++ ){
    ds_list_replace( inDsList, i, real( ds_list_find_value(inDsList, i) ) );
}

return inDsList;

If I had occasion to revisit this project, I'd probably try to update my code to match the approach taken by Dmi7ry in the other answer.
One last note: if you're interested in saving space, you could simply save the number you're seeding the random number generator with.  Then, if you reseed the random number generator with the same number on the next startup, it'll generate the same sequence.  Here's a snippet from the official docs:
ini_open("Save.ini")
ini_write_real("Levels", string(level), random_get_seed());
ini_close();

The methods to research are random_get_seed and random_set_seed.


text:
Must I display Health and Mana to the player?
I'm thinking of doing one or more of the following:

hiding the player's Health
hiding the player's Mana
hiding the player's Health from other players
hiding the player's Mana from other players

I don't know of any game that has done such things before so I'm wondering if this will have a positive effect on the players and why no game has done so before.

Why do you want to do that? What exactly is the game experience you want to achieve that way?

Simplicity. The player can focus on the battle (it's a 1v1 pvp game). Less cluttered screen.

Depending on your game, tactics may change based on the player viewing these numbers, therefore it may not be a good idea to hide them completely. You could perhaps have them visible for a short time when damage is taken or mana is used? It then becomes part of the game - the player has to pay attention to the values when they appear.

Several games exist that don't display a health count or bar, but instead give some other form of visual feedback when the player is injured; e.g. by tinting the screen progressively stronger shades of red as you take damage.

Does dead space's health on the spine armor count as hidden?

@Bálint I would say yes. Dead Space's UI is so well done. It's almost like an HUD but in game but it really fills as part of the game.

Hiding the player-character's (PCs) health actually got quite common in the FPS genre. Instead of showing a health number on the bottom of the screen, they represent the health state of the PC with a meta-interface. When the player is hurt, the screen gets a red tint or gets splattered with blood. This represent the pain the PC is experiencing.
The idea behind this is to make the game more immersive. Numbers on the user interface are often considered immersion-breaking because they are inherently non-diegetic. This is why some game designers try to minimize them as much as possible.
But hiding the exact health value is usually combined with quickly auto-regenerating health. The player doesn't need to know the PCs exact health, because it recovers so quickly anyway. But without quick health generation, health becomes a resource the player needs to manage. In order to manage a resource properly, the player must be able to check the exact number at any time.
Also, you must not forget to give some visual cue about the health state of the PC. When the player is completely unaware of it, they might not realize that their PC is almost dead, make a risky decisions and be surprised why they died so easily. This will be very frustrating for the player and might cause them to wonder if your damage calculation mechanics are buggy.
The same can be applied to mana. Provide some visual cue for the player how much mana their PC approximately has at the moment. Also, just like health, you should only do this when mana regenerates extremely fast. When mana is a resource the player needs to manage strategically, hiding it will be quite annoying for them.
Regarding hiding the opponent's health and/or mana: This is really just a question of how much information you want to hide. It is not uncommon for games to completely hide the enemy condition until they are defeated, but there are plenty of other examples of games which make the enemy condition transparent. Showing this information makes the game a bit more tactical (because the players have more information about who is currently winning a fight), while hiding that information makes the game more psychological (you have to guess the other character's status from the player behavior).

I still don't understand how blood splatters make the game more immersive. I don't think getting a hit in the leg gets blood on your eye

Do you have any examples of games that hide the opponent's condition?

@SupremeGrandRuler Pretty much every first person shooter I can think of. But maybe we are not thinking about the same genres of games.

@Philipp Ah true. I wasn't thinking about FPS. Any other genre, like RPGs?

@SupremeGrandRuler Most single player RPGs I can think of also usually hide enemy health. In the MMORPG genre it became general convention to give a health bar to mobs and sometimes also to opponents in PvP. But that wasn't always the case. The first MMORPG I ever played (Ragnarok Online) had no health bars for opponents, neither mobs nor in PvP.


text:
Make a 2D tile map from isometric tile
So I have an isometric tile ( PNG ) and I was wondering how can I make a 2d tile map from it. I am using Unity.

It is definitely possible. You just have to have some method of converting from 2D coordinates to 2.5 coordinates. Usually this is done using an isometric projection matrix like so: http://www.petercollingridge.co.uk/interactive-svg-components/isometric-projection
This is the method that the isometric toolkits on the asset store use, like : https://www.assetstore.unity3d.com/en/#!/content/27851
and
https://www.assetstore.unity3d.com/en/#!/content/33032
Another common method is to work in 3d space and just adjust the camera so that everything appears isometric.

i don't think that's possible. AFAIK isometric is still just 2d just drawn from a different perspective. You'd have to draw the tiles again from the other perspective to change that