zero's a life

An extra chance.

Using Images in Octopress Posts

| Comments

Storing the images

I store images in ./images/assets/ in my Octopress install directory. They get bundled up with all the other parts of my blog when I deploy.

The Octopress image tag

I use the Octopress image tag

The syntax is:

{[%] img [class names] /path/to/image [width] [height] [title text [alt text]] [%]}

Trace Function for Debugging in Unity C#

| Comments

Inspired by a video from the excellent Double Fine Documentary interviews with Massive Chalice artists and developers, I wanted to come up with a way of conditionally including debug statements in development code, but not in production. Luckily I wasn’t the first person to think of this.

Dan Puzey wrote an abstraction layer over Unity’s built-in Debug library. The library contains several functions for various types of logging. The most important piece for me is VerboseFormat, which combines string formatting with conditional attributes. I’ll explain a bit more about how these pieces work below.

Satoru Iwata

| Comments

Video games are meant to be just one thing. Fun. Fun for everyone.

– Satoru Iwata, 1959-2015

Probabilistic Entity Spawning in Unity C#

| Comments

Last week I showed how to do probabilistic entity spawning in Unity JS. This week I’ll port that code over to C#. You can find examples of both the C# and JavaScript versions of the code in a repository on github. Since I’ve already explained the Algorithm I will focus mainly on the differences in the code.

There isn’t syntactic sugar for Dictionary assignment in C# :( This required moving the assignment for the areas Dictionary into the Start function. It’s a move that enforces best practices, strictly speaking, but risks confusion about the content of the areas Dictionary at runtime. If you’d like to read up on Dictionaries in C#, I found this resource helpful.

The foreach command requires a type. This is a case where a stricter language will save confusion in the long run.

Lists can be created from specific arrays of the List’s type, but not from some arbitrary array, as in JavaScript. Again, this is a feature of a stricter language that causes some extra work up-front, but will make things more clear in the long run.

For an in-depth tour of the algorithm for spawning entities, check out last week’s post and the example repository on github.

Create a Dictionary of Lists in Unity C#

| Comments

Last week, I published an article about creating a Dictionary of Lists in Unity using Unity’s JavaScript. Some of the syntax is changed in C#, but the overall algorithm is exactly the same. I’ve already mentioned the underlying motive, so I’ll dive right in.

Prototyping Rectangles in Unity 2D for Dummy

| Comments

Who’s “Dummy”? I’m the dummy. Prototyping with 2d boxes in Unity JavaScript has proven surprisingly hard. I think the difficulty I’m having is that I’m not exactly sure what I’m trying to do. What follows is an example of one way (notice that I didn’t say THE RIGHT WAY) to prototype with 2d rectangles in Unity. I’m still too much of a noob to have strong opinions on the right way to go about doing this. Expect more posts on this topic as I develop my expertise.

Discoverability is something I prize in programming languages and environments, especially when I’m learning them. While Unity’s documentation is thorough, the lack of congruence between the GUI environment and coding leads to poor discoverability. There’s not a one-to-one correspondence between the labels for Components in the GUI inspector and their names and attributes in code.

More Skytorn Raycast Lighting Algorithm Details

| Comments

Last week I covered the lighting algorithm @NoelFB is implementing for Skytorn. Noel was nice enough to correct my mistaken assumptions about the inner workings of the lighting algorithm.

Looks like I kind of inverted the polarity of the raycasting with regard to the player and the level geometry.