Slab textures fixed

Some of you reported that slab textures were upside down! That’s now fixed. Everything lines up correctly:

slabsfixed

Not sure if I mentioned it yet, but the next version has a unified lighting system for all block types. There should be much less lighting artefacts where different types of blocks meet.

1.29 and earlier use different lighting code for blocks, slabs, stairs etc. and the results are not consistent, resulting in visible light artefacts at block joints.

This upgrade is a byproduct of furniture, I had to do it to have furniture lit properly.

Also, little holes that were previously very dark no matter how many light sources you put around them should be much less dark now.

A Cabin In The Woods

I meant to show you the new cool feature today, but ran out of time. So have a look at some more furniture goodness instead:

 

 

Isn’t the piano and the model ships cool :-)

Spent a lot of time before I got them into the complexity budget (a piece of furniture cannot exceed 300 triangles), but it’s doable.

Performance bug

I’ve just found a significant performance bug in code that handles pickables (i.e. items lying on the ground).

The reason for the problem is that the game tries to find a suitable inventory slot for every pickable in the world every frame, even if the pickable is far away from the player. This is a performance killer in creative mode, because player has around 1500 inventory slots (including creative items slots). So for every pickable, 1500 slots are scanned every frame. This takes some time.

As a result, if you have hundreds, or even just dozens of pickables floating around, it will kill the framerate.

I’ve just seen it in the profiler and almost fell off the chair. It must have been in the game since time immemorial! How could I have missed it all these years?

The good news is that it’s trivial to fix. If your game slows down to a crawl when there’s plenty of stuff lying around, just wait for the next version.

I am now putting finishing touches to a new exciting feature that has been requested more than once and was long long overdue. Can’t post any pictures, because it would be a dead giveaway this time :-)

The next version must be released before Christmas.

 

Sea life

I once showed you a picture of a sea urchin. Well, there’s a lot more underwater stuff than just urchins coming in the next update:

sealife

32 bit blocks allow me to do a lot of cool things that were previously impossible. These underwater plants are both water and a plant – the water will flow from them like from a normal source block and plant can be broken down and picked up like on land. There is some trickery to make it all work properly with physics, collisions and rendering, but the engine can stand it.

I also tweaked underwater fog. It changes colour and density with water temperature and humidity. In humid places like jungles the water becomes very murky. The depth also influences fog – if you dive deep, you’ll scarcely be able to see anything.

Incendiary Explosives

Another feature for the upcoming version: incendiary explosives.

Craft them from normal explosives by adding sulphur.

They are weaker, but produce a lot of fiery red debris that flies far and wide, setting anything flammable on fire.

Furniture Part 3

Here’s the final movie on furniture for you to check out:

I have moved beyond furniture now and there a bunch of new stuff waiting to be finalized before I can show it to you.

Furniture Part 2

Here’s a second video showing you more of what can be made with furniture. Briefly explains multi-state furniture and light sources.

Have a look here.

There’s still more to come, we haven’t even touched electricity yet. The feature is called furniture, but in reality it’s much more than that.

On advertising

Advertising is evil and unnecessary, but humanity hasn’t figured a way to get rid of it yet.

No one likes advertising. It’s demeaning, annoying and costly. A lot of people however claim that it is a necessary evil, because without it the economy would grind to a halt. Or some similar poorly thought out idea. The truth is the economy would do just as fine without advertising, and sales would not drop. They would actually increase!

The reasoning behind the idea that advertising is driving economy is like that: company A invested $100,000 in ads and their sales jumped 30%. So advertising increases sales.

False. The 30% increase of sales for company A must have caused global sales of other products to decrease by the same value, because the total amount of money spent in the world has not changed. People just shifted their spend from B to A. Even if we assume that company A ads caused them to raid their savings accounts and credit cards and buy product A without reducing spend on other products, this is only a temporary effect. Eventually they will run out of savings and will have to repay the credit. In the long term, global sales stayed the same as if there was no advertising.

Or more precisely, the global sales dropped a little. $100,000 spent on ads by company A was wasted – it could have been spent buying something else, but wasn’t. So global sales dropped by $100,000.

Of course, company A does not care about global sales. Their sales increased! This is what matters to them. But did they actually increase?

No. At the same time, company B and millions of other companies in the world are running their own ads, increasing their own sales and reducing sales of company A. Therefore, as a result of advertising, sales of A might actually have dropped.

In reality, everyone’s sales have dropped (compared to no-advertising world). They dropped by total amount wasted on advertising by everyone.

It is embarrassingly simple, really. Advertising is like an arms race between countries. No one can afford to stop doing it. But the global effect is detrimental. If only we could somehow agree and trust each other to dismantle all warheads and tanks, the world would be a safer, happier and richer place. But no one has figured out how to do it yet. It’s similar with advertising. If only we could figure a way for everyone to stop doing it, we would all be much better off. Prices would drop. Salaries would go up. The TV would be more interesting. The web would be cleaner. The world would be prettier.

I don’t know the way to achieve it. It probably isn’t through some individuals voluntarily refraining from supporting advertising.

But no version of Survivalcraft has ever had any ads in it.

Not supporting advertising is not easy. You may even see some ads floating around in this post! Partially out of my control. Shudder.

 

 

 

Furniture

Here’s part 1 of furniture video for you:

This video covers the basics. I had this in mind when I first thought of this feature. As I was working on it I found that there are many cool things you can do with furniture. Wait for the next videos to see what I mean.

In the meantime I am working on the next big feature for the update.

 

On coordinate systems

Here’s a little rant on left vs right handed coordinate systems.

Survivalcraft up to version 1.27 used XNA as rendering engine. If you ever did any 3D coding you probably know that XNA is hardcoded to use a right-handed coordinate system. All my previous 3D experience was with left-handed systems.

Here’s what I am talking about:

Coords.png

Notice how you can get the second right-handed system by rotating the first one by 180° around Y axis. They are the same systems really. You can never get a left-handed system from right-handed by rotations only. You need to flip it. That’s why there are two kinds of coordinate systems in 3D.

I thought (as most people do) that it’s purely a matter of convention and you can get used to one or the other. But after over 4 years of work on Survivalcraft, which uses right-handed coords I figured I am not and will probably never be comfortable with right-handed coordinate systems. They are counter-intuitive to me.

Here’s why, axis by axis.

Up/Down Axis (often called Y, sometimes Z):

This is the simplest one. Increasing values should go up. No questions. It’s dictated by gravity we are all used to. It would be like having an altimeter in an aircraft that shows smaller values the higher you go. Imagine being a pilot trying to get your head around it.

Near/Far Axis (often called Z, sometimes Y):

Increasing values should go far. This is less obvious, but I think most people would agree that the further something is, the bigger the coordinate value should be. It’s like a distance. The other way has an issue if the observer is at the center of the coordinate system (a very common case): you must use negative values for something that is in front of you. No doubt it is more intuitive to have negative values for something that is behind, not in front!

Left/Right Axis (pretty much always called X)

Increasing values should go right. This is the least obvious axis. The preference for right direction comes from western culture of writing. Of course there are other methods of writing that go the other way, mostly originating in Far East. But there is no doubt that when you are a programmer (Chinese, Korean, American, it does not matter) and are looking at a computer screen, you know that horizontal zero coordinate is at the left side of the screen, and increasing the coordinate will move it right. It is a convention ingrained over decades. TVs scan left to right. Even oscilloscopes scan from left to right.

Now where does this leave us? If we adopt the most intuitive axis directions as described above, we get this coordinate system:

LhCoords.png

And it is left handed. Left handed FTW!

Finally comes the biggest disadvantage of right-handed systems. If for some reason you think that right handed system is good for you, it’s not obvious which one (assuming we keep the Y axis pointing up):

RhCoords.png

Either you flip X or Z axis.

Furthermore, once you convert your right-handed coordinates to screen space, you are back at left handed system. Therefore, you need to constantly switch between left and right handedness depending with which space you are working with. Confusion!

To me, it’s a nightmare. I cannot reason in a right-handed system. I cannot visualise anything in my head. I have to draw it and mark the axes directions first. It’s much slower than having it all in my mind.

Since version 1.27, Survivalcraft uses a custom engine for rendering. When working on it I did not switch the coordinate system from XNA right-handed one. I had enough other issues to worry about :-) So sadly the game still uses a right-handed coordinate system. And don’t ask me which one, I am so confused I don’t know myself! It’s probably different systems in world space, different in view space and different still in screen space…

But one day I think I will switch the entire engine and the game to left-handed where there’s only one obvious way!

Btw. This rant is purely subjective and not entirely unbiased. For example a lot of 3D modelling programs (and top-down view games) use Z as up-down axis. The above reasoning does not apply to them.