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.


Messages - Quells122

Pages: [1] 2
1
Thanks! Turning on normal generation seems to have done the trick. The tilemaps now respond to light and is evenly lit with other sprites.

I am curious what normal generation does and if there are any disbenefits to having it on? It seems to run with the same stats as before...


2
Unfortunately, changing to other modes like deferred does not work any better (it was on forward initially).

What seems to have "sorta" work, is if I change the tilemap's atlas material shader to "Sprites/Diffuse". However, it introduces another problem. The tilemap and the sprites are no longer evenly lit. Either the character is lit or the tilemap is lit. Animated tiles such as water need to be evenly lit with the tilemap or else they stick out like a sore thumb. Is there anything else I can do?





3
Yes. I re-imported the latest 2D toolkit from the Asset Store

4
Recently, I was able to become an approved developer for a console (not sure if NDA'ed). In order for my game to be console compatible, I had to update my Unity version from 4.6.0 to 5.0.1.

Sadly changing versions seems to cause me problems with the tilemap lighting. I've attached a picture to demonstrate what I mean:

The tilemaps use the shader "tk2d/LitBlendVertexColor".

Is this a known issue? Any idea on how to fix? Help is greatly appreciated!


5
Support / Re: Need help binding a camera within the playing area's limits
« on: January 14, 2015, 06:05:23 am »
Thanks! ScreenExtents was exactly what I needed.

What about the camera's orthographic size? Changing it doesn't seem to do anything. Does it not matter what that is set to?

6
Support / Need help binding a camera within the playing area's limits
« on: January 13, 2015, 03:14:42 am »
I'm using a tk2D camera, and I'm trying to bound the camera view within the game's map area. The game doesn't follow pixel perfect snapping rules and the tricky part is that the camera is allowed to zoom in and out.

I found this link online that recommends using a camera's orthographic size property. However, I noticed that a tk2D camera doesn't change its orthographic size property with the zoom level.
the link-> http://answers.unity3d.com/questions/501893/calculating-2d-camera-bounds.html

I'm wondering if the tk2D camera has some functions that lets me query the state of the camera's field of view since orthographic size seems unavailable.

On a side note, I noticed that orthographic size is set to 480. My game uses tiles that are 16x16 pixels. Is 480 orthographic size too big? Changing it doesn't seem to have any visible effect on the game...

7
Thanks for the advice! I was able to get it working :)

8
Thanks for the idea! I was eventually able to find the relevant chunks and change the sorting order after some trial and testing.

One thing that threw me off for a while, was the number of "Chunks". Each layer strangely had 80 chunks, many of which were duplicates. The tilemap is 128x128 tiles and each chunk is 32x32, so there should only be 16 chunks per layer. These chunks didn't seem to be used at all by the game. Initially I was grabbing these chunks and changing their mesh renderer's sort properties, and nothing would happen. Eventually I realized that when I started the game, new chunks were created and these "junk" chunks really weren't used at all. Is this a known issue? What causes these unused chunks to show up?

The other issue that concerns me is if I need to worry about refinding chunks? It seems like it would be possible to store the chunks in an array, and then go through them and change their MeshRenderer properties when I need to change their layer order. However, I'm not sure how these chunks are managed. Are new ones continually created so I should go and refind the chunks? Or are they reused?

9
Is there a way to expose the sorting layer and sorting number for tilemap layers so they can be changed via script?

I create my levels at runtime. Some levels have more layers of background tiles than foreground tiles and vice versa, so it would be really helpful if I could change a layer's orientation to BG or FG depending on where the need is.

10
Support / Re: How to apply darkness to tilemaps via code?
« on: October 01, 2014, 04:50:23 am »
Thanks for the help! I think I was confused, but I understand now. I was actually thinking of dynamic lights, however I can see some useful functionality coming out of vertex painting so I'm glad I asked :)

For posterity sake, if someone is after dynamic lights, I used these two topics:
http://2dtoolkit.com/forum/index.php?topic=1422.0
http://2dtoolkit.com/forum/index.php?topic=1080.0

11
Support / Re: How to apply darkness to tilemaps via code?
« on: September 29, 2014, 07:05:40 pm »
Sorry, can you explain in more detail how this can be done? I've tried using tilemap.ColorChannel.SetColor(tileX, tileY, Color), but I keep getting DivideByZeroExceptions. The culprit is "divX" inside SetColor function of tk2dTileMapChunks script. I've tried setting the color channel before and after my build call, but to no avail.

This is how I draw to the tilemap currently.

Code: [Select]
    private void _DrawTileLayer(string zlib_64_data, int layer_index) {
        byte[] raw_data = Convert.FromBase64String(zlib_64_data);
        Stream data_s = new MemoryStream(raw_data, false);
        Stream data = new Ionic.Zlib.ZlibStream(data_s, Ionic.Zlib.CompressionMode.Decompress, false);
        using (var binary_reader = new BinaryReader(data)) {
            int tile_map_height_index;
            for (int h = 0; h < curr_level_height; h++) {
                tile_map_height_index = tile_map.height - 1 - h; // Some math. TMX counts tiles with top == 0. 2DTK counts with bottom == 0
                for (int w = 0; w < curr_level_width; w++) {
                    uint tile_gid = binary_reader.ReadUInt32();
                    if (tile_gid == 0) continue;
                    tile_map.SetTile(w, tile_map_height_index, layer_index, (int)tile_gid - 1);
                    //tile_map.ColorChannel.SetColor(w, tile_map_height_index, Color.blue); Here, this line causes a DivideByZero exception
                    tile_map.SetTileFlags(w, tile_map_height_index, layer_index, TILE_FLAGS_MAP[tile_gid >> 29]);
                }
            }
        }
    }
After which I call tilemap.Build(). Can you also explain what it means to calculate falloffs?

Also is "vertex painting" the only method to make the tilemaps react to lights? Or is there some other preferred way? Thanks!

12
Support / How to apply darkness to tilemaps via code?
« on: September 29, 2014, 03:35:59 am »
I'm using the tilemap class and constructing levels during run time since some levels are randomly generated. I've had success constructing the tilemaps using tilemap.SetTile(), and then using tilemap.Build().

However, now I'd like to have darkness in the scene and I'd like to have the tilemaps react to lights. It looks like tilemap has the functionality (according to this tutorial: http://2dtoolkit.com/docs/latest/tilemap/tutorial.html) but I am confused as to how this can be done via code. Help would be greatly appreciated!

13
I'm currently using TD2K for the tiling. I'm now at animating 2D sprites for characters and am wondering what are the pros and cons of using Unity 4.3's native animation system vs 2DTK's. Are there any major advantages one has over the other?

For sprites, big boss characters will be big and use a skeleton and rig. Other smaller characters will simply use a cut up sprite sheet and a box collider. Should the animation system I use change between these two situations?

14
I see. So it's not possible.

Multiple layers it is then. Thanks!

15
I know that this can be achieved with multiple layers. I'm specifically asking if it's possible to achieve this with just one layer? I'd like to call td2kTileMap.SetTile without clearing away the previous graphic to achieve this effect.

Correct me if I'm wrong, but TD2K is drawing to a texture, so would it not be possible to draw to the texture but not erase what was already on the texture - as in just draw over the texture?

Pages: [1] 2