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

Update: v0.0.6

:film_strip: New batch of animations: getting over obstacles, shooting variations, big ass melee weapons, and reactions to certain events (e.g. cover blown away)

:kangaroo: New ability “Evasive Cover” - lets you get into cover without triggering enemy reaction fire

:robot: Evil space robots - OMG what are they doing on Earth??! :open_mouth:

(Screenshot taken from intro)

:movie_camera: Speaking of intro: it is cooking… (Making this is so much fun!)

:star: Perks give extra advantages (or disadvantages) to your chumps

:factory: First working procedrual level generator (not public yet; need to produce more assets)

:globe_with_meridians: Strategic game now functionally ready (not public yet; need to add more story/research/content)

(some elements redacted)

:shortcake: New mechanic: Sweet spot. If you are close to an enemy, you cannot miss a shot (same goes for the enemy though :stuck_out_tongue: )


Check it out now

:joystick: Link in first post

:speech_balloon: Do yell at me if something sucks or drop a feature request!


What happened since the last version:

  • I took a 3 month or so “Christmas break” ;D
  • A lot of trial and error with procedural level generation. Toughest nut to crack so far. Funny, btw. Coming up with the desgin/architecure/idea took me like how many months? Once I had it, the code was implemented in 2 hours :smiley: It is not public yet because I need to produce assets now - lots of assets. tl;dr: I roughly follow the Xcom 2 approach. Design tiled “mini dioramas” that get randomly placed on authored high-level layouts.

What happened really since the last version:

  • It is getting gamey, guys! I have started working on the Intro. It is going to be a slide show with pseudo animations (comic like - remember Xcom Ufo?).
  • Related to that, initial story is now set in stone along with a bunch of story elements and game world rules.
  • Added some experimental attributes: strength, dexterity and reaction. Also introduced computed attributes that scale with others (e.g. carry weight ← strength). I might change that around a lot depending on how it feels like.
  • Sweet spot mechanic: Don’t you hate it in games when you miss a shot despite standing right next to the enemy? Now you get a guaranteed hit if you stand 1 tile diagnoal to an enemy (if you can make it there…).
  • Info box for ground tile related data such as loot, dangers, benefits, etc
  • Chumps have perks now
  • Chumps can now learn the ability “Evasive Cover”
  • Weather effects (dust storm)
  • Animation streaming: now can support unlimited animations at no loading time cost (this is huge actually, shout-out to @labris who helped a lot here)
  • Animation sequencer allows more complex mixed authored and procedural animations (given a nav path, e.g., run, jump over obstacle, slide, go into low cover)
  • Additive animations substitute missing animations in item sets (e.g. use additive GetHitWithRifle on regular CrouchIdleWithPistol to get CrouchGetHitWithPistol)
  • Refactor of animation states and playback: run procedural animations along AnimationGroups, wait for animation events, automatically figure out animation chains (state tree)
  • Added a couple of “vault over” animations, shooting heavy rifle and machine gun, 2-handed melee weapon set, idle animations and even did some myself
  • Proper throwing arc altering between low and high angles as well as accelerating/declerating projectile behaviour (doesn’t look crap anymore)
  • Also proper throwing rules: strength and weight determine range while dexterity determines accuracy
  • Actors are now decoupled from actions. While, before, missing animations gracefully voided the play-request, the e.g. underlying move action still executed. I can now have actors with incomplete animation sets (e.g. robots do not go into cover saving me the work to design the entire cover animation subset).
  • Enabled anti-aliasing (canvas MSAA). Looks nicer but takes away the pixel look. Not sure whether I keep it. For now decide for yourself: it can be toggled in the game options.
  • Base hemispheric light replaced by IBL. Looks nicer I think. But there is some camera angles which are too dark.
  • Figuring out mesh use cases (for physics, navigation, cover) programmatically saves me a ton of data entry. Expect some quirks though since I may need to fine-tune some conditions. (You know, when is no-physics-clutter small enough to count as clutter?)
  • Resolved age old issue how to avoid revealing hidden enemy when previewing a navigation path: “preview path” is now shown straight through hidden enemies while the “move path” will stop the player right before that enemy (so you better plan carefully you next move :winking_face_with_tongue: )
  • Much cleaner control flow: input states** (click, hover, etc.) drive action states (preview, select, confirm). Plus overlay states (render stuff depending on other states) - tl;dr less complexity, less redundant raycasts, easier to maintain and expand.
    **i.e. depending on input state, clicks on e.g. npc do different things
  • Properly styled tooltips with Vue directive (there are likely some rogue title attributes left)
  • Bunch of tutorial/help added to tooltips
  • Loading time down by 2sec
  • …and another 4sec gone
  • …and another 5sec to up to 10sec gone - w00t (10sec left to reduce sigh; while not adding any more double-sigh)
  • Added 5sec of loading time again when loading procedrually generated levels…argh
  • Ability “Face off” is now a single shooting action for all targets. Also, switchting targets by rotating spine bone, not root node (tl;dr looks better)
  • Weapon swing trail (and other effects) now driven by underlying animation and will not go out of sync anymore
  • Huge progress in Strategic game now consistently designed and with functional features. Can go on missions and return with loot.
  • A mega ton of bug fixes
  • Removed a bunch of redundant textures
  • Added a bunch of redundant textures when loading procedural levels; #todo

