Post news RSS Developing a Repeating Universe

Substream has a 3D universe which loops, letting you see an enemy in multiple locations at once. This is bringing some interesting problems to development.

Posted by on

Substream plays out in a universe which repeats endlessly in the horizontal direction. This a considered design approach I’ve discussed previously, and it's easier to understand in motion from the pre-alpha video I uploaded last year.

Everything in the Substream's environments is repeated in space, but unfortunately this has not just been a case of pressing Ctrl-C, Ctrl-V. Creating this kind of visualisation and getting things to interact with each other correctly has brought many interesting problems. Although the idea is that you never see the seam, in the code the game world is just a narrow strip. The terrain is 40 units wide and any object that moves sideways to -1 needs to have it’s position wrapped back to 39. You don’t see this shift happen because the world is rendered multiple times alongside itself, but it causes issues which need some thought.

Example One: Let’s say I’m working on the procedural terrain and I want to create a modifier that adds a circular hill. Observe my amazing MS Paint illustration...

If the hill is in the middle of the terrain (top) there’s no problem and it’s just like regular procedural terrain. If the hill meets the edge (middle) I need to wrap the hill. It’s even possible that the hill is wider than the universe (bottom). In this situation it will actually overlap itself, so here’s what a single circular 50-wide hill looks like in a 40-wide universe:

Example Two: I’ve recently moved to using DirectX 3D audio. This has made the sound a lot nicer and brought a better sense of space. But this means telling the audio engine the position of a sound. How should I make use of stereo speakers given that an explosion might be reaching you from the left and right simulatenously, and how should I implement that? Through a combination of reverb and sometimes shifting the position of the sound away from the actual position of the source, I’ve created an effect which is convincing enough, but a solution wasn’t immediately obvious.

Example Three: I implemented a homing missile which locks onto a certain target. When I first implemented this it would suddenly switch direction when an enemy jumped across this seam because the missile was now locking onto a new location. The missile also has a smoke trail, when the missile crossed the seam, the other end of it’s trail hadn’t, so when the renderer tried to join the ends together it drew a much longer smoke trail stretching right across the world.

Closing Notes: If this stuff sounds confusing to you, remember it’s a development problem not a gameplay problem. ;o) These are the kinds of issues I have to sort out so that when a player comes to the game the things I’ve put into this odd universe should look and feel natural and responds as you'd expect.


Cool idea, you could use a torus or Mobius strip as your logo.

Wouldn't the speed of sound effect when the player hears the explosion?

Reply Good karma Bad karma+2 votes
benbradley Author

@Arowx Hey thanks! Yeah the speed of sound does affect when you hear explosions. The speed of sound is pretty quick and further sounds will be dampened more so it kinda works out like a fast echo.

Reply Good karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.