Z Smart Tiles!

Remember that thing I said about the 2×2 sprite implementation being less efficient than the shader implementation… well…

Turns out that’s not actually true. ¬†I did a comparison, and, as it turns out, the 2×2 sprite implementation is better, even though it uses more tris because the 2×2 sprite implementation allows using a sprite sheet (via the Sprite Packer), which means all the sprites actually use the same draw call ūüėČ

(And just to make sure, I made, like 1024 of each type and checked the frame rate. ¬†Honestly, I hope no one makes a tile map with that many tiles…)

With that in mind…ūüéȬ† I SUBMITTED Z SMART TILES TO THE ASSET STORE!¬†ūüéČ

Based on a suggestion from a friend, I also made a “how to” video:

I guess now I just wait for the approval process. ¬†In any case, it feels real real good to have submitted, and I’d like to make a habit of this.

Something that this process reminded me was that publishing is more important than making something perfect (and also I was perhaps because I’ve been giving this same advice in the class I’m teaching ;p ¬†I should take my own advice).

I spent a lot of time stressing over doing things “the optimal way” when really I should have just been pragmatic about it. ¬†Stressing about doing stuff right can lead to that whole development-in-a-vacuum thing, and I’m always allowed to update.

Of course I don’t want to put out something that is low quality, but I also don’t want my projects to die in that bin of “I never got it good enough.”

That’s pretty much all for this week.

Next up, fixing Floral Kombat.

Until next time,

~Zach

2×2 & Shaders

I’ve realized I’ve been really into ampersands recently. ¬†For titles anyway. ¬†I dunno, they just look efficient.

What did I do this week though?

Weeeeeell…

I knock optimization a lot, and, like, for the most part, I think I’m pretty right to do it. ¬†Like, premature optimization is the root of all evil and all that, though it’s important when the code’s causing actual problems.

I got to have fun with efficiency this week, YAY!

Well, okay, not entirely.

The idea for the Smart Tile package I’m building is to allow people to create Tile prefabs that they can drag into any scene, and that will respond accordingly to have their sprites match up, given a few input sprites.

The flow I want for people building tile maps is kinda like this:

  1. Create a tile prefab.
  2. Copy that tile prefab or drag out a new one.
  3. Magic.

That works for the most part:

Jul-31-2016 18-57-49

It even works with the 2×2 implementation I changed it to to allow concave corners!

Screen Shot 2016-07-31 at 6.59.39 PM

(trust me, that there is a concave corner sprite…)

However… the way I implemented it at first didn’t scale well with lots of tiles. ¬†There was… pretty significant lag, and this was exaggerated when I changed to the 2×2 implementation.

Each tile is (at least) one Game Object (I this is the root of another problem, which I’ll describe at the bottom), and I was calling probably the worst function I possible could to get all the tiles: GameObject.FindObjectsOfType<>()… which is O(N x M), where N is the number of Game Objects in the Scene, and M is the number of components on a given Game Object… like, real real bad.

Also, I was kinda calling the map update once for every tile I was moving, so it worked fine while dragging one tile around, but got real real sluggish when dragging lots of tiles.

SO! ¬†I changed the implementation to store each new ZAT_SmartTile (the name of the tile component) each time I add a new one to the Scene, and to remove it when it’s destroyed! ¬†I also fixed that issue with multi-updating, so now there’s only one update called per group! ūüėÄ
Jul-31-2016 19-09-09.gif

Still though… because there are so many Game Objects…

Screen Shot 2016-07-31 at 7.11.35 PM.png

There are a lot of triangles… To give a comparison, a blank Scene would get me, like, 300 FPS…

This is sorta a problem I should solve, because tile maps should be allowed to be big.

In order to solve this, I may go back to some stuff I did this week that I thought was kind of a waste of time, even though it was a lot of fun…

SHADERS!

Man, I could spend hours on these.  I did, in fact.

I spent a lot of time adjusting stuff, but mostly, being bad at math.

Jul-31-2016 18-57-04

I spent the middle of the week trying out a shader implementation that would allow me to draw the sliced sprite based on some settings for rotation and sprite of each quadrant!

Screen Shot 2016-07-31 at 6.50.31 PM

I scrapped this approach initially, because it seemed like it required a lot of set-up for the user, at least as I had it, but it’s looking like I’ll have to go back to something like this if I want to not slow things down horribly.

In any case, I am happy with the changes I did make this week, and they are definitely changes that I should have made regardless. ¬†Like, faster = better generally with this kind of stuff, and now it’s written to be faster.

I’d like to put this thing up on the store by this coming weekend, so that I can call it done and funnel my energy back into Floral Kombat.

Until next time,

~Zach

Reengagement via Smart Tiles

Probably the highest priority fix in Floral Kombat is getting those first moments of gameplay right.

My most recent attempt at conveying how pollen works is this:

Jul-22-2016 22-04-49.gif

I’ve added little globules that head over to your icon to attempt to direct your eye there when you get pollen. ¬†I’ve also just written “pollen” under the percentage, and nixed the burst meter, since I really didn’t even notice it (I also got rid of the idea of burst juice, it didn’t feel good to press the button and have nothing happen (I’ll need to rebalance bursting some other way).

Is this clear enough? I think not.

But…

I don’t want to talk about that.

Instead, I want to talk about this:

Screen Shot 2016-07-22 at 10.05.53 PM

Just a boring ol’ tile map, right?

Weeeell…

Jul-22-2016 22-07-02

It’s made of Smart Tiles! ¬†This is me adjusting the IN THE EDITOR!

I’ve decided to extend and polish that auto-tiling code I’ve been using into something I can put on the Asset Store ūüėČ

I’m doing this for a number of reasons.

  1. Once this is done, I can use it in Floral Kombat (and any other tile-based games I make)
  2. It’s been on the tip of my mind for a while
  3. Doing something personal that seems like relatively low time-commitment has been helping me get back in the groove of doing personal work after jobly work.

As you may have guessed, the big reason here is 3.

Often when I can calculate how long a task will take me, if that time is large, I become rather afraid of the task and it’s very easy to work on something smaller instead. ¬†I think that was happening to¬†Floral Kombat¬†— not in small part because it’s at a fairly feature-complete stage, but now is faced with a lot of tough questions like… so how do I make it intuitive?

Working on Z-Auto-Tiler (or ZAT, as I’ve been calling it, but probably, it’ll be really called Smart Tiler on the Asset Store, since that’s a more descriptive name?) has been good to get me back into the groove of my own stuff after hours.

Right now, ZAT is nearly ready for the Asset Store.  Like, I could probably put it up tonight if I wanted, but I do want to change on feature of it that affects structure, so that if I update it later, people who have chosen to use it can more seamlessly update it.

[That feature, by the way, is the way I’m spriting tiles; right now, I’m doing 1 sprite / tile, where a tile can have 0, 1, 2 adjacent, 2 opposite, 3, or 4 sides. ¬†This doesn’t allow for as aesthetically pleasing concave corners though. ¬†I’m going to switch instead to an implementation that uses 4 sprites / tile where there will only be 4 sprite types: side, center, corner convex, corner concave. ¬†Here’s the problem I’m trying to resolve basically:

]

Oh! And one more thing. ¬†Because having only one sprite per option could get kinda boring… I’ve added a “Reroll” button to each tile, so you can select as many tiles as you want and roll new sprites (assuming you have multiple for a type). ¬†The result looks like this (the grass, not the rock, I’ve only made one of each rock sprite so far):

Jul-22-2016 22-22-09

Oh yeah, and these sprites… entirely drawn with just a trackpad! ¬†Because… I didn’t bring my drawing thing with me.

And I’m so proud of how they turned out with just the trackpad!

More than I should be.

Anyway, that’s pretty much all for this week.

Until next time,

~Zach

 

Bees of a Different Shape

Well… it’s been longer than I hoped before getting back to blogging here. ¬†I anticipated a hiatus, but HOPED it would not be a long one.

I suppose I should explain the answer to that question: “where the heck have you disappeared to for so long??”

I’ve been (and still am) teaching a Unity & VR course with Make School and Upload VR! ¬†The course ends mid August, so, Imaginary Reader, expect my posts to be infrequent until then, BUT rest assured, I do plan to start posting again regularly after the course ends.

I also want to take a brief aside to say: teaching this course (as is always the case with teaching for me) has taught ME a lot about development. ¬†In writing tutorials for the course, I started thinking not only about how to DO things in Unity, but how to explain them, and that question “Why” wrt “the heck would I do it way A vs way B.” ¬†I found that often my go-to way¬†felt¬†like a better idea until I started trying to explain it in the context of a tutorial, and then I realized that, actually, way B, which is simpler anyway, is a much better way of doing things.

The best example I can think of of this is how I create Prefabs.

I USED to create Prefabs by loading them in via (GameObject)Resources.Load(“[PrefabName]”), which meant I had to have a folder structure like this:

Screen Shot 2016-07-17 at 10.23.36 AM

(I had to put Prefabs into a Resources folder, or a child thereof — Unity lets you have infinitely many Resources folders, by the way (a thing I didn’t know until I started asking myself questions about structure and started doing more research into the area!))

This felt really cool when I first started doing it because I was all like “Look at me never dragging and dropping stuff in the Editor to set up Prefabs, I have my OWN way to do it that’s BETTER” but… my old way involves passing parameters of type string‚Ć, which means I’m more likely to make typos than if I were to just drag and drop (the way I plan to do things from now on). ¬†ALSO whenever I change names of Prefabs, because the arguments are strings in the old version, I had to go through and change.

‚ĆIn general, I hate passing arguments of type string, not only because of the typo problem, but because I get¬†runtime errors vs¬†compile time¬†errors, and I prefer compile time, because then the compiler will say “hey, do this thing” rather than the game crashing and me having to try to reproduce the problem.

I’m also starting to rethink the way I grab Components of Game Objects. ¬†My goto way is via a Utility function I wrote that uses a callback to get the component if it exists, or add it if specified, to prevent that very common thing of:

Foo foo = fooObj.GetComponent<Foo>();

if (!foo) {

foo = fooObj.AddComponent<Foo>();

}

but… now I realize, I may as well just create “foo” in this case as a public variable of type Foo rather than “fooObj” as a public variable of type GameObject. ¬†I do still like how my old way way lets my components be rather agnostic of whether or not the component exists, and I don’t even care that much that I have, like 100 calls to GetComponent, which is, like, O(N) or whatever, because N is small. ¬†I just think the other way is simpler, and I’m gonna try to use it from now on.

But what of Floral Kombat??

I showed someone at Make School the game, and, as many people say, he said he found it rather confusing. ¬†Something new he pointed out was that the bees don’t really look like bees… recall the old bees. ¬†Let’s just use some old screenshot:

May 19, 2016 13:53

Okay fine, a gif.  Because I love those things too much.

Notice how the bees are, like, just basically yellow circles. ¬†Yes, it’s not the final art, but this sort of stuff matters in terms of conveyance, and it REALLY matters when you’re all zoomed out, as the game is. ¬†Like these bees might work okay zoomed in, but, far away?

Screen Shot 2016-05-09 at 7.48.55 AM

Hardly recognizable.

So… I went with his suggestion to change the shape.

Does it help?

Jul-17-2016 10-25-09

I think that now they at least read a little more like “insect.” ¬†It’s unclear if they’re wasps or whatever, and I’ve gotta tweak that. ¬†And MAYBE the whole game needs to be zoomed in more. ¬†It could be tat it’s too far away right now and I need to get a hair closer.

In any case, I think this is a step in the right direction.

Most pressingly, though, I’ve got to get rid of that pesky confusion.

In taking time away from the game, I see the confusion now more than before.

Everything’s all moving and pulsing and shiny and animated and really I need to direct the players’ eyes better.

Because it’s on my mind, I’m gonna relate my problem to a Steven Spielberg quote mentioned by a VR speaker we’ve had at the Academy:

“I think we‚Äôre moving into a dangerous medium with virtual reality… The only reason I say it is dangerous is because it gives the viewer a lot of latitude not to take direction from the storytellers but make their own choices of where to look”

I wonder if authors had this fear when film first came out, that audiences could now had an ENTIRE PLANE to look at, rather than just lines at a time (isolated moments). ¬†I think that the new challenge that faces 3d film makers is a lot the same challenge they face today — “how do I direct an audience?” — just with another dimension. ¬†It’s a difficult problem in 3d, but it’s also challenging in 2d.

I don’t think film makers should fear the new medium, I think they should try new things and see what works. ¬†Or maybe they’ll learn to tell stories that don’t rely so much on direction and control.

Anyway, for my next steps, I’d like to create a good flow that shows players how to play, without relying on text (because they haven’t been reading anyway), and instead relies on directing the eye to the important things at any given time.

Until next time,

~Zach

Standing, Sitting, Lying Down

A LATE post and a SHORT post… because this past week/this current week, my focus was/will be on final prep for my 3-month full-time position.

Weeeeell…

I’ve been doing that working-while-standing thing long enough that now I associate standing with productivity and sitting with not-productivity.

I feel I can get into a better “flow state”‚Ć standing than I used to be able to sitting down, though this does mean that when I’m sitting, it’s generally more difficult for me to get into that state.

‚Ćugh… I really hate how pretentious that sounds… like, it sounds super pretentious. ¬†Though, maybe I’m complaining about the wrong thing. ¬†Like, just look at the subject matter about which I chose to write…

If my body ever tells me “hey, I want to sit down,” it’s generally a sign that I’ve stopped being productive and should do¬†something else, e.g. sleep. ¬†Whenever I do that, it’s a lot easier to get work done at some later point.

I feel I used to be fairly productive lying down, like, in high school. ¬†Possibly that’s because high school involved completing assignments that had finite ends rather than working on art that has no such thing. ¬†Like, I could look at a homework assignment and pretty easily estimate when it would be done. ¬†If I couldn’t there was a deadline, anyway, that would help me say “okay, someone at least thinks this thing shouldn’t take me more than a night, and if I don’t finish it by then… it’s still gonna be done anyway.” ¬†It’s difficult to do that with art, which is why I find imposing deadlines to be pretty helpful.

If this coming week plays out the way I anticipate it will, I expect another post like this for this coming week, but I still think making posts like this help me. ¬†It ensures that, even on weeks when I cannot do indie dev work, the game’s still on the tip of my brain.

Until next time,

~Zach

Hey Look! Arrows!

Jun-02-2016 17-28-42

Look at all that progress I made this week!  Astounding!

The part-time work that I’m doing is about to turn into full-time work until ~Sept. ¬†Needless to say, this week, it already started doing that.

Have I reached my goal of having¬†Floral Kombat feature complete at this point? ¬†Well…

The game¬†does have all the features I want it to have at this point. ¬†It lacks important things like menus… and audio… and… polish… but I’m actually pretty happy with where it is right now, all things considered.

My upcoming schedule until Sept is going to be much different than it has been the past few months, but I do want to keep up development (even if greatly reduced, like what happened this week) and I want to keep posting here, because it’s a good reminder that “hey, there’s this thing.”

Between now and September, my highest priority should be ensuring that the game does a good enough job of teaching players how to play it, be that via a tutorial, images, text, gameplay elements like arrows, whatever works.

The fancy features, like different insect types, different terrain types, stage unlocking, etc can all get de-prioritized until I have the game in a state where I can hand it to nearly anyone, and that person can play it without me saying anything and without requiring the person to be super-dedicated to the game (i.e. I don’t want people to just read tutorial text because they feel bad not, since I’m a friend, and not reading it seems rude; I want this to be pick-up-and-play-able by a stranger who doesn’t care about me necessarily).

Until next time, and so that I encourage myself to do it soon, let’s say “next time” will be a week from today,

~Zach