Author Topic: XCOM Inspired Fantasy Game  (Read 170633 times)

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #195 on: February 20, 2020, 09:22:17 am »
The less randomness and the more deterministic a game is, the more it resembles a puzzle instead of a strategy/tactics game.
Not exactly. There are puzzle games with random factor, like Tetris and Match 3. Randomness is orthogonal to the genre.


Also, one may ask why not use drichlet tesselation or BSP for map generation. BSPs and tesselation algorithms are not really good for heightmap generation, compared to fractals. Although there was a BSP planet generator ( http://www.lysator.liu.se/~johol/fwmg/fwmg.html ), but it isn't really easy to adapt. Secondly, tesselators have large cell size and usually non-uniform shape, which isn't always suitable for most purposes, and once you cell size approaches pixel size, you are much better with fractals. But cell generation is indeed far easier to control than perlin noise or WFC. As I understand most people use drichlet tesselation as an resolution independent input for the fractal generator, which can be running on the GPU. But since I'm not making 3d AAA game, I don't really need that.

Here is for example a river (in black color) made out of drichlet cells. It is easy to create, but really rough, so a non-trivial modification to the composing cells is required. Of course one could use hexagonal lattice for tesselation, and rivers will be looking a bit smoother, but then everything else will be smooth too. So the proper solution is to draw rivers using a brush you like.


Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #196 on: February 26, 2020, 03:40:59 am »
The idea with roads burrowing through hills was really retarded, albeit a way to reduce tileset needs. Now instead I implemented roads going over hills, which required drawing incline cobblestone tiles and doing some tricky road interpolation code. Anyway, hills should be reserved for placing caves/mounds inside them, with some neutral monster and a treasure. I think these could be optional: if player decides to explore full map, instead of going straight to the goal, could be reward with some minor stuff. Otherwise players units should be placed right near the dungeon entrance (castle entrance, city tavern, etc...), because wandering through empty map is not that fun. Although I though about making that a challenge in itself - i.e. player should have some engineering units to build a bridge. But that obviously makes gameplay less focused and turns game into a turnbased Minecraft clone.

There also should be some placement mechanics, so defending side would be allowed to move its units before the battle has started. There are several way to implement that. But I though about allowing defender to pick initial center of placement and then place the units inside of it. Or at any indoor place. Afterwards attacker places his/her units, being limited only to outdoor areas, outside of defender's placement circle.

Unfortunately that means visitor would see whole map from the beginning. So I think still limiting visitor placement only to the camp area, and maybe to map borders. Initial placement is actually very important, especially if I later implement multiplayer maps.

Now there is also a retreat mechanic, where defender can retreat at any time, losing any unit which is indoor or in enemy sight. So for maps where defender got attacked in the open field (i.e. no castle or dungeon on that hex), that defender must get immediately surrounded and prevented from retreating without heavy loses. I still think about giving defender there the first turn, he/she will have any chance of breaking out.

As usual, game design is hard, because there are many possibilities and it is not immediately obvious which one is the best. I sometimes fail to see one of the better possibilities, noticing it after some time, and then backtracking to it.

Here is the same seed map, but with road generated going over hill, instead of digging though it. Guess in some cases this approach could make use of suspended bridges.

« Last Edit: February 26, 2020, 03:45:35 am by Nikita_Sadkov »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #197 on: February 29, 2020, 05:50:34 am »
A glitch in city generator actually made me think of a suspended city. Where instead of these soil ramps, pavement will be resting on say columns, with other parts of the city underneath. Shouldn't be that hard to implement. Obviously it would need some railings to look nice.


Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11728
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: XCOM Inspired Fantasy Game
« Reply #198 on: February 29, 2020, 01:12:55 pm »
Why stop halfway? Make it a floating city, suspended above the clouds! :)

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #199 on: March 01, 2020, 06:53:44 pm »
Why stop halfway? Make it a floating city, suspended above the clouds! :)
Well that would require implementing special flying support blocks, so the whole construction wont collapse. A can of worms will get opened, requiring implementing all relevant subsystems and answering game design questions. For example, can these levitating blocks be destroyed? Do they need some energy source? What would it require to damage them? Should destroying them be an important gameplay element, so random maps have to be generated taking their tactical significance into account? I.e. collapsing a flying ship with opponent's creatures or landing it on top of opponent's creatures?

