The washing machine problem

The world of Highrisers is purely made of 2D sprites. We use a cabinett projection in order to generate a 3 dimensional impression. That’s a kind of drawing technique that works without a vanishing point. It’s well suited to the dollhouse-like look of Highrisers and for pixel art in general, as the “straight” lines running inot the back are at a 45 degree angle. Which works well with pixels.

We further enhance that impression by clever usage of light and shadows, but at its core, it’s all just plain 2D.

This means we can create levels quickly and simply, and the performance will be great even on older machines – we’re just moving 2D-sprites after all. We won’t be able to do stuff like the change of the looking angle as you might have seen in “This War Of Mine”, but that’s fine.

However, we now also encountered limitations when it comes to arranging items and walls.
We have dubbed this issue the “washing machine problem”, due to the nature of our example object. Simply put, it’s about this:

It might not be obvious why this issue should arise. But always remember: Those walls have no depth. They’re just flat wallpapers creating the illusion of depth.

Until now, our building (all the walls, floors, ceilings, pillars, etc.) have been based on a tilemap, and it has always been completely in the background. That means that all other game objects like furniture, equipment, the dreamers and the players, everything was in front of all the walls.

If you played the demo, you might have noticed that in some cases, this is not always entirely true:

What about that red barrel on the right of the workbench? Isn’t that clearly covered by the protruding wall?

Well – unfortunately, no. Like all objects, the sprite of the barrel is actually placed in front of the wall and looks like this:

I have manually set a clipping rectangle for the sprite and cut off the part that should be visually behind the wall.

For the dreamers that are hidden in the walls behind closed doors: They are only spawned once the door is opened, so again – no occlusion of objects by walls.

This worked fine for our static tutorial level, but of course this would not work once we integrate the procedural generation.

And as we were overhauling our building tilemaps to make them fit for the proc gen, we also decided to address this occlusion issue.
Object placement in Highrisers generally works like this:

Every object has an anchor point, which is the bottom left far corner of the object.
Remember that the object is purely 2D, so we only need to store the x/y offset. There is no real z-depth!
Since our perspective is vanishing to the right, we place objects from left to right, so that leftmost objects are occluded by their right neighbors.

The idea now was to have different possible layers where a horizontal wall can be placed, and a corresponding layer of object slots, which would place objects in front of their walls, but behind the next wall.

Slots are positions where an object can be placed. They offer an anchor point for alignment and help to avoid overlaps, as they prevent two objects from occupying the same space.

3 different wall layers and their corresponding slot rows
When placing objects in the slots, the walls and objects of a hihger level cover walls and objects of a lower level

Sounds nice and easy, and would have worked with our current level architecture. But when you think about it further, problems arise:

While this case would still work with our layering concept, it falls short for other combinations:

As we can see, the long right washing machine is placed on the yellow level, but it is so long that it covers the red wall. But read walls are supposed to cover objects on the yellow level?!

This can also happen for horizontal walls placed in the front:

We have not yet decided how we are going to address this.

We could simply limit our architecture so that we don’t run into such situations. No walls in the front, no walls portruding into the scene. As the architecture of Highrisers is stylized anyway, this would well be possible.

We could also limit our object design so that we simply don’t have such looooong objects reaching into the front. Or have them only placed horizontally only.

We could also change the rendering algorithm for our objects, drawing them only from one layer to the next, from left to right. That way, the right occlusion will always be selected, no matter where the anchor point of that object is. I would require to transform our flat tilemap walls into wall objects that interact with the slots.

Concept of layer by layer rendering

Oh, who would have thought that washing machine placement would be this troublesome?

Highrisers Background Story Timeline

2020 – Breakthroughs in plant genetics revolutionize agriculture with tremendous speed: so called mnc-crops, which contain several serially connected ribosomes promise bountiful harvests in no time. Jobs get lost in the traditional farming, a rural exodus starts.

2025 – Urbanization is not ebbing away; it is rather fueled by massive movement of refugees, longer life expectancy and lack of perspective in rural areas. In the USA, racial tensions are increasing; many members of ethnic minorities emigrate to Europe.

2027 – Turkey leaves the NATO. Russian provocations are daily fare; the US military increase their presence on European mainland again. In the Middle East, local conflicts are spreading. Northern Africa, unable to purchase the expensive mnc-crops, is suffering from several years of drought; millions are fleeing. China is flexing its muscles in world trade. Mutual economic sanctions paralyze the conflicting parties.

2028 – Due to the constant exceedance of pollutant limits, the EU is forcing European governments – despite their fierce resistance – to enforce driving bans for diesel and gasoline driven cars in inner cities. The still stagnant progress in electromobility is further halted by a resource crisis and economic embargoes. Especially transportation of goods is strongly affected.

2029 – Housing space is becoming a rare commodity in every large city in the world. Rents are unaffordable to most in all major conurbanations. In Germany, the efforts of the state to mitigate the effects of the rural flight fall flat without any significant effect. At the same time, broadband expansion is still stagnating in the countryside, despite the grandiose promises of government and service providers. Especially the young are driven into the cities, starting a vicious circle, since their exodus makes investments in rural internet connections even less profitable.

2031 – In addition to the widespread housing shortage, Germany is also hit by an energy crisis. The combined phase-out of nuclear energy and coal, together with Russian gas embargoes become noticeable. Without marketable storage technology and a reliable high voltage network, brownouts and voltage fluctuation occur with increasing frequency.
Some blackouts are also attributed to attacks of Russian hacker groups. Riots happen in the streets, and in the dark nights the wrath of the poor and left behind leashes out in looting and vandalism. There are also claims that blame Russian hackers and bot-nets for having manipulated social media in order to incite the unrests, but there is no proof.

2032 – The Federal Government pulls the emergency brake. In the fourth version of the reform of federalism, it gains wide concessions from the states and the municipalities over the planning and building laws. Objections against power lines and other infrastructure projects, as well as new housing constructions in conurbanations are now next to impossible. In return, the states win more autonomy in the fields of internal security, public health and border protection – this was an important issue for Bavaria, where the State ministry for Infection control, General health, Media and Anti-riot, SIGMA, is founded.

2033 – There is a nationwide conformation of building regulations. Every new building in a metropolitan area must now have a minimum of 35 floors. Concern of urban development and historic preservation are mostly ignored. Long time residents protest fiercely, but in the end to no avail.

2035 – Property speculators pay top prices for developed land in cities, to tear them down and rebuild them in accordance to the new building regulations. There is a gold rush mentality. The former residents are pushed towards moving out, sometimes by all means; the social gap is increasing. Protests and demonstrations are now a common sight. The face of the cities is changing with enormous speed. The construction boom in the inner cities causes even more traffic congestions. The transportation cost of goods are now so high that even production facilities in urban areas, so called vertical factories, are profitable.

2038 – The first documented case of the sleeping disease occurs in Romania: The worker Radu Bădescu is goind to sleep on the evening of April 23rd, as every day, but on the next morning, he can’t be woken up. Doctors are clueless. He seems to be trapped in an eternal REM-phase. He is put under surveillance and is fed artificially.

2039 – All over the world, there are new cases of the mysterious sleeping disease, seemingly without connection. The wildest rumors are flying around – Russian bioweapons are to blame, or the consumption of mnc-food, imported diseases of African refugees or a side effect of vaccinations. Pogroms and violence against minorities are on the rise. Patient 0, Bădescu, is now suffering from skin lesions, cerebral alterations and morphologic adaptations of his inner organs. His body has become sensitive towards bright light and his skin produces dark pigmentation. The WHO is still in the dark as to what the cause of the disease or the route of infection could be; they suspect prions.

2040 – First cases of the sleeping disease in Germany. Rumor has it that sleep deprivation could halt the outbreak. The WHO is now sure that prions are the cause and recommends isolation of the infected and an exhaustive decontamination of the affected buildings. There is word from the USA claiming the WHO insights are in truth fake news engineered by foreign powers in order to hurt the already struggling American economy. Authorities are trying to keep things under control with increasing levels of desperation: Curfews are imposed, the internet is censored, and looters are ordered to be shot. Public confidence in the media and the government is at an all time low.

2041 – The sleeping disease, now also called Black Rot, due to the skin alterations, is spreading rapidly. Hospitals are crowded with infected. Various governments are now willing to enforce quarantines and border closures after all. In Bavaria, SIGMA is taking control of the containment measures. The supply situation is critical.

2042 – News of the “Awakening” of the first dreamers go around the globe. Everywhere, their blackened bodies are rising, and they are shambling around without orientation, as if sleepwalking. Panic is spreading. Studies seem to confirm, that those who avoid the deep sleep phases can avoid the transformation. Some try to prevent the outbreak of the disease by not going to sleep at all or by exposing themselves to bright light all the time.

2042 – First in South America, than everywhere over the world, the same reports: Dreamers are attacking the healthy people. In a mindless rage, they beat them into an unconsciousness from which they won’t wake up again. Soon, their transformation also begins. Within a few days, public live collapses. Most of those who barricade themselves succumb to exhaustion after a few weeks and despite all precautions, fall into deep sleep from which they don’t awake.
Yet, some seem to be immune. A motley crew of four survivors has gathered upon the rooftop of a high-rise in the Bavarian metropolitan area, with one goal: To escape the city