Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - ComputerNerd

Pages: [1]
1
Support / Sharing assets among multiple sprite collections
« on: May 11, 2018, 03:41:01 pm »
Hi,

I am building a moderately large game (think Secret of Mana-like). I am building my tile maps in Tiled, then importing them into the 2D Toolkit's Tilemap.

I have the sprite collections split up to one per area due to the sheer size of them and the large number of areas - it is simply impossible to combine them all into one. The issue I am having is my build size is getting too large due to the large number of duplicated tiles spanning across the different atlases. For example, most of the atlases have a copy of my water tile set. And my shadow tile set. And so forth. Tiled is ok with this structure, but the SpriteCollection's atlas always wants to duplicate the shared tiles since they are in a different SpriteCollection.

Is it possible for the tile map or sprite collection to reference shared atlases? Am I making sense?


Thank you,
Brian

2
Support / Sprite Collection corruption
« on: October 01, 2016, 12:58:46 am »
Hi,

Over time, my Sprite Collections become corrupted.  I am unsure how this happens as I do nothing extraordinary.  I don't even notice that something is wrong until I see that the sprite is no longer working so I can't pinpoint when and how it actually happens.  I was wondering if you had some ideas on this, why it may happen, and how to fix this without recreating the whole sprite collection and sprite animations.

It seems to gradually infest all of my sprite collections at some point.



As you can see, this sprite sheet frame is connected to the wrong sprite.  On most spritesheets in this corrupt collection I am unable to click on a frame at all in the Sheet's middle view where it groups them all.

If I click on Config->Apply, it creates a second set of sprites, as so:


This isn't ideal since I lose important data like anchor points.

Oh, the sprite animations connected to these corrupt sprite collections also become corrupt.



Any way to easily correct this?  Thanks!  I am using 2.5.4.

3
Support / TileMap high disk space usage
« on: August 01, 2016, 01:08:00 am »
Hi,

I have a concern about disk space usage with the TileMap.  Specifically, it is with the TileMapData asset.  I am not using Prefab placeholders, but the 2D Toolkit fills in the prefab list anyway by default - with a lot of data.

http://imgur.com/a/T6ffN


As you can see, a list got generated by the TileMap with 2,444 empty game objects.  For one single scene.  This causes the asset to balloon 40 KB.  It may not sound like much, but my game will have north of 400 scenes.  It has now become a 16 MB problem.  Instead of defaulting this serialized field to max tile count, I was wondering if you could work in an update that would only populate this list as needed.


Thank you,
Brian

4
Support / Animated tiles and a suggestion
« on: June 11, 2016, 08:44:51 am »
Hi,

Great tool!

I spent some time agonizing over the pain of implementing animated tiles to complement my game.  I saw your suggestion about using materials, and decided that that is the best approach, although it had some drawbacks.

Due to the heavy use of animations in my game, each tile set needed quite a few Materials made.  This is where I ran into problem number 1.  Adding a new material performs a Commit.  Each commit takes five minutes, so adding 20 materials takes quite a long time.  My suggestion here is to remove the automatic Commit when adding a material since you need to still perform some work before you do your real Commit.  I tested out this theory and everything works fine.  You can also probably remove the automatic commit when deleting a material.

Then problem number 2 came.  Animated tiles' materials' textures don't normally have the same UV coordinates as the tile set.  Modifying material tiling and offsets seemed kind of hacky and didn't solve some of my issues.  There is no great solution to this problem, but what worked for me is to keep it simple and allow the Sprite Collection to store custom UV values - only when doing additive materials - and let the Material and Shader do the rest.  I think this solution would work for most use cases.

Which leads me into problem number 3.  I am now stuck in my current version of the 2D Toolkit.  Unless you were kind enough to consider implementing a UV solution similar to mine...

My main goal was not to touch tk2dSpriteDefinition.  Here's my code.

Class: tk2dSpriteCollectionDefinition
Added public fields:
    public bool UseCustomUV = false;
    public Vector2[] CustomUV = new Vector2[] {new Vector2(0,0),
                                               new Vector2(1,0),
                                               new Vector2(0,1),
                                               new Vector2(1,1)};
    public Vector2 UvOffset;
   
   
Function: CopyFrom
Added:
        CustomUV = src.CustomUV;
        UseCustomUV = src.UseCustomUV;
      

Class: tk2dSpriteCollectionBuilder
Function: UpdateVertexCache
Code location: Directly above the line:
coll.spriteDefinitions.normalizedUvs = CalculateNormalizedUvs(uvs);
Code:
   if (gen.textureParams.UseCustomUV)
   {
      coll.spriteDefinitions.uvs = gen.textureParams.CustomUV;
      for (int l = 0; l < coll.spriteDefinitions.uvs.Length; l++)
      {
         coll.spriteDefinitions.uvs[l] = coll.spriteDefinitions.uvs[l] + gen.textureParams.UvOffset;
      }
   }
            
And then the Editor changes.
Class: tk2dSpriteCollectionEditorSpriteView.cs
Function: DrawSpriteEditorInspector
Code location: Just after the Material popup.
Code:
   param.UseCustomUV = EditorGUILayout.Toggle("Custom UV", param.UseCustomUV);
   param.CustomUV[0] = EditorGUILayout.Vector2Field("uv1", param.CustomUV[0]);
   param.CustomUV[1] = EditorGUILayout.Vector2Field("uv2", param.CustomUV[1]);
   param.CustomUV[2] = EditorGUILayout.Vector2Field("uv3", param.CustomUV[2]);
   param.CustomUV[3] = EditorGUILayout.Vector2Field("uv4", param.CustomUV[3]);
   param.UvOffset = EditorGUILayout.Vector2Field("uvOffset", param.UvOffset);

Note: When it is placed in this location, it will only show if the user is using multiple materials.


Thank you for the great tool!

Pages: [1]