X-Town Tactics (super early access)

Ohoh, thanks @mawa for reporting.

The first one is alright. These are missing files I am not including right now.

The second one is an issue. Promise.withResolvers() is a relative new browser feature from last year. Your browser version does not support it yet. I have polyfilled it manually and it should work now. But I do not have a general (automated) solution yet in order to prevent this from happening again; other than being hopeful. :pray: Need to think of something…

1 Like

Ok. No worries then. I was on my legacy rig (the one I use to check on the min requirement for my BJS scenes). I’m not sure who still owns a rig that’s this old :rofl: I will give it a try later on something that’s more ‘reasonable’ specs for gaming :joy:

1 Like

Thanks :smiley:

Making-of procedural level generator

After countless iterations I think I am getting somewhere.

District generator

First rough division of the whole map into districts or sectors. If the map is in a town, there could be residential or industrial districts. Or if the map is in an outpost, there will be a center district and possible theme-related satellites (e.g. raider outpost with an outside junkyard).

Concrete districts, as well as biome, faction and mission parameters, provide constraints to the buildings and objects available to the level generator.

District layout generator

Now subdivide districts into building plots. In a town map, it is just another split of the district in which the plots are placed. In a raider camp, building plots for tents or shacks are arranged around the center of the center district.

Building generator

So far it was all about placing and dividing rectangles. Squarified binary space partioning was used for most of the splitting.

But now buildings need to be placed into plots. There will be up to four building prefab types:

  • complete tile: can be placed as is
  • complete modular tile: like a complete tile but e.g. cut in half. Variations due to different halves that can fit together.
  • modular rooms: prefab rooms that need to be fit together and walls that need to be generated around
  • all procedural: needs lots of constraints for room arrangement and object placement. Lot of code upfront with uncertain outcome (i.e. getting randomness under control).

I have been working on points 1 and 2. If there is enough variation, I will stop there, otherwise move to the next point/s.

Terrain generator

I must have been struggling with deciding on how to do ground terrain for months. The one thing I did not think of all the time: just draw everything on a dynamic texture! You then have 1 ground plane and 1 terrain material (i.e. 1 draw call). You have all the texture channels you want. You can use texture decals for ground effects (!!!).

What could possibly go wrong

What do you think? The concept is new and might be full of plot holes (lol, pun intended). :grin:

3 Likes

Making of procedural level generator II

Last time the procedural level generator worked like this:

  • generate districts
  • generate building plots into these districts
  • also use district/plot info for dynamically drawing terrain

Most importantly this breaks down procedural level generation into creating and layouting rectangles.

Limits of rectangles

However, what do you put into these rectangles? This turned out to be a road block. Because then if you revert to randomly picking prefab tiles, well, you will get (too) randomly and illogically placed buildings; like a guard tower in the middle of the camp…

Now what

The rectangle approach per se turned out helpful. I at least know where to put stuff. And if anything, it ensures stuff will not clip into each other. So no ditching of rectangles. The question became how to steer the choice of buildings to be more plausible.

For now I have opted for a “needs” approach. The purpose of a procedurally generated map is given by a mission. That mission provides a ton of parameters; for instance biome, fortification/s or number of enemies. So if there is a raider camp, it makes sense if there are some “food” related buildings. Raiders also need to “sleep” somewhere. Therefore prefab tiles get some data about what needs they fulfil. A tile with a couple of tents fulfils some need for sleep, etc.

That is where I am at. It is not enough, I know. A guard tower can still spawn in the middle of the camp. Solutions are still just in my head. It would be cool if something with “attractors” could work - where attractors would be based on the needs. For instance, “food” buildings are near “sleep” buildings whereas “defense” ones are furthest out.

If that does not work out, I will probably go for something with Wave Function Collapse. Certainly beneficial for PR reasons (“Hey look I am using WFC”) but requires more extensive setup of relational data (tile/prefab matching rules).

Also

You know what is missing too: the actual tiles! Sure if you are an artist and/or a talented level designer, you do not see a problem here. But for me this the upcoming next chunk of hard work. I have been following this general procedure:

  1. Gather (google image search) a ton of screenshots of low poly scenes (different themes like desert, forest, but also camp, urban, etc…)
  2. Rebuild full thematic maps - as if they have been produced by your procedural generator
  3. Slice the full map into re-usable prefab tiles

Anything else?

What do you think? Spotted anything I could rectify… (like not enough puns or so)?

2 Likes

Yes, well it’s mostly execution work for a designer once the style is defined. It would be ideal to handover to an apprentice or junior :grin: :face_with_hand_over_mouth: :joy: …But more seriously, I wonder if this last step could not be handed to the AI? Sounds like something the AI could collaborate, I imagine with some pretty reasonable results (providing we feed it with all the base tiles and a couple or few integration samples) :thinking:

1 Like

Imagine it’s not :smiley: I am not going to worry (too much) about concrete style at this point. Otherwise I’ll be going crazy. You know, one could question whether raiders on a desert planet would build wooden palisades around their camps…

But eventually a “fence” is just a variable that will become a mesh. If I set in stone, that all fence parts must be within a 3x2x0.2 box, then the actual mesh, or the style, is irrelevant. The same plattern can be applied to plants, trees, streets, etc.

The advantage is I can keep going and do not need to plan out everything in advance. So, my project management approach is as pure to Agile as you can imagine. Would I prefer pure Waterfall? Oh yes, I would. But I don’t have the creative potential to flesh out, upfront, all the detalis.

Hmm, I am wondering what would be an AI query here? @CodingCrusader may I summon your AI super powers?