What’s next?

  • Content, content, content
  • Saving and loading (this is gonna be so much work, AI please)
  • Tactical UI still meh
  • Overall lighting also still meh
  • Tactical music and/or ambient sounds (incl. upgrade to Audio Engine v2)
  • Raise IQ of AI
  • Incremental improvements as necessary

Maybes depending on complexity/time to implement:

  • Day / night missions would be cool (thanks to @Heaust-ops’s Deferred Lighting technically possible)
  • Some verticality (e.g. multi-story bulidings or at least roofs). Code-wise rather easy; level design-wise rather difficult
  • More and bigger level destruction
5 Likes

Looking great man, excited to see where this game is going! I love tactics games, the X-COM style games were just outside of my attention span but I love seeing how passionate X-com fans are about the games in this genre. Very comparable to us FFT fans!

Some verticality (e.g. multi-story bulidings or at least roofs). Code-wise rather easy; level design-wise rather difficult
I couldn’t agree more, the technical design requires some effort to say the least.

I’m also building a tactics game with verticality! I recently decided I also wanted destructible environments with modular character/stage hybrids that can pop in/out of battle at anytime. I never planned for this in the beginning and am now paying the price for the z axis being driven by a manhattan heuristic.

Tactical music and/or ambient sounds (incl. upgrade to Audio Engine v2)
What does this mean? Is the music going to be driven by some kind of game mechanic or is “tactical” referring to an aesthetic?

1 Like

Thanks for the nice words :smiley:


Oh cool. Can you show a sneak peak or is it too early?

Oh, good catch. To be honest “tactical” is just my internal term for the tactical game. I do not have any concrete ideas yet how to tie music to game mechanics. I would love to have recognisable themes for certain enemies - like if that tune starts playing you know you are in trouble.

Same here. Also implemented this much later down the road when they gave us Havok :heart_eyes: So much more work and complexity - but so much more fun, too.

I will definitely cheat here so that I can work with connected 2d grids and never have to worry too much about 3d. I mean X-Com 2 does get away with it (afaik): they have verticality but you never run up hill or so :smiley:

2 Likes

You could add verticality like how some japanese tactic RPGs do it: characters have a jump attribute which allows them to ignore certain elevation changes. So you can keep your 2D grid, but a movement is only valid for pathfinding if the height difference between two squares is equal or lower to the character jump attribute. Not super realistic but works well enough and would give you some way to play with elevations if you want.

1 Like

Too early

That’s the way to do it! Advance Wars does that amazingly well and Fire Emblem Heroes has such great themes for when it’s your turn vs the enemies turn.

Another highly underappreciated but awesome mechanic is state driven music. Like in Super Mario World when riding Yoshi a percussion layer starts playing over the current active track.

I think the extra fun is worth it and it’ll certainly separate your game from other tactical games since most are flat even though players constantly ask for verticality.

I’m curious about Havok now and I’ll definitely read up on some documentation. Considering that I’m abandoning edge based traversals (BFS) in favor of geometric traversals (so light pseudo physics) there might be some feasibility. If there’s a way I can pause Havok physics steps and make them event based I’d definitely consider swapping over. It would have to be a headless version since my game logic exists in a server (it’s an mmo).

I just need to play X-com 2 already so I have better context.

1 Like

Now that you say it: having in mind Final Fantasy Tactics or Disgea (or Disgaea, how do you spell it??). I think their trick is to never overlap tiles on the z-level. So you cannot have bridges for instance (you can go under and over). But you can treat the whole level as 2d. The height check is just an additional conditional in the valid-neighbour-evaluation. Plus, you could do all the work in a build step (caching tile heights per object). Or actually bounding box heights might be enough. I use these for the cover system and works surprsingly well. Hm, I like where tihs is going :smiley:

For what it is worth, in my case, Havok is mostly idle and consumes 0.25ms according to the Babylon Inspector. If that is still too much, from what I have seen you can manually step through.

My backlog is growing, too. Looking at you Stalker 2 :star_struck: (and Cyberpunk, and that awesome space ship salvage 2d top down game, and the latest version of Xcom Piratez, …)

2 Likes

@Joe_Kerr Hi Joe. Are you still working on the project?
Why no news on X?
Or do you have discord for communication with dudes who makes similar project (Greedbound) as an hobby?

1 Like

Yes, I do :grinning_face:

Doing this update stuff takes quite some time. You need to weigh that against the “statistics” it produces. :face_with_crossed_out_eyes:

Any link to Greedbound?


Most time recently went into content creation. There is tons of guns now, more missions/quests, more worlds. There is map features (like “prison” or “bank”) which tie into quests/objectives. There is night missions (currently only visual; no gameplay effects).

I have started tackling balancing (damage, resistance, armor, etc.).

There is dynamic battle music (incl. upgrade to Audio Engine v2).

In Strategic game mode there is batering (instead of shopping). Get access to batering as mission reward.

In battle, you can find (non-micro transaction) loot boxes.

Made design choices on how abilities are acquired, how Chumps develop/progress.

Further AI fixes/upgrades. Including a dedicated Logger with inspectable properties. Very useful, worth the extra time coding it in.

Architecture for saving and loading the game in place.

And I have chosen a final game title (I kept the “X” obviously) :money_mouth_face: