BLACKISH DEV BLOG Support
 

 

Komplete Logic

After some years of marveling at the wonders that Native Instruments are developing, I finally pushed the button when I heard about the current Komplete 5 offer (now apperently sold out). So after 2 1/2 weeks of waiting and 6+ hours of installing/updating the 50+ GB of samples and instruments I’m now all set up to make some music again… (not that I really have the time right now, but I’m set up for it! yay!)

So expect the next game (the one after the two that I’m currently involved in) to have a nice home-made soundtrack! – BTW: This will be a step down, as the soundtracks of both aforementioned games are being done by professionals…
Lessons learnt so far:
How to use virtual instruments in Logic: After an hour of trying to drop KONTAKT 3.5 into an Insert Slot on a Stereo Audio Track, deleting and re-building all Audio Unit Caches, searching through support forums, and some desperate borderline-voodoo stuff, I finally had a look at the Logic Express Manual and learned that I have to make a Software Instrument Track and set its Input Slot to KONTAKT… Another lesson learnt the hard way…
How to use 2 audio devices at once in Logic: Create an Aggregated Device with the Audio MIDI Setup in Applications/Utilities
Leave a comment

Unity: Converting int to float

a quick lesson learnt:

var num : float = 20 / 44; //result: 0

var num : float = parseFloat(20) / parseFloat(44); //result: 0.4545455
and just to be complete:
var num : float = 20.0 / 44.0; //result: 0.4545455
1 Comment

Unity: Animated menus when the game is paused

You can pause your game by setting Time.timeScale = 0.0;
If you set it to zero, Time.time will no longer increase and the FixedUpdate function will no longer be called. In principle this is great. It is not so great though if you want to have an animated menu on top of your paused game because…

yield new WaitForSeconds(x); will no longer work,
and Mathf.SmoothDamp will also stop because it relies on Time.deltaTime

But there’s a way around this:

1) Create your own version of WaitForSeconds that works with realtime instead of gametime:

Wait.js:


static function WaitForSecRealtime(sec : float) {
var waitTime : float = Time.realtimeSinceStartup + sec;
while (Time.realtimeSinceStartup < waitTime) {
yield; //wait until next frame
}
}

You can now call this from any script by doing something like this:


yield StartCoroutine(Wait.WaitForSecRealtime(2.0));

2) Calculate a realtime deltaTime and feed it into Mathf.SmoothDamp instead of the default Time.deltaTime


xPos = Mathf.SmoothDamp(xPos, targetPos, xVel, sec, Mathf.Infinity, realtimeDeltaTime);

Thanks a lot to Digitalos, ducket, NCarter and ToreTank on IRC #unity3d for helping me with this!

Leave a comment

Modo: A faster way to model race-tracks

I knew the Curve Extrude Tool, but what I didn’t know was that you can not only draw a curve interactively, but extrude along a pre-existing curve!
So, let’s create a track-curve. Geometry > Draw > Curve (or select the Curve Tool from the Basic Tools palette)
Then create a simple polygon, select both the polygon and the curve and do a Curve Extrude (Geometry > Duplicate > Curve Extrude)

By the way: This works with the new Profiles Feature that was added in 401. If you create a curve, then save it as a Profile (Geometry > Profile > Save…) and select it in the Curve Extrude Tool, it uses the profile to perform the extrusion.
If you want to adjust the curve interactively you can still do that. Just remember to check Create Polygon under Curve Path in the Curve Extrude Tool, so you’ll have the newest version of the Curve available once you drop the tool. (In case you want to re-create the mesh later on)
There’s no denying that creating a track like that would be a bit more straightforward in C4D using 2 Splines and a Sweep NURBS (you wouldn’t have to re-create it each time you wanted to change something), but I’m glad that it can be done in modo…
One advantages of doing it this way is: You get pretty clean UVs. – No need to use the UV Peeler Tool… (But only if you’re extruding a polygon with a propper UV Layout – I haven’t figured out if there’s a way to get good UVs from a Profile…)
Leave a comment

How to prevent XCode from adding a shine to Icons automatically

Open Info.plist

Add a new row
name it UIPrerenderedIcon
right-click and set Value Type to Boolean
set the checkbox to true

Update: This is obsolete since Unity iPhone 1.5 – just check the UIPrerendered Icon flag under Edit > Project Settings > Player
Leave a comment

Getting past the physics-timestep barrier

A serious problem that any racing game has to deal with is the battle between laptime-accuracy and performance.

On one hand you can’t do too many physics calculations per second because it kills the frame-rate, but on the other hand you want to do as many as possible to be able to measure lap-times in as small timesteps as possible. (Set the physics to be calucalted 20x/sec and your highscores will only be measured in 0.05 second steps. Now have 1000 people play and 50 of them will share the top spot. Not good… – Set the timestep to 100x/sec and you’ll have a lot more accuracy, but none of the 1000 people will enjoy playing at 5 fps.)

But there’s a clever way around this:
Record the position of the vehicle at each physics calculation and once it crosses the finishing line, use the distance between the last and current points together with the position of the finishing line to calculate when exactly the vehicle must have crossed the line during the last timestep.

Leave a comment

Unity: Triggers and Colliders

I just learnt an important lesson: If I want a collider to react with a trigger+rigidbody, the rigidbody has to move to cause any effect. If trigger+rigidbody are on a static object, the colliders run right through it without a beep…

Triggers and Colliders are a bit weird…
2 Triggers with no rigidbody don’t do anything at all.
Same goes for 2 Colliders with no rigidbody involved.
2 Colliders where one has a rigidbody attached will cause a Collision.
1 Collider+Rigidbody and 1 Trigger will cause a Trigger.
1 Trigger+Rigidbody and 1 Collider will also cause a Trigger.
1 Trigger+Rigidbody and a second Trigger will again cause a Trigger.

It doesn’t matter if the rigidbody uses gravity or is kinematic, BUT in all these cases the effect will only be there if the object with the rigidbody is moving

2 Comments

3 random Photoshop tips

You can change multiple text layers at once: select all layers – activate Text tool, but don’t click on any one text – change font/size/color/etc. in the tool-bar.

Shortcuts for Layer-Blend-Modes: Shift + Alt + M = Multiply (or: N = normal, O = Overlay, G = lighten, +/- on the numpad cycles through all of them)

If you’re making a selection (using the Rectangular Marquee Tool, for example) you can press and hold Space (all the while not letting go of the Mouse-Button) to move the selection. (thanks to Helga)

Leave a comment

Unity Physics Optimizations

Fixed Timestamp
All physics-calculations happen at fixed intervals – if they are calculated more often they are more accurate but more processing power will be needed. Generally it might be a good idea to adjust this to your target framerate. So if you’re targeting 25fps, you could set it to 0.04 (= 1/25). – This can be set under Edit > Project Settings > Time

Rigidbody Interpolation
If you set the physics timestamp lower than the framerat, physics objects might start to stutter. This can be fixed by setting the Rigidbody to Interpolate or Extrapolate in the Inspector. Unity will then calculate intermediate values for every frame where physics is not calculated based on the previous or next frame.

Leave a comment

The Next Game…

…is a racing game
1 Comment