Given that, I will leave that feature out for now.

Anyway, reading the recent news
https://www.bbc.com/news/world-europe-51680049
> Three die in dry-ice incident at Moscow pool party

It makes me think about some toy chemistry system for magical effects. I already have suffocation due to low oxygen levels, but fullblown gas physics even in a toy form would require complete 3d gas diffusion and gas weight system, with several gas types. For now I've only oxygen and it is bound to the ground tiles (i.e. there is no oxygen diffusion at higher altitudes). So I will likely leave that for later revisions of the engine, after I finalize the programming language itself.

But the gas feature itself is a very powerful game design tool for tactics games. For example, your squad can a have dog on the team, and that dog can smell nearby enemies, revealing their locations. Obviously that needs several gas types, so each object type could have some unique smell. Although CO2 should be enough in the most basic case, since that alone would allow for living creatures tracking. Undeads and inorganic creatures obviously don't breathe. I remember there was an old DOS game, called Wolf, where wolf had to sniff for hunters, bears, prey and other wolves. But it had no diffusion, just direction.
« Last Edit: March 01, 2020, 07:11:48 pm by Nikita_Sadkov »

Offline Rubber Cannonball

  • Colonel
  • ****
  • Posts: 195
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #200 on: March 02, 2020, 02:22:53 am »
The Nox have floating cities.  Invisible floating cities.  Actually more than invisible, phase shifted maybe.  I don't know, it never is explained.  The Nox appear to be a primitive pre-agricultural society living on a pristine world.  Actually they are advanced far beyond humans and their technology if one can call it that appears to be magic.  It doesn't have to have a complicated physics system to describe how it works.  It can just be.  A bit of mystery is a good thing.

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #201 on: March 02, 2020, 03:55:55 am »
The Nox have floating cities.  Invisible floating cities.  Actually more than invisible, phase shifted maybe.  I don't know, it never is explained.  The Nox appear to be a primitive pre-agricultural society living on a pristine world.  Actually they are advanced far beyond humans and their technology if one can call it that appears to be magic.  It doesn't have to have a complicated physics system to describe how it works.  It can just be.  A bit of mystery is a good thing.
Is it related to the classic Westwood's RPG? I don't remember it having flying cities. It was mostly indoors dungeon crawler. With a bit of interactive environment, compared to Diablo 2. IIRC player was able to move and stack boxes to form stairs. Nox was also a proto MOBA game, before DoTA was invented.


Offline Rubber Cannonball

  • Colonel
  • ****
  • Posts: 195
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #202 on: March 02, 2020, 06:00:43 am »
The Nox are an alien race in the science fiction television series "Stargate SG1" for reference see: https://en.wikipedia.org/wiki/Stargate_SG-1

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #203 on: March 05, 2020, 06:23:13 am »
Ok. The new city generator is almost complete (although components were taken from the old generator). I've integrated with the dungeon and overland generators. So it can generate forest and cliffs around city, river inside city and sewer under the city. Remaining work is adding elevation with stairs, so some buildings would have higher ground. Then connecting it with world map, so cities will have contextual content.


Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11728
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: XCOM Inspired Fantasy Game
« Reply #204 on: March 05, 2020, 11:05:00 am »
It's all mindblowing.

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #205 on: March 17, 2020, 02:16:20 am »
Implemented elevated high city with stairs upward. The idea is that elevation adds a bit of tactical depth, since shooters on top get to-hit bonus and relatively safe from melee enemies below.

Wont be implementing overhang city for now, since it needs better room/house generation algorithm, where houses can match existing terrain nicely (i.e. Diablo style partitioning algorithm, with items added fitting to the rooms purpose). That is also a nice feature if you're making some god game, where player gives only general orders, and creatures build houses themselves, working with existing terrain, maybe minimizing some function.

Anyway, for now I use premade houses (similar to XCOM parts), which can be rotated and have randomizable sub parts. Initial house rotation code had a lot of bugs (especially with multi-cell objects), since I dont do usual trigonometry, but instead have various non-uniform hardcoded angles. I really need to refactor it if I ever plan about implementing 90 degrees camera rotation. These are all late stage features, when core gets working flawlessly.

Guess I can also use this code to produce a map generator for Warcraft III (long ago I've made a map generator for Warcraft II). But since Blizzard became assholes and claim ownership over all mods, I wont.



« Last Edit: March 17, 2020, 02:17:54 am by Nikita_Sadkov »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #206 on: March 17, 2020, 03:31:02 pm »
The planning doesn't always make sense, cliff edge pavement needs a special tile (otherwise it blends with the tiles below), and there is still a bug with warehouse door placement. But guess it is fine for now as a proof of concept. Still road planning needs to be addressed at some point. Like the screenshot below a road goes over a hill, and there is no alternate path around cliff.

« Last Edit: March 17, 2020, 03:33:28 pm by Nikita_Sadkov »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #207 on: March 19, 2020, 03:46:10 am »
Ok. Connected the river generator to the elevated city generator. Obviously all these generators work together. So the hardest part is merging them. It is easy to say generate building with rooms, a city plan, or a height map with hills, a sewer under the city, or a river on plains. But is a somewhat harder to connect everything seamlessly, when city gets spread over the hills, and there is a river with several waterfalls flowing down these cliffs, and also a road crossing said river. WFC algorithms can help there, but the result would be too random and hard to control. I also found the optimize C/C++ implementation of WFC rather slow. So it will be much slower if rewritten in my prototype language.

But yeah, seen holistically the random generator is probably the most complex part of the game.


Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #208 on: March 20, 2020, 03:51:07 pm »
Now, when city generator is functioning, It is the time to properly place different sides. Basically city fights happen when attacking player decides to plunder the city, instead of besieging the castle (castle siege happens on a different map, since castles are outside of cities). If city has a wall, then attacker will forced to do castle siege (plunder option is absent). There are for sides inside the city: citizens, unhired visiting mercenaries, defending player units (if player decides to participate in the battle) and enemy units. City's wealth is randomly placed inside buildings, and attacker is supposed to collect it. Unhired mercs are placed randomly to guard it. If a city gets plundered (i.e. citizens killed, and wealth stolen), its taxable income will get reduced for the upcoming turns.

There are several ways to place attacker units. But I think the best one would right inside the city. For now I use city's park. Defending player's units will be placed either at the entrance, tavern or the barracks. In all cases any player can just leave at any time, with the usual retreat rules applying. I.e. a thief can infiltrate city and steal some stuff, while being invisible.

With castle siege it is much easier - just place attackers around the castle.

On all generated maps there are power nodes. If any player captures all of them, the enemy player's units will start losing health.

I want all combat to resolve quickly, so on siege and party-vs-party combat attacking side will be encircling defending one. But city plundering is an optional thing. Same with wilderness exploration. So it is okay for little or no action happening in these sites.
« Last Edit: March 20, 2020, 03:54:34 pm by Nikita_Sadkov »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #209 on: March 21, 2020, 01:42:53 am »
I had an idea for imps building rafts instead of bridges. But then there are waterfalls. And I also plan adding flow direction to the river, so it would move light objects buoyancy with the flow. These things greatly complicate raft mechanics, which would need some propulsion mechanism. So bridges are just simpler and more robust solution. The earliest game with river flow was probably Tomb Rider, where river impeded player's canoe movement. But I dont remember it carrying other items.