It is not really the modular level tiles per se I need. If I had a full level, I could tile that myself. So do I need AI to make or draw an entire level? I think yes, that would be cool.

What do I feed it with? Hm, so are we talking Generative AI now? From a set of, e.g. top-down views of existing levels, generate variations. Like that?

Or simpler? Technically, it would suffice to have any screenshot of a good Raider camp or a military base. So what kind of AI generates “layouts”? What is the category? Camp layouts, base layouts? Groups of buildings arranged in a meaningful way? What is meaningful? A raider camp is sort or chaotic where as a military base is more orderly (I’d imagine).

Oh, idk if this is going somwehere :thinking:

You can tell the AI that it is part of your programme and should convert your verbal instructions into a JSON format.


Me: You are the architect of a landscape. Create a random map and give me the answer as a JSON structure that I can use in my babylon.js code.

ChatGPT:

{
  "terrain": {
    "width": 1000,
    "height": 1000,
    "features": [
      {
        "type": "hill",
        "position": { "x": 200, "y": 300 },
        "radius": 50,
        "height": 100
      },
      {
        "type": "hill",
        "position": { "x": 700, "y": 400 },
        "radius": 80,
        "height": 150
      },
      {
        "type": "river",
        "path": [
          { "x": 100, "y": 900 },
          { "x": 150, "y": 700 },
          { "x": 300, "y": 500 },
          { "x": 600, "y": 400 },
          { "x": 900, "y": 200 }
        ],
        "width": 20,
        "depth": 10
      },
      {
        "type": "forest",
        "position": { "x": 400, "y": 600 },
        "radius": 100,
        "density": 0.8
      },
      {
        "type": "village",
        "position": { "x": 800, "y": 200 },
        "buildings": 15,
        "size": 200
      }
    ]
  }
}
3 Likes

Oooh, it can do json. I think I need to have chat with it… :money_mouth_face:

1 Like

Well, there are at least two different use cases you need to distinguish first.
It’s because you said ‘procedural’, I thought it was an ‘assembly’ of tiles (similar to say i.e. sid meier’s civilization). Means you need to work the integration of connecting tiles and, ideally, want to make it in not just a blurry or fixed mask integration manner. But have something more ‘random’ while still ‘integrated’ or ‘seamless’.
But a random map can also mean, a full map that’s randomly generated around some conditions for ‘level design’. Speaking about this type of game (tactical), and this is my opinion only, I’m not a huge fan of procedural maps that would eventually not fully acount ‘level design’. A good tactical map is essentially based on a good ‘level design’. Accounting everything from the move points, to the skills and perks to provide open areas, covers, low covers, etc…
In this case scenario, I was thinking that may be you could draw something like a nav mesh - or a level design base, so to say. And next feed it to the AI along with the different textures for drawing surfaces and ask it to draw a map from it. May be it would require to be done in two steps. First including all 3D objects, such as walls, houses, camps, crates, etc… And then feed it again with this source and request to draw just the ‘terrain’ - and then you would add all objects on top of it. Honestly, I’m not all too sure if and how you can do this. The point is the older I’m getting the less I’m willing to do a lot of ‘execution’ work :face_with_hand_over_mouth: And I believe the AI is typically made for that/this way. The neural system is made so that you feed it with a number of sources and it would ‘extrapolate’ from there. So, as much as I wouldn’t (yet) hand ‘level design’ to the AI, I believe it should be capable to create fairly good design from your input. :face_with_hand_over_mouth:

1 Like

@mawa You can mix the two :money_mouth_face:

I did have a pure tile “assembly” approach. It did produce camp walls, entrance, camp center and filled up random other buildings. But eventually it was just too similar. For city layouts I needed to add more and more constraints which killed off randomness this way. Bascially exactly what you said: there was no “level design”. Big disclaimer though: I just might not do it properly and there could be made great levels with it.

The second appraoch you describe is a bit like what they did in X-Com2 with the plot/parcel system. They provide a rough layout, or “nav mesh” like you said, of the map and then let the generator fill in the details: using assembled tiles and prefabs.

I do have sort of an idea how this works out in city layouts. But for wilderness levels or more chaotic Raider camps, I find the Xcom-approach difficult to adapt.

Anyway, at this point, I think the layout-question is “the” question. Where does the raider camp go, where the player spawn. In the raider camp, where do they sleep, eat, is there one entry or two? Or where does the forest go? How dense? If I could get ChatGPT to give me a couple of these layouts, that would nice.

Yes, exactly, this is what I want the procedural generator to spit out. So once I have the layout, I know where to put tiles. I then can have variations of tiles. Then I know features per tile (e.g. lo/hi cover). I already have biome swap objects. So there can as well be feature objects altering between no/lo/hi cover (= tiny/small/tall rock).

I do like the idea to incorporate abiltities in this system.

1 Like

Not picking the worst of examples, are you? :grin: X-com 2’s procedural map I find mostly great. Though, I would think that there is may be another layer to it, with regards to:

Because, their wilderness (partly open maps) are also pretty good (mostly). I wonder if there would not have to be a change in some ‘parameters’ when drawing/instructing the build of an ‘enclosed/interior’, ‘city’ or ‘wilderness’ map. Sounds that, from a level design perspective, these are quite different.

To summarize, I don’t think that (just) the AI can do it all. It’s gonna still require a level of effort to create assets and inputs for each. But the AI should be able to draw you this ‘randomness’ and smooth integration at least around the textures/terrain (and also for placing objects around camp/spawning areas). At least, that’s what I imagine. Never did anything alike before… :thinking:

2 Likes