BLACKISH DEV BLOG Support
 

 

Modeling Racetrack Collision Meshes

While working on a racing-game-idea, I noticed that sometimes parts of a track seemed to be really bumpy for no apparent reason. Have a look:


Looks alright, doesn’t it? Well, as I already suggested there is of course a reason for this and it’s actually not all that non-apparent now that I figured it out…

What happens is this: I model a track in quads, change it around a lot, finally export/import it and notice that it’s bumpy in Unity. The reason is that the quads get triangulated automatically on import as game-engines only work with triangles. This is not a problem by itself, it only becomes a problem if the quads are non-planar (- that means that not all 4 vertices of a polygon are on the same plane). If you triangulate non-planar quads you get this result:


not so nice… now there’s several possible solutions:

1.) Try to make all polygons planar by hand – this is a pain, as fixing one breaks two others…
2.) Subdivide until you have enough polygons to ensure a smooth ride – this is suboptimal because performance goes down if the collision mesh is too dense. But how much polygons you need depends very much on your track and game, so only testing can determine if this is a viable solution…
3.) Change the texture to something that looks bumpy ;)

or 4.) Recreate the polygons in a way that ensures they’re planar: Create a Cone that contains the wanted curve, delete the base, flip the polygons, delete all the other polygons you don’t need and replace those non-planar troublemakers…


PS: Modo-Tip: In the Statistics pane under Polygons > By Type > Non-Planar you can select all non-planar polygons to see where troubles might occur

1 Comment

UnityScript: Splitting strings and some type-conversion

How to split a string of values into an array and convert the result from string to float:

var myString : String = “22.1|23.2|26.8|31.4″;
var myStringArray = myString.Split(char.Parse(“|”));
var myFloatArray = new float[myStringArray.length];

for(i = 0; i < myStringArray.length; i++) {
     myFloatArray[i] = parseFloat(myStringArray[i]);
}

Leave a comment

Making a living with iPhone games

You might want to skip this post, it’s all tax talk and the numbers are specific for Austria

Anyway, what I wanted to share are some of my calculations as to what’s the bare minimum a single indie-game-iPhone-developer needs to sell to survive. (If you ever want to go on vacation, get a car, have kids or something like that, you should aim a little higher…)

If you stumbled upon this looking for actual app store iphone game sales numbers, get some here, here, here, here, here, maybe here or if you really want to even here for god’s sake. But now to my story:

App Store
Hypothetical iPhone Developer X has made a little game and is selling it on the App Store. How much does he need to sell to make a living?

Let’s say he has 3210 sales in one month (about 107 a day) at EUR 0,79. (or 1600 at 1,59 | 855 at 2,99)
3210 sales x EUR 0,79 = EUR 2.535,90. Wow, no trouble surviving on that, right?

End of story.

Or wait, we forgot to subtract a few things. Apple keeps upwards of 30%, the rest of the money is transferred to him from 7 different places so he might have to pay a transaction fee of about EUR 10,- for all payments coming in a different currency from outside the EU and what he gets also depends on where his game was bought (what the actual price is in that country) and what the exchange rate is at the time of the transaction.

X’s bank account
What makes its way onto X’s bank account will be more like EUR 1.500,- I’ll call this his turnover

- 20% Value Added Tax: well, not in this case, no VAT left in the money he gets from Apple.

- work related expenses, let’s assume EUR 200,- for internet, phone, domain hosting, work-related insurances (liability, legal protection) and all other stuff he can deduct from tax.

Income Before Tax
EUR 1.300,- left now. This is called Income Before Tax and the following is subtracted from it:

- 25.18% for Social Security (EUR 327.34)
(16% retirement insurance, 7.65% health insurance, 1.53% self employment provision)

- EUR 7,84 Accident Insurance (fixed amount of EUR 94,08 annually)

Income
What’s left now is his Income: EUR 964,82

- income tax: Almost none in this case, as the first EUR 11.000,- per year are tax-free, but let’s assume he has an income of around EUR 1.000,- per month or EUR 12.000,- per year. That’s EUR 1.000,- above the limit and X has to pay 36.5% taxes for that amount, which is EUR 365,- annually, or EUR 30,42 income tax for this month.

So of the initial EUR 2535,90

  • Apple gets about EUR 1000,-
  • EUR 335,18 are payed for social security
  • EUR 30,42 are payed as income tax
  • EUR 200,- were assumed for work expenses

and that leaves X with EUR 970,30 to pay for rent, food, transportation, savings, entertainment, etc.

PS: Of course all the taxes aren’t calculated monthly, where would be the fun in that? Instead for social security for example you tell them expected annual earnings, they calculate the tax off of that, you pay it quarterly in advance and at the end of the year there’s a tax invoice being made that has all the right numbers.

Conclusion
Put half of what you get into a separate bank account, don’t touch it for the rest of the year (until after the next tax invoice) and you should be on the safe side…

2 Comments

A solar system


This is the sun, it’s about 10 cm big. The earth is traveling through space somewhere around 12 m from here. It’s not even 1mm big and traveling at a slow 4.5mm per hour…

Let’s say you’re working on a game set in space and you wanted to make it a bit more realistic than the average space-game – you might not want to be all too accurate with the numbers or it will be very very empty and very very slow…

Leave a comment

Age of Curling Trailer

Leave a comment

Age of Curling: AI

Since a lot of people asked for it, I’ve been working on a computer opponent to play against. After some weeks of work it’s now close to being done and I’ll let you have a first look at it!


What was that? AI can’t really be seen in a screenshot? Ok, well then let me tell you something about it instead… ;)

  • It analyzes the position of the stones in play and decides on a throw based on the current score, the position of the stones and the phase of the end.
  • It knows more than 50 moves (and I’ll keep adding even more with every update)
  • It has a skipper to give you a basic idea of what it’s trying to achieve
  • You don’t have to watch the entire throw, you can fast forward right to the point where it gets interesting (= where the stone crosses the far hog-line)

Now just a few more days of polish and testing and it will be ready to go live!

Leave a comment

Standard Arrays can not be typed

A long-time mistake of mine: Trying to type standard arrays like this:

var arr = new Array(int); //stupid – standard arrays can’t be typed

This is very wrong, as it puts the Type Int32 into the newly created array which of course causes problems once you’re trying to get to all those other ints that you stored in the array. So everytime I tried to use this I had to come up with some other solution in the end… converting back and forth from standard to builtin, etc…

The correct way is of course to just create the Array with var arr = new Array(); – then fill it and once you’re trying to use the contents you type each value as you take it out of the array…

Builtin-Arrays on the other hand are typed, so if you don’t need the extra functionality and flexibility, just do it this way:

var posGridA = new int[7]; //builtin arrays are typed!

- Thanks to NCarter for enlightening me!

Leave a comment

changing prefab-script-variables from within the game

I was looking for a way to save moves that happen in the game. After some discussions on IRC and getting very close to writing out textfiles, I figured out a way to do it more easily:

If I Resource.Load(“name”, type) a script that I have on a prefab in the Resources folder without instantiating it, I can then write my values in there and they persist even when I stop the game!

Leave a comment

PVRTC Texture Compression News

Turns out textures only get PVRTC-compressed if they are square, but Unity only complains if the size is not a power of two. So it doesn’t complain about a texture being 1024x512px, but this texture also doesn’t get compressed. The result of this is that 3 of the now 4 venues in Age of Curling have uncompressed textures. Still that’s 2x good news for the players:

  1. Since the game is optimized enough to still run at great speed even with uncompressed textures, the 3 older venues have crisp textures without compression artifacts!
  2. The new venue (plus future venues) can use bigger textures since we can fit more of them into the tiny iPhone-memory!
Leave a comment

Sneak Preview

Age of Curling v1.1 will be out in a few days. Among other things, the update brings a new venue – an 18th century Scottish castle:

2 Comments