How can I organize tiles in a tileset? - unity3d

I am trying to follow the tutorial for a dungeon RPG, which involves creating a tileset.
As part of this (bookmark to exact time in video (edit: thanks, corrected)) in the video it's possible to move around tiles into separate folders. I am trying to re-create this on Unity 2022.2.0.a14.2406, and I don't seem to be able to do this: Whenever I move around tiles (from a tileset) to other folders in my assets, I end up moving the whole tileset (see image below, with the left-arrow linking to the tileset). This of course prevents me from splitting up tiles, e.g. into categories like players/walls/etc.
How would you do this? I also tried using tags, but they seem to have the same issue - they get applied to all tiles in a tileset.
Edit: Example with multiple tiles (showing the first few) extracted via 'sprite editor => slice/automatic'. It's 256 tiles, so to use them it'd important to have some way to group these tiles.

I bumped into a similar situation, and solved it rather naively by firing up Paint.NET to edit the gigantic sprite sheets I had found online into smaller similar ones for the different types of terrains, and making a distinct PNG for each character and game object.
Good naming is critical: use a short but descriptive name for each PNG, so it imports and breaks down into say Torch_0, Torch_1, etc. and Castle1_0, Castle1_1, BlueBlobBaddy_0, etc.; have all the sprites needed for a given terrain type in the same import file, import them into dedicated folders/subfolders, then splice them into tiles.
It's honestly quite a lot of work, but it's well worth it in the end.
I'm hoping this post will honor the age-old rule "if you want to learn how to do something, post the wrong way to go about it online" and will prompt a better, not-so-naive approach to this problem which I presume everyone working with 2D tilesets in Unity has encountered.

Related

minecraft: How to get coordinates of blocks inside selection

For a Loot Plugin i need all the coordinates of chests in my prebuilt world.
To add them to the plugins config. I am not programming the plugin, i am just using it, i just need a way to get multiple coordinates for specific blocks in a world.
OR
If it is possible to use worldedit and replace chests with chests that have nbt tags i can completely skip the plugin part and use the vanilla loot tables. But i haven't yet found a way to setblocks with nbt data using worldedit.
I was thinking about downloading the map moving it into mcedit or worldpainter and hopefully find a way there to export the coordinates of each chest.
I'm looking forward for some solutions, and i'm thanking you in advance!
If you have to prepare this world initially and only once, I would recomment to use a plugin to identify all the chests in the world (e.g. by iterating through all already generated chunks and all containing blocks), and modifing or saving them, the way you need to. Doing this on a productive server will probably cause lags, cause the iterating/searching will be very intensive.
You could also think about some kind of hacky way, to identify if the blocks are placed by the world generator/a plugin or a player. When u use the plugin LogBlock, you can check, if the clicked chest was placed by a player. If so, treat this chest as a normal chest, otherwise, if no player has ever placed a block at this location, treat the chest as a chest from the "loot plugin".
Any of the ways will work, but the first one will probably be a little harder, since you have to manually load all the chunks. The second is a little bit hacky, but will be more easy, but maybe not compatible to your setup.

Draw curved lines with texture and glow with Unity

I'm looking for an efficient way to draw curved lines and to make an object follow them in Unity.
I also need to draw them using a custom image and not a solid color.
And on top of that I would like to apply an outer glow to them, and not to the rest of the scene.
I don't ask for a copy/paste solution for each of these elements, I list them all to give some context.
I did something similar in a web app using the html5 canvas to draw text progressively. Here a gif showing you the render:
I only used small lines to draw what you see above. Here a very big letter with thinker lines so lines are more visible:
Of course it's not perfect, but the goal was to keep it simple and efficient. And spaces on the outer edges are not very visible in normal size.
This is used in an educational game working on mobile as a progressive app. In real world usage I attach a particles emitter to it for better effect :
And it runs smoothly even on low end devices.
I don't want to recreate this exact effect on Unity but the core functionality is very close.
Because of how I did it the first time, I thought about creating a big list of segments to draw manually, but unity may have better tools to create this kind of stuff, maybe working directly with bezier curves.
I a beginner in Unity so I don't really know what is the most efficient way to do it.
I looked at the line renderer which seemed (at first) to be a good choice but I'm a little bit worried about performances with a list of 500+ points (considering mobiles are a target).
Also, the glow I would like to add may impact on the technique to choose.
Do you have any advice or direction to give me?
Thank you very much.

Unity large,dynamic tile map

I'm thinking of making city transport simulation game, based on tile map like simcity. Because transportation is the main component, I'm not gonna describe city thoroughly, like drawing all the buildings or others. But I need to divide the city to districts and villages.
I want them to be generated randomly, based on tile map system - Actually this doesn't have to be tile based, but I don't have any better idea to generate randomly divided districts.
The problem is there are literally to many tiles. Of course I won't make all the tiles to GameObjects, but array storing the information of tile just gets like 4000x3000 (for 12,000,000 tiles). Is it okay? I think this will seriously slow down the game.
I searched for many ways to generate tile maps, but those tile maps are for RPGs.. they are just sprites and background.
My tiles should change dynamically(maybe the colors, and I'm making the game with 3d so maybe the tile can have height that may change), with showing the status of that tile(a small region of the city). What will be better way for my needs?
Thank you!
The short answer is that you should generate a mesh to represent your tiles. This will allow you to represent a large number of tiles as a single game object.
It is not as troublesome as it sounds. I actually went through this myself recently, and have written a step-by-step guide on how to do it, and how to solve a host of other issues I ran in to working with tiles:
http://matthewlynch.net/2017/02/19/efficient-artefact-free-2d-tile-mapping-in-unity-5-5/
The only caveat I would mention (this is discussed in the tutorial, but not directly addressed) is that you should still divide your map up in some way.
I would not recommend exceeding 100x100 tiles in a single mesh, and in fact would recommend breaking it up even further. But once you get the basics of tile->mesh rendering up and running, this is not difficult to do.

Rendering a 3D object from four different angles

I am working on a project where I have to render 4 different sides of a 3D object at the same time on the screen. The output should have 4 different camera outputs rendering the front side, left side, right side and back side of the 3d object.
I found that a gaming engine like Unity may help to do something like this. However, I have just started using Unity and can't figure out how to do it.
Here is the link for some examples. This is how I want the output to look like
Well first of all, welcome to Stackoverflow. And you are right, Unity is an excellent IDE to achieve what you described.
As stated in the FAQ and here, I'm going to give you an answer I deem fitting to your question. I can post the code here in about 30 minutes which does exactly what you asked for, but then we'd miss the point of learning to program and posting at StackOverflow in general. I'll show you the way on how to start on this project, but then you'll have to try yourself. If you have any troubles after trying some more, we can help you with specific problems, provided you have researched some before and show us what you tried.
As to your question, it's relative easy to do so. First create your object in the scene, then drag and place four different Camera-objects in the screen. Using the Camera's Normalized View Port Rect (Four values that indicate where on the screen this camera view will be drawn, in Screen Coordinates (values 0-1)), you can then split up the view to show the feed of each Camera.
This ofcourse happens in a script. You can read here about Scripting in Unity. Even if you are an expert in programming, that link is worth a read when you are new to Unity.
Good luck.

compare one image in matlab with a database of images and show the most similar

I have a database of images of one person who is using his hands to show various words and phrases in sign language. The background is white and the only thing changing is the shape of the person's hands and their locations. Now in my gui in matlab, I want the user to be able to choose another image from the same person that was taken at another time doing a sign but wearing the same clothes and then the program will have to compare this against the images in the database and show the most similar. Obviously I can't do pixel by pixel comparison as the images were taken by a hand held mobile camera and slight movement has been inevitable so I should try and locate the hands in the images and compare their shapes. I have no idea how to go about this? I have to say I am new to image processing toolbox in matlab.
Your help is much appreciated
I am doing a phD in computer vision, and I can tell you that it is an unsolved problem. (even in your simple framewrok, with white background)
If you are interested, you might read some works about it ar MIT:
http://people.csail.mit.edu/rywang/handtracking/
or at Oxford:
http://www.robots.ox.ac.uk/~vgg/research/sign_language/index.html
http://www.robots.ox.ac.uk/~vgg/research/hands/index.html
I disagree with you. Such a project can achieve results quickly.
This becomes a problem as soon as the project has to deal with "real life".
Using a single camera, and a completely known background; Opencv provides a simple way to extract hand shape in a image (in about 20 lines of code). You will find plenty of source on the web (have a look at calcbackproj).
After that, what you will have to do is to play with shape, and search for characteristic points.
Begin with some simple signs (example : a circle and a V). How would you recognize one from the other?
There are thousands of papers on sign language; just read the older one to simple ideas flowing :)