I am making a big open world game where the map is hand drawn.
The dimensions of the map are 12800x3840.
Thus I have made world-tiles 1280x768 ( having 20x12 64x64 tiles )
My initial approach is to draw 9 world-tiles which are around the player. I also want my collision system to work on a tile based approach where i have a 20x12 2 dimension array. Is this the right way?
How do I do this in Unity? What objects do I use?
I used X-UniTMX to very good results on a tile based strategy game I'm working on. First you create the map using Tiled then you can import it using this software.
Tiled:
http://www.mapeditor.org
X-UniTMX:
https://bitbucket.org/Chaoseiro/x-unitmx/wiki/Home
Related
I am building a (2D) plotting application using Unity.
The data is generated (and updated in real time) from an outside library. I am using a LineRenderer to display the data.
This is working really well, but now I am trying to also add points/circles at the positions of the LineRenderer.
Because the LineRenderer contains a lot of points (which are also updated every frame), instantiating/pooling GameObjects at the LineRenderer positions is of course extremly laggy.
What would be a good solution to my problem?
Right now I am thinking there are two possibilities:
Pass the LineRenderer data as a 2D array to a vertex shader every frame
Draw a texture every frame that contains the positions of the LineRenderer
Is one of the two approaches superior in terms of performance? Also, is there another approach that I am not aware of?
Thank you very much!
So I was wondering how can I make a Line Renderer between to points (joints) be a 3d model or at least how can I make a separate 3D model to follow the movement of the line renderer.
I have an AR project where, for a finger there is two points calculating the width of the finger and then a Line renderer comes in as a "ring" for the finger. And i was wondering how can make it a real ring by adding a 3D model
As a mesh for such a "ring" would be called a "torus". Someone apparently made a neat script to generate those: https://www.devcoons.com/how-to-make-a-ring-using-torus-method-in-unity-3d/
Keep in mind that generating meshes is not super fast. So try to generate one at game start and scale in case you neeed it with different dimensions.
EDIT: This could be also interesting and more flexible: https://wiki.unity3d.com/index.php/TubeRenderer
I'm a complete noob in gamedev, but I've watched a number of videos on generating a 2D array to setup Grid-based combat (pathing, obstacles etc), and I don't find the programmable approach intuitive or visually friendly.
Is it possible to setup such level with obstacles using multiple tilemaps?
1st tilemap would include the whole level zone (I named it "General Tilemap"):
2nd tilemap would only contain tiles that would be marked as collision when being read (I named it "Collision Tilemap") and player wouldn't be able to move to them:
My logic would be to read the adjacent tiles around the player, and if:
A tile exists on the General tilemap, but not on the Collision tilemap, player can click it and move there.
A tile exists on both tilemaps, it is marked as collision, it cannot be clicked.
A tile doesn't exist, it is out of boundaries, it cannot be clicked.
Could you please let me know if this is a valid approach (for smaller levels at least, I won't be making anything large so scalability is not an issue), or have I gone completely off course and there's a superior way to do this properly?
I'm currently stuck at the very first step - reading whether the tile on a coordinate (next to player) is existing or null for both tilemaps. Doing my best to figure it out though.
Thanks!
Managed to check if tilemap contains a tile on xy coordinates in Start function, by finding the relevant Tilemap and using hasTile to read it it has value or not. This returns a boolean.
Tilemap generalTilemap = GameObject.Find("General Tilemap").GetComponent<Tilemap>();
hasGTile = generalTilemap.HasTile(playerTileCoord);
Still not sure if this approach will work for me long-term, especially when I get to the pathfinding algorithm, but we'll see!
I am currently developing an asteroid mining/exploration game with fully deformable, smooth voxel terrain using marching cubes in Unity 3D. I want to implement an "element ID" system that is kind of similar to Minecraft's, as in each type of material has a unique integer ID. This is simple enough to generate, but right now I am trying to figure out a way to render it, so that each individual face represents the element its voxel is assigned to. I am currently using a triplanar shader with a texture array, and I have gotten it set up to work with pre-set texture IDs. However, I need to be able to pass in the element IDs into this shader for the entire asteroid, and this is where my limited shader knowledge runs out. So, I have two main questions:
How do I get data from a 3D array in an active script to my shader, or otherwise how can I sample points from this array?
Is there a better/more efficient way to do this? I thought about creating an array with only the surface vertices and their corresponding ID, but then I would have trouble sampling them correctly. I also thought about possibly bundling an extra variable in with the vertices themselves, but I don't know if this is even possible. I appreciate any ideas, thanks.
This question is (mostly) game engine independent but I have been unable to find a good answer.
I'm creating a turn-based tile game in 3D space using Unity. The levels will have slopes, occasional non-planar geometry, depressions, tunnels, stairs etc. Each level is static/handcrafted so tiles should never move. I need a good way to keep track of tile-specific variables for static levels and i'd like to verify if my approaches make sense.
My ideas are:
Create 2 Meshes - 1 is the complex game world, the second is a reference mesh overlay that will have minimal geometry; it will not be rendered and will only be used for the tiles. I would then Overlay the two and use the 2nd mesh as a grid reference.
Hard-code the tiles for each level. While tedious it will work as a brute force approach. I would, however, like to avoid this since it's not very easy to deal with visually.
Workaround approach - Convert the 3d to 2D textures and only use 1 mesh.
"Project" a plane down onto the level and record height/slope to minimize complexity. Also not ideal.
Create individual tile objects for each tile manually (non-rendered). Easiest solution i could think of.
Now for the Unity3D specific question:
Does unity allow selecting and assigning individual Verts/Triangles/Squares of a mesh and adding componenets, scripts, or variables to those selections; for example, selecting 1 square in the 10x10 unity plane and telling unity the square of that plane now has a new boolean attached to it? This question mostly refers to idea #1 above, where i would use a reference mesh for positional and variable information that were directly assigned to the mesh. I have a feeling that if i do choose to have a reference mesh, i'd need to have the tiles be individual objects, snap them in place using the reference, then attach relevant scripts to those tiles.
I have found a ton of excellent resources (like http://www-cs-students.stanford.edu/~amitp/gameprog.html) on tile generation (mostly procedural), i'm a bit stuck on the basics due to being new to unity and im not looking for procedural design.