Project Octant Part 6:Tiling

By Shamus Posted Friday May 11, 2012

Filed under: Programming 82 comments

So here we are, six entries into this series and we haven’t really done much in the way of making software. I actually find this kind of liberating. In Project Frontier I felt driven to get my core features in there. I like that this project is more an excuse for endless digressions. It’s a lot easier to navigate when you don’t care where you’re going.

Still, I guess we’d better get started with the actual thing and stop whinging on about technology and development platforms. First, let’s look at texture mapping…


(We don’t have a lighting system yet, so I’m just painting the sides of cubes darker than the top. That’s close enough for now.)

I’ve slapped the default stone texture from Minecraft onto this landscape so I can illustrate the thing I want to work on. As in Minecraft, flat stone can look kind of dull if you see too much of it at once, and I’ve deliberately designed this scene to show us way, way too much of it.

This texture is kind of bland. I mean, it’s a scattering of grey values that barely deviate from each other. Of course, this is by design. Notch knew what he was doing when he made his textures. Some well-meaning modders come along and try to make the textures more “interesting”, and you wind up with:


Which sends you right into quilt-world. Sometimes people try to compensate for this by bumping up the resolution. That can mitigate the problem, but it’s not a solution. The issue at hand is that textures repeat exactly one per cube-face, so looking at lots of cubes means lots of repetition. This isn’t a design flaw or anything. It’s part of Minecraft’s distinctive look.

But what if we broke from that? What if textures covered larger areas? Let me grab a random texture from Google image search and set up the texture system to stretch the texture over 16 blocks. I’ll be using this texture:


And it looks like this:


You can see that spanning many blocks lets us have large patterns. We could use this to have colored strata of rock or variations in brightness. I know my texture here isn’t ideal, but I’m content that this would look better with more suitable art.


However, this leads to some problems mapping textures. All this fancy detail will work against us if we can’t get it to line up. Think of it like hanging strips of wallpaper. We can put two strips next to each other, and their patterns will line up to create a seamless whole. But if some deformation makes one part of the wall “longer” than the other…


At the top of the wall the two strips line up, but then the one on the left has to fill an alcove, which covers 3 meters of wall instead of just 1. By the time we exit the alcove, the strip on the left has run too long and there will be an ugly seam where it meets its neighbor.

Texture mapping theory can get kind of dense. It’s basically a more convoluted version of the age-old map projection problem. Or I suppose it’s the map problem in reverse: We have a square image and we want to project it onto a complex world with as little distortion as possible. It’s not a problem you “solve”, but a series of trade-offs you juggle.

In Half-Life 2: Episode 2, Valve actually created a custom shader that would wrap a texture onto the complex topology of a cave. They did this so that an artist wouldn’t have to drive themselves mad trying to get rectangles to line up on stalagmites and other topologically difficult items. It just smears a generic rock texture all over everything.


This works because “rock walls” don’t have an expected orientation, and are very forgiving with regards to stretching. (Nobody’s going to look at the wall and think the rocks are “sideways” or “too big”. If you tried this with a brick texture it would look ridiculous.

We are not going in that direction. We’re aiming for low tech. We’re aiming for simple. We want something that will produce working results on shapeless rock and dirt, and also on non-rotatable stuff like bricks.

So here is my super-secret ninja technique:

int u = x + y;
int v = z;

I know, right? Brilliant. I’ve already filed for the patent and everything.

This is as simple as it gets. The texture follows the world coordinates. If you move one unit in the world, you’ll move one texture frame. Here, let me apply a test texture:


I suggest using a texture like this one whenever you’re dealing with texture mapping problems. It’s orient-able. (You can tell if it’s backwards or upside-down, which doesn’t matter in our case but can be a problem if you’re working on something where textures need to face a certain way.) The letters form a clear progression from left to right, so if your texture doesn’t line up you’ll see the letters stop following natural order. Same goes for the rainbow color-shift: If you see purple next to green, then you’ve botched something. If the textures are working right, both the lettering and color-change should progress naturally.

Let’s apply it to our world:


We’re just worried about walls right now, so I’ve made the floor solid color just to avoid confusion.


You can see the rows I’ve highlighted here. They line up whenever they meet, even though the walls have different shapes. You can see there’s a hole in the wall on the right, where an “N” block is missing. This means that row is longer than the other two, yet even then it lines up. The texture can wrap around a mountain, or a continent, or a one-meter pillar, and you’ll always be able to walk all the way around it without seeing a seam.

Here’s the backside of the hill:


Sure, the letters are backwards, but in the case of terrain textures this generally doesn’t matter.

The rule is simple: When we move east or north, increase the texture by 1 section. Corollary: If we move west or south, decrease the texture by 1. The only downside is:


Let’s assume we’re looking at a really big pillar from above. (Note also that the vertical arrow should point UP, assuming the top of the image is north. No big deal. The principle is the same.)

The problem areas are where you’ve got a wall running up one axis but down the other. It moves east, goes forward one letter, then it goes south, and goes back a letter, then forward, backward. It looks like this:


We we end up looking at repetition and mirroring. See what I mean about trade-offs? We’ve left behind the drawbacks of Minecraft’s texture system and are using a new set of drawbacks.

Lemme put a really busy texture up. Also, we’ll put a different texture on all of the surface blocks so we have even more contrast. Here are some high-contrast textures at work:


And here is the same hill from the “bad” side:


I’d say the texture itself is more ugly than the mirroring and repetition, so maybe this wasn’t an ideal test. Anyway. You get the idea.

Next up is something I’ve wanted to do for over a decade. Since my time at Activeworlds, I’ve always wanted to make a borderless tiling world. A world where you can go off one edge of the map and seamlessly enter on the other, where if you travel in a straight line you’ll eventually end up back where you started. The last time I saw that in a game was in Magic Carpet in the mid 90’s.

I like borderless environments so much better than games like Fallout 3 or Oblivion where it just puts an invisible wall around your playpen and tells you “NO!” when you try to leave. I also like it because it lets you walk around the world, which is kind of neat.

Let’s try it:


I guess… I guess you can’t show this off in screenshots. Oh! Unless I make the world really, really tiny. Let me adjust the size down, and build some distinctive landmark:


And if we look up:


The world map is 32×32 meters. Just enough space for a suburban house with a modest yard, I think. Our view reaches 144m in every direction. Keep in mind those question marks in the distance are the exact same question mark I have in front of me. They’re not copies. Those are the same polygons and blocks. If I break a block in front of me, I see it vanish from the pattern in the distance.

All three of my kids saw this in turn, and each one asked: Will you be able to see yourself like this?

Well, keep in mind that right now there IS no concept of a “self” model. Or any kind of model. There are cubes. That’s all we have, and there aren’t even any systems in place for drawing other sorts of stuff. (Items, foes, NPC’s, space marines, etc.) But if I keep with this project and if I follow the plan in my head, then looking all the way “around” the world like this would cause you to see everything except yourself. (Because your character model isn’t usually drawn in a first-person game.)

But this is academic. The point isn’t to make a bizzaro world where you can see things tile. The point is to make a borderless world, and this little stunt proves that it works.


From The Archives:

82 thoughts on “Project Octant Part 6:Tiling

  1. MilkToast says:

    You’re the coolest guy I don’t know, Shamus.

    1. You must know some amazing people. I, for instance, don’t know either Leonardo da Vinci or Bartholomew Roberts the pirate (aka “Black Bart”, aka “The dread pirate Roberts”; yes he was a real person and they really called him that). So while Shamus is very very cool, there are other people I don’t know who are at least as cool as him.

      Neat turn of phrase, though.

      1. MilkToast says:

        Yeah, Leo was a cool guy and all, but he passed away a while back… (Was that the 16th century? Geez time flies when you’re a half-a-millenium old…) :P Shamus is cut and a half above all the cool and living people I don’t know, because I like Shamus’ voice.

  2. FacelessJ says:

    Very cool.

    Just wondering though, why didn’t you multi-sample a large noise texture over the tiled textures instead? As in, draw the one repeating texture, but blend it with part of a large noise texture (Photoshop render clouds are perfect for this) to mitigate the visual tiling effect. You would still have the alcove problem, but only for the noise texture, which shouldn’t really be noticeable.

    Or was using one large texture another thing you had been wanting to try out?

    1. Shamus says:

      Multi-sampling requires shaders, which I’m not using yet. It might be feasible to have 2 different textures blend together, each mapped so that their “bad spots” are on opposing diagonals. I don’t know if it would be worth it, but it might be an idea to try later.

      1. void says:

        I keep hoping someone will make use of some of the principles I found here. Staggering things by prime numbers does an AMAZING job of breaking up human recognizable patterns. It isn’t perfect, but it does the job.

        1. Dasick says:

          *Jaw drops*

          *Texturing tool aquired*

          I now have an inexplicable urge to tile something.

        2. Anachronist says:

          That’s pretty cool, using prime-number sized tiles with transparent holes. That Lego army of thousands of unique Lego people amazed me; it’s made with just 3 simple small tiles. I actually went into the HTML page source of the example image to see how each tile looked.

        3. That’s really interesting. The cicada bit too.
          Totally outside anything I do, but I was glad to learn it. (Which actually describes my reaction to Shamus’ posts on this kind of stuff)

        4. scowdich says:

          I now really want wallpaper designed on that principle. Is there such a thing as bespoke wallpaper?

  3. Jan says:

    Ooh! I recently thought up a game concept using tiling, but being the freak I am, I thought to use a non-orientable tiling (i.e. left and right interchange at each border), and of course the next step, non-periodic tiling, for example the Penrose tiling.

    Probably bizarre, hell to code and very confusing for the player, but I’m interested in how it turns out.

  4. Narida says:

    You obviously need 3D textures :-D

    On a related note, there was an interesting video on the Wolfire Blog (at about 1:00)
    The textures don’t strech when the object is resized, and they even manage to have no seams^^. (Video explains it better than I do xD)

    1. jwwzeke says:

      Good description of a detail texture mapping technique here:

      I had assumed that’s the technique they’re using… but those Wolfire guys are doing all sorts of crazy-cool stuff, so maybe they’re using something different and/or better. Not sure how the “seamless” aspect gets worked into the technique found above.

      1. Anachronist says:

        Wow… an indie game that looks like one of those multimillion dollar ones ones. Cross-platform too. I have a feeling though it will require some specific graphics hardware though, unlike Shamus’s project here.

        1. Pete says:

          Wolfire also did a post on detail textures here:

        2. Tharwen says:

          There are loads of people playing the alpha right now, and as far as I know there haven’t been any major hardware problems.

  5. Knight of Fools says:

    I don’t think the mirroring looks too bad – It almost looks organic, since layers of rock tend to repeat anyways. It’s like a natural jut of rock displaying a few thousand years of layering.

    It might get a little odd when looking at an entire wall that does it, especially an artificial wall, but it’s much more elegant than Minecraft’s tiling, which I rather dislike.

    1. Sleeping Dragon says:

      I’ve recently been having fun with some mods that add ruins and dungeons and other stuff like that to minecraft and the moment I saw the “bad side” of the hill with textures I immediately thought it looked like something out of one of those. This could be partly due to looking for such buildings in my MC maps recently, partly due to it sticking out of the green part of the hill and having sucn an even top but I think the repeating texture kinda amplified the effect and it just screamed “non-natural formation” to me.

  6. DGM says:

    >> “It's a lot easier to navigate when you don't care where you're going.”

    Hopelessly lost, but making great time! :P

  7. Jack V says:

    Oh, awesome.

  8. Abnaxis says:

    Since my time at Activeworlds, I've always wanted to make a borderless tiling world. A world where you can go off one edge of the map and seamlessly enter on the other, where if you travel in a straight line you'll eventually end up back where you started. The last time I saw that in a game was in Magic Carpet in the mid 90″²s.

    I don’t know about first person games, but there are plenty of rpg/adventure/strategy games that do it. Every Final Fantasy game with an overworld map and Zelda Wind Waker both come immediately to mind. Also, Civilization.

    Are you just going for wrapping in first-person view?

    1. Shamus says:

      Right. Tiling in a first-person world, which is kind of unusual.

      1. Kell says:

        A tiled world is exactly what I think of every time I see Minecraft. Same with having a finite, albeit large, world. As I posted in one of the Frontier threads, having an ( effectively ) infinite world makes it almost totally meaningless. Minecraft is a cool premise and a good engine, but a frustratingly underdesigned game.

        I’ve usually been imagining a procedurally generated but polygonal ( i.e. not blocky ) island world a la Frontier. Or that cellular one someone linked to in another thread. So the world grid tiles only across water at the edges.
        But I think having a block world that tiles regardless of terrain type is cool. Depends on what else ends up in it…

    2. Thomas says:

      The overworld maps are going out of fashion though, was the last one FFIX? I mean that’s 12 years ago, only 6 years after magic carpet. I have to admit I find the idea kinda exciting, Skyrim where you’ve got the whole world somehow just feels so conceptually different.

      And if you reduce the scale of the world to just a little bigger than his example I bet you could make a great small scale puzzle game out of the mechanics. Even if you make it a little bit bigger, so you can’t see round the world, the whole idea really suits itself to an adventure game where changing the world is a big part of the mechanics because you can walk all over it and eventually make it yours

      1. Amstrad says:

        Mario Galaxy often uses the mechanic of sticking Mario on the outside of small spheroids with various puzzles attached to the idea that you can easily run completely around the outside of these little planetoids.

  9. Chuck Henebry says:

    Your borderless repeating world reminds me of a VERY cool recursive drawing app that I stumbled across yesterday, designed by Toby Schachman.

    If you’re interested in recursion (and what coder isn’t?) this app is perfect for explaining to newbies the power and unexpected results of basic recursion. For it presents recursion visually, and in a way that encourages users to play with it and instantly see the results.

    Schachman’s video demo is amazing.

    1. Jarenth says:

      That was an enjoyable half hour. Thanks for the link!

  10. some random dood says:

    Just in case anyone is curious, has Magic Carpet available for sale. If I remember, the game also has a 3d mode using the “magic eye” technique (the one with lots of dots where you have to somehow unfocus your eyes to see the scene. As you may guess, I’ve never been able to see those images).

    1. Thomas says:

      :( Bullfrog, they created so much awesome in so little time, I can’t wait until they get around to releasing Theme Park World on GoG

    2. Zehavn says:

      Magic Carpet was my favourite game until I discovered TIE Fighter. I must have beaten that one a dozen times.

      I’d like to see it rebooted…


  11. anaphysik says:

    Periodic boundary conditions, oh yeah.

    (Anyway, besides technical reasons, the lack of wrap-around for games like FO and Oblivion is obvious: it wouldn’t make any sense unless you include the actual entire world (Earth / wherever-the-hell-Cyrodiil-is). Pac-Man got an easy out by making it’s lore-filled world so small.)

    1. Dragomok says:

      I second that notion.

  12. Dasick says:

    Haven’t you already solved the problem of repetitiveness?

    There was a post where you suggested having a “close-up” texture and a “break-up” texture, where one texture is really detailed and tile-able and the other is a low-res transparrent blob that you stretch over the tiled bricks to break up the monotony.

    I just spent 20 minutes looking for it, and haven’ found it.. but I did re-discover a lot of interesting stuff you wrote in the past. Also, can’t believe that your “Emergent Gameplay” post has no comments.

    1. Dasick says:


      Seriosly, why isn’t this a solution to your repetitiveness problem?

      1. Shamus says:

        If I used a second texture to hide the mirroring, then I’d have to make that second texture line up with itself to avoid seams, which means I’d be right back where I started with textures not lining up.

        Actually, you might be able to set up a couple of textures with opposing directions so that the bad diagonal for one was the good diagonal for the other. But that’s a problem I’d rather investigate with shaders. Which would come much later.

        1. Dasick says:

          I’m talking about texture mapping (first image). I assume the mirroring problem comes when you try to apply the nice rock texture over multiple cubes.

          If you use a second “break-up” texture the same way you set up the fourth image, you don’t really need to worry about mirroring or lining up – the “break-up” texture is just a bunch of random noise stretched out to make the texture less monotonous. Does it really matter if it doesn’t line up or if it mirrors?

          1. As with some of the stuff Shamus was saying this about already, I suspect that’d be fine for rocks, terrible for bricks or abcdefghi. That’s why he’s testing with abcdefghi, so he can make sure to get something that’s OK for that kind of pattern too.

            1. Dasick says:

              The technique Shamus describes in the article is actually demonstrated using bricks. And it works marvelously.

    2. PAK says:

      No comments! That does seem somehow sacreligious. Googling for articles on emergent gameplay and stumbling upon that very post was how I first fell down the Twenty Sided rabbit hole, a little over five years ago.

  13. X2Eliah says:

    Hm. borderless small-size worldspace seems interesting. On a first thought, There’s some potential for a bit of fun with lab rats & mazes – have a worldspace containing one “maze” with no exit, yourself just monitoring or slighty interacting from above, each maze having one ‘rat’ (just an npc creature with the objectives to ‘scurry’ and ‘activate’ those parts of environment that can be activated (levels, destructable blocks, traps).. Maybe drawn to a “foodsource”, which on “eating” makes that npc to fall asleep for a few turns – over time, the npcs will, even if following the same logics, to fall out of sync and arrive to different decisions, even if at the start all are going for the same foodsource).. In this way, let’s say we have 16 mazes, the npcs would affect not only their maze, but everyone else’s too – but since consumables act only on one npc at a time, eventually the behaviours, survival dispositions, progress, would be different in each maze.

    Probably would be awful to play, now that I think of it. There’s not much gameplay there beyond the fascination with ai routines and their interactions leading to chaos, seeing what probabilities are true and what worldrules are actively derived. Would depend a lot on the ai features the npcs would have, though.

    1. jwwzeke says:

      So the gameplay part becomes either:
      1) Figuring out the motivations for the AI decisions and altering the maze or activatable (look I made a new word) parts to get the desired result.


      2) Altering the AI through a scripting language to overcome built-in obstacles.

      So you’re playing as a Psychologist testing and altering behaviour, or as an ant/rat trying to get the food.

      Sounds fun either way to me. :)

      1. X2Eliah says:

        Indeed. The desired result itself could be a non-stop state, even, with failure being associated by exhausting the resources (ai units, world itself).

      2. Altering the maze? This is starting to sound like Portals.
        (Which, by all accounts, is a Good Thing)

        1. Thomas says:

          The idea of AI is so fun I just want to make and watch AI. If I understood what was going on behind the scenes that’s all I’d need

  14. 6b64 says:

    Do I get it right that from a topological point of view Shamus’ world is a torus now?

    1. X2Eliah says:

      Hm.. I don’t think so, unless topological torus is not equal to, well, a torus.

      There really isn’t a single physical 3d figure to dexcribe this, since a tiled repeating flowing flat world goes beyond the regular 3d space concept (I mean, this of it this way – shamus said that the worldtiles are not ‘copies’, that an action impacts the world at all points it resides in. And yet you see that there are copies of pixels on your screen, showing two differently placed images of logically the same thing. What could be said to be occurring is that objects in Shamus’ world occupy more than one place at the same time. As a result, you percieve it as being in multiple places, and you can effectively have multiple distances and even angles to the same object or world-coordinate. All of that goes a bit away from conventional physics and physical objects.)

      P.S. This got me thinking – Shamus, right now you are tiling the world at a flat pane. Can you tile it at, say, pseudorandom angles (perhaps just random in a reasonable limit, say, no more than +-15 degrees off of the adjoining tiles)? I suspect it could make for some neat topology. Hell, if that manages to create an Escherian world in some way, all the better – far too few games abuse and sidestep realworld physics.

      1. Demo says:

        Actually it is a torus (or rather a torus cross an interval, since it’s got height). Whilst you’re used to seeing a torus embedded in 3-space as a ‘doughnut’ shape, a torus is actually flat in a geometrical sense and if you stood on a torus with light rays following geodesics then it would look like the repeatedly tiled world from the screenshot.

        Also, there really should be a character model in the ‘other’ tiles, since those are really the same space as where the player’s character is.

        1. X2Eliah says:

          Which is why I said “unless a topological torus is not a (realword physical) torus”. Rays of light don’t tend to follow curves, after all.. I bet if rays of light followed geodesics, then a sphere such as the earth wouldn’t topologically be a sphere either.

          1. PAK says:

            The confusion springs from the OP’s use of the term “world” which you interpretated to refer to a physical surface, like a planet (not an unreasonable interpretation!). However, I suspect that both the OP and Demo above were speaking in terms of the geometry of space…which a cosmologist would describe as being torus-like (just as discussions of the cosmology of our real universe describe a “flat” universe model as being “saddle-shaped”).

            1. Adam F says:

              I haven’t seen enough saddle shaped game universes

              1. Bryan says:

                …Where pi isn’t equal to pi!

      2. 6b64 says:

        The way I heard it: “The doughnut-torus is an embedding of the topological torus in 3D space”. But yes, these concepts are quite inconceivable.
        And I wish too that games would use sometimes 3+ dimensions, non-euclidean geometry, or unusual topologies (I heard about an indie game which uses 4 dimensions for its game mechanic).

        1. I believe for topology the point is, where you end up at if you walk places is the same for both, therefore they’re the same.
          So like, if you walk around the edge of the square, it’s the same as if you walk around the top circle of the donut, but if you walk across and end up in the same place again, it’s like walking down into the hole and to the bottom and up to the top again on the outside.
          Or something . . . I’m a little iffy about how different paths around the donut (outer edge, along the top, around the inner “hole” side, along the bottom) map to different paths around the square; what does the centre of the square correspond to?

          1. Demo says:

            Imagine two circles on your doughnut torus. One goes ‘though’ the hole in the middle and one goes ‘around’ the hole. Call these circles A and B. Then a square maps the the torus as
            ………………. A
            .. |///////////////////|
            .. |///////////////////|
            B v///////////////////v B
            .. |///////////////////|
            .. |///////////////////|
            .. ——->——————
            ………………. A
            so the two sides labeled ‘A’ map the the circle A, matching
            the orientation of the arrow and similarly for B.

            1. Tektotherriggen says:

              To really mess with your head, now reverse the direction of the bottom “A” arrow.

              ………………. A
              .. |///////////////////|
              .. |///////////////////|
              B v///////////////////v B
              .. |///////////////////|
              .. |///////////////////|
              .. “”””-<“”””””””””””
              ………………. A

              You've now mapped the square to the Klein bottle! You can walk North and get back to where you started, but your left and right will have been flipped. So you can’t read the newspaper you left behind, and need to make the round-trip again.

              Game mechanic idea: many of the molecules in our body are chiral: they have left-handed and right-handed versions, and only one of those versions is used. Important food molecules (like sugar) are also chiral, and don’t work with the wrong-handed molecule in your body. The occasional sci-fi story features someone who gets mirrored, and will starve to death (through being unable to digest anything) unless they are mirrored again.

              So: your Klein-bottle game world is filled with left handed food (and potions, and magic-spell books, and monsters, and whatever) that you can eat and drink (or can eat YOU), and right-handed ones that you can’t (right-handed monsters know your indigestible, and ignore you). It so happens that, near your home town, the right-handed stuff is much more powerful or dangerous than the left-handed stuff. Your quest takes you North (chasing some bad guy, perhaps), and eventually you return home all armed and levelled-up to face the Big Bad who is attacking your folks. But NOW the right-handed monsters notice you look tasty…

        2. Dragomok says:

          And I wish too that games would use sometimes 3+ dimensions, non-euclidean geometry, or unusual topologies (I heard about an indie game which uses 4 dimensions for its game mechanic).

          I secretly hope that Shamus somehow will end up making Lovecraftian-esque island tour simulator.
          In 13D.

          1. arron says:

            Portal already adds “wormholes” to 3D worlds, although they merely link parts of the world together.

            I did see an interesting article in New Scientist about using dimensional tears to move from dimensions to move through material that is impassable in one dimension.

            Also once you’ve factored in time as well, you could have a game where the procedural cube environment is dynamically hostile by changing over time. Survival is through escaping to alternative dimensions to avoid being killed through rapidly changing gravity/pressure/temperature or mass that is changing towards you, and setting up time loops to avoid end of universe by jumping back in time to alternative dimensions. I’ve no idea how that could turn out, but it wouldn’t be dull..

            1. Thomas says:

              I just remembered, Anachronox has an Escherian space station. You walk to a wall and suddenly the wall is the ground and the staircases are floating round your head and so on :D Bit of an old game though so it wasn’t very fluid

      3. some random dood says:

        re Escherian world. Just reminded me of a cartoon where a Health and Safety inspector says (against the famous Escher backdrop), “I’m sorry Mr. Escher, but you will need to fit wheelchair access”.

  15. Kian says:

    While tiling is one way to revisit where you were, why not make the world a big cube you can walk around, for example? Or is the idea to pretend the world is large enough that you can’t see the curvature but small enough that you can come back to where you started in a reasonable amount of time? Also, wouldn’t you then have to make the top and bottom, and the sides, match up so there’s no obvious break when you go from one to the other?

    1. Burton Choinski says:

      I wonder how your system and projection would look if you used ringworld dimensions (1M mile wide, craploads of millions around). Could you even model it, or would the system just explode? Would you see the arch? :}

      1. Depends on the resolution, doesn’t it? It doesn’t matter how big it is, it matters how many pixels it takes up. Make the thing one pixel wide and you’re fine, although you lose a teensy bit of detail.
        A whole ringworld at a sane human-scale resolution . . . yeah, that’s kind of big.

        1. GM says:

          I read Ringworld as Discworld :)

        2. Thomas says:

          But that wouldn’t be the fun sort of ringworld even. I bet you could make one small enough that you can make out details of the world above you. You could combine that with Morrowind super jumping and revolutionise insta travel :D

          1. WJS says:

            Isn’t this basically just describing HALO?

  16. Zak McKracken says:

    Hmm… and here I thought you’d be using the Perlin (or rather not-quite-Perlin) noise for just this purpose…
    I think you still remember trueSpace? That was using 3D noise functions or other procedural elements to generate 3D textures. Like wood oder bricks or marble or whatsit. You specify a random seed, a few parameters to govern the character of the whole thing (horizontal plane for brick, tree centerline for wood, scale,…) and there you go!
    I guess the results could be either baked to proper textures (which would need lots or RAM, I think) or just evaluated whenever a pixel is rendered, which should run quickly because you don’t need to do it for the whole world, and at the same time will give you effectively infinite texture resolution.

    … am I over-simplifying?

  17. arron says:

    What would be cool (but probably bloody difficult) would be rather than walking around a continuous landscape is to remap the geography such that you could effectively wind up walking around some very strange the art of M.C. Escher, House of Leaves or even the TARDIS where you have what appear to be continuous dimensional spaces mapped inside each other.

    It would certainly provide some texturing challenges having a cave opening leading to a network of tunnels, on a wall that is too thin to support them.

  18. Tektotherriggen says:

    Some 2D games like Terraria and Maple Story have every type of texture (say, rock) coming in several varied tiles. Each tile has identical borders, so any tile can sit next to any other seamlessly. When drawing a large area, each grid space is covered with a randomly chosen tile, preventing regular artefacts.

    In 3D, you could make a few variants of each type of block texture, and randomly assign each block to a variant on world creation (or when the block is first revealed). I don’t know how easy this would be, but it probably isn’t too much extra work considering you already have two types of block (grass and rock). The most work would probably be drawing the textures.

    1. Dasick says:

      Void already linked to an article that deos that very efficiently.

      You start out with a base tiling texture. Then you add another tiling texture that has a prime-numbered white-space offset at left and right (so it repeats only after certain intervals). You keep adding tiling textures with increasing prime numbered offsets until you are happy with what you have.

      1. Caffiene says:

        Tekto isnt talking about tiling. Hes talking about a situation where for each possible placement of a texture you randomly select from a set of interchangable textures, instead of repeating the same texture.

        The Cicada article is cool, but it is still based on tiling the same texture one next to each other. It has a few textures on top of each other, but they arent interchangable within the same layer.

        1. Dasick says:

          Right. But randomly selecting a texture eats up a bit of CPU. Chump’s change by today’s standards, but a penny saved is a penny earned.

          The thing about the cicade thing, is that for all intents and purposes it is random, ie the human brain can’t detect any form of pattenr emerging from it. It runs super-fast (in the pbrowser at least), with no need for any additional logic and eliminating the need to store additional data, like which variant of the texture are you using, and if you have the proper brush loaded to paint the texture.

          1. Tektotherriggen says:

            That prime-ratio texturing site gives an extremely good result for such a simple principle. It’s clearly ideal for website backgrounds, and would probably be useful (and easily combine with detail textures mentioned earlier) for highly realistic 3D games to ensure all areas of a grassy field, brick wall etc. look different.

            But as I understand it, it does nothing to solve the problem Shamus has at the end where two sides of a pillar have repeated/reflected textures. That’s due to repeatedly sampling the same piece of a large texture, and a never-repeating texture would also suffer that problem. He’s building a cube-based world, so a cube-based solution seemed natural to me. To get 8 variants of each 1m*1m texture would only require 3 extra bits to be saved/generated per cube, and only take half the texture-memory of using 16*16 textures (as he tries halfway through). That MIGHT hit a hardware bottleneck and slow things down, or it might not.

            Earlier, Shamus posted:
            “Multi-sampling [needed for detail textures AND prime-ratio blending] requires shaders, which I'm not using yet. It might be feasible to have 2 different textures blend together, each mapped so that their “bad spots” are on opposing diagonals. I don't know if it would be worth it, but it might be an idea to try later.”

            If he does move on to use shaders, it would indeed be cool to add the prime-ratio idea.

            1. Dasick says:

              I must be really stupid because I seem to be missing the point… but wasn’t the mirroring problem non-existant when Shamus was working with simple tiling (first image)?

              1. Tektotherriggen says:

                I may be stupid too, but the way I understood it, his first attempt was a 1m*1m texture (i.e. it exactly fit on every side of every cube). There was no mirroring problem, because the texture repeated EVERYWHERE.

                Then he tried a texture that covered 16 blocks and… I’m not sure how he TRIED to map that texture to the surface, but he says it had problems matching up when the surface had lumps and bumps. The diagonal method was his way around that, but lead to the reflection on “bad” diagonals.

  19. GreyDuck says:

    I played a bunch of Terminal Reality’s games which had “looping” maps, starting with Terminal Velocity (and its Microsoft stepchild, Fury3) followed by the Monster Truck Madness games. Looping the world was one of the things I enjoyed doing, especially in MTM so I could get a REALLY long run-up to a particular “jump”.

    Hmm. I wonder if I could get those games to work again…

    1. Bryan says:

      Terminal Velocity works in dosbox… or at least, worked in dosbox on my Linux setup about a year ago when I played through it again.

      Took a lot of CPU to run, and couldn’t run all that fast, but it did work. :-)

  20. Johan says:

    “I like borderless environments so much better than games like Fallout 3 or Oblivion where it just puts an invisible wall around your playpen and tells you “NO!” when you try to leave. I also like it because it lets you walk around the world, which is kind of neat.”
    Hmm, I dislike borderless worlds for exactly this reason. Letting you walk around the world always makes it “feel” small, even when the gamespace is the same size or bigger. In Fallout and Oblivion the gamesize is an incredibly scaled down version of the real world. “Cities” never have more than 100 people. The entire world could live together in a single apartment complex (hey that sounds like a good sitcom idea). But this never pulls me out of the world because the entire game is a scaled down version of what I might find in reality

    By contrast borderless gameworlds seem to “break” this for me. Since I can’t walk around the real world, it just feels “wrong” when it happens in the gameworld, and I’m left thinking “huh, it’s really this small?” Being able to walk around it brings this thought to the forefront of my mind in the way that dozen-person-“cities” doesn’t really.

    Different strokes I guess

    1. Thomas says:

      It’s a context thing, for games where you’re aiming for scope and realism you need borders (and they should be epic borders at that), whereas if you want people to feel comfortable and in control of their world borderless is the way to go.

      I wish games did more with fantastic geometry. Books and films were always held back from hardcore fantasy because we either need common points of reference to understand or the budget would be huge and drag the quality of the film down.

      But in games you can have literally flat worlds, a land surrounded by impossibly high cliffs, ringworlds, world with another world hanging in the sky that you can watch. Escher worlds, donut worlds. Giant cauldrons, ridiculous peaks which you can work up vertically.

      To be fair some JRPGs have tried this sort of thing FFXIII had a world within a world and a world you can see from land, it just didn’t do much with it and Resonance of Fate had a whole world on a giant clocktower but was too low budget for it to be quite so awesome

  21. MadTinkerer says:

    “The last time I saw that in a game was in Magic Carpet in the mid 90″²s.”

    The first time I played a game that did this was Ultima VII*, which proved that it really works well on a game-global scale. Although certain critics have pointed out that this actually represents a torus-shaped world rather than a globe, it’s plenty good enough in my opinion.

    There are a few more recent games than Magic Carpet, such as Populous: The Beginning, Black & White, Spore, and other games which simulate or give the illusion of literally global levels, but they are few and far between.

    *Technically, Robot Odyssey was even earlier, because they actually point out in the manual that the Subway is torus-shaped, but RO’s game engine doesn’t let you see between rooms so it doesn’t count.

  22. Mersadeon says:

    Ok, so first off: I don’t understand everything you write in your Project Frontier and Octant posts, but I still find them interesting. That really shows that you can make stuff relatable (I loved your “drawn to knowledge”-videos) without losing the interest of people who DO understand how this stuff works.

    Seeing the last picture, I had to think of a video about Non-Euclidean Level Design I saw a while ago.

  23. DL says:

    I think it might interest you that there are some fast algorithms for example-based texture synthesis. These would basically allow you to make an infinite textured plane from a (comparatively) small example without any seams or noticeable repetitions, thus avoiding the quilt-world effect on pretty much any magnification.

    A good and fast one for this particular purpose was developed by Lefebvre & Hoppe (a description is available at – it’s a lot simpler than it may look from the equations, and you don’t really need any of the extensions).

    Additionally, the same two blokes have developed a variant that synthesizes not on a plane, but on an arbitrary surface flattened to a texture atlas ( ), which would solve your problems with “bad” sides in a nice and extensible way.

    Hope this helps.

    P.S.: I’m currently working on getting a Ph.D. in computer graphics and I have to admit that your blog was a huge inspiration for me even before I started down this path. Sure, given my education, most of what you write about is not news to me (and there are points I disagree with), but it always feels good to watch someone take the stuff and run with it just to see where they can get, like you do with this project.

    Please feel free to contact me, I would be honored to either serve you as a sounding board, help you look anything up in my science-y sources, or what have you.

  24. Neil Roy says:

    I actually created a simple 3D terrain and made sure all the edges matched the opposite edges then I just copied the world on all four sides. When you walk and reach the end of the world you get teleported to the other side, but because you see a copy of the world coming towards you, it is seemless, you just keep on walking forever. And of course I just re-used the same data on all 8 sides (4 sides, plus the corners). I am still not as competent at 3D programming as you are, but it works really well, and the larger the world, the less noticeable it is. I originally got the idea from the game Battlefield 1942, which had fairly simple 3D. It still had limits on how far you could travel beyond the border, it didn’t wrap you to the other side, but they copied the world (minus the buildings, trees etc…) on all four sides so you had something to look at off in the distance (they have fairly small maps and this gives the illusion of them being larger). I noticed one day when I used a mod on the game that gave jet fighters rather than the normal slow planes that I was able to fly much further off the edge of the world and I made it to the copy of the island (complete with pre-rendered shadows, but no buildings). That’s when I came up with the idea to use the same idea, except with a larger map and allow wrapping around.

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun. Your email address will not be published. Required fields are marked*

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>

Leave a Reply

Your email address will not be published.