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

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #135 on: December 14, 2019, 12:39:48 am »
Finally implemented some world map pathfinding AI, instead of units going straight in line. Due to continuous space I can't use the usual diffuse approach (i.e. the Dijkstra's Algorithm), but since the number of obstacles is usually limited, and the world map is no a maze, I don't really need the diffuse approach, and can just try random paths while on of them works, which happens in most cases. Random paths are also nice since they make AI totally unpredictable. But yeah, random is still very resource consuming, so for an RTS game one would still use Dijkstra on top of some space partitioning structure, like quadtree, but space partitioning is tricky. Although one can also try further optimize random paths, by using something like neural nets, but then again, neural nets are structurally equivalent to space partitioning trees, so one will get the same result, just looking a bit different.

Anyway, now I have an easy way to control AI difficulty - just reduce the number of paths, and the AI will become even more dumber.


Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #136 on: December 14, 2019, 08:09:59 pm »
So one may be curious how random pathfinding could ever work? After all, it is random. As all random generation algorithms, it has constraints. In my case it uses the same fractal algorithm I used to generate the island on the screenshot, or the usual "battlescape" maps. First you generate several rough paths, made only of a few line segments, select the best one of them, and then refine each of its segment by applying the algorithm recursively, so the final path will closely match roads or other unit movement abilities. In fact, such space subdivision is the base for AI algorithms, including ANNs and Markov Chains related algorithms, and it has a name - interpolation. In basic case interpolation can create smooth shapes (by displacing uniformly along the normal), and, under constraints, shapes that match some other shapes - real or imaginary. When the subdivision is applied in geometric context, potentially infinite number of times, it is called "fractal", from the word "fraction", because the process is the same as how you obtain fractional parts of Pi or other irrational numbers, just applied to shapes.

But, yes, it is impossible to use the algorithm my current from for navigating mazes. Although one can modify the algorithm to make it work with mazes. In fact, maze navigation doesn't require diffusion based algorithms at all. There is a very simple algorithm employed by robots to get out of mazes, which doesn't even have a state, while diffusion requires memory size equivalent to the search space. Other way is precalculating a navigation table which for some rough samples for two world cells would give movement direction. In fact such navigation table can be calculated iteratively, while game is running, since the diffusion algorithm us iterative. Table based navigation is every fast even for millions of agents. It can also include anti-table for say escaping entities, which would help them getting the best escape routes, say avoiding spreading flame.

Still I find it funny how one can take the algorithm for generating Pi, and, replacing a few parts, get the algorithm to generate a video game world, or to generate a path in that world. Or how random numbers guiding the algorithm could be coming from any chaotic process, including the decisions player makes in the game (i.e. what buildings he/she builds and what sites visits).

Offline Stoddard

  • Colonel
  • ****
  • Posts: 478
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: XCOM Inspired Fantasy Game
« Reply #137 on: December 14, 2019, 08:29:44 pm »
Pathfinding is at its core  a problem of minimizing an path integral over 2 or 3d space. Things that define a landscape (elevation map, more likely) - erosion and its cause - water and its effects on rock - are the same thing. And the results of this erosion is what we perceive as a 'natural' landscape.

So it's no coincidence that the solutions to the same problem produce essentially same results.

You might find useful to read some papers on pathfinding from 1998-2005 period. The theory is all there, including minimizing stored information about the environment. Seriously, there are tons of insight there.

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #138 on: December 16, 2019, 05:16:01 pm »
Pathfinding is at its core  a problem of minimizing an path integral over 2 or 3d space. Things that define a landscape (elevation map, more likely) - erosion and its cause - water and its effects on rock - are the same thing. And the results of this erosion is what we perceive as a 'natural' landscape.

So it's no coincidence that the solutions to the same problem produce essentially same results.

You might find useful to read some papers on pathfinding from 1998-2005 period. The theory is all there, including minimizing stored information about the environment. Seriously, there are tons of insight there.
Generally speaking, pathfinding is the main problem of math. Theorem proof can be thought of as of a path in some space towards the statement. So yeah, you can take any math paper, and it will be about pathfinding :D but, yeah, in practice we usually have simple cases of 2d and 3d spaces, while math problems have large number of huge non-unform and uniform spaces. Still would be interesting to create video game world as complex as some math problems. But I guess such game world would be hard to draw on screen and definitely not accessible for casual gamers :D

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #139 on: December 17, 2019, 03:31:33 am »
Actually, there exists a simple game about theorem proving in less than uniform space:
https://en.wikipedia.org/wiki/Baba_Is_You

Basically the game is an extension of Sokoban, so pathfinding could be a bit hard. Still the game has no AI opponent, so it doesn't make much sense to pathfind it :D  But I would love to see some multiplayer Sokoban game, where players compete in such space. In fact I had some of the Sokoban mechanics in the early version my game, but found it hard for AI to solve or for map generator to generate nice Sokoban puzzles, so I left it out for later enhancements to the game (it is really far on my TODO list.).
« Last Edit: December 17, 2019, 03:35:24 am by Nikita_Sadkov »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #140 on: December 18, 2019, 04:14:48 am »
Almost done with city view, including random city name generator (inspired by German language). Borrowed some ideas from Heroes of Might & Magic 4, where player had to choice between several build path. I.e. if you build crypt, then you will get undead units, but if you build stonehenge you will get fairytale ones. Although some units can come from different buildings. I.e. player can hire ratmen from both port and sewer. The city has unit pool similar to HoMM, but it is different. First, units have upkeep. Then the pool gets reset and refilled with new units each week. Unhired pool units participate in city defense, if leader units decide to ignore attackers and hide in the castle. Also, city wall prevents plundering the city, forcing enemy to attack the castled player, and leaders in castle gains numerous bonuses, like ballista, plus militia, in additional to their normal mercenary units.

Another feature borrowed from Lords of Magic: player can visit neutral cities and can even buy buildings and hire mercenaries there, but doesn't gain any income from them.
« Last Edit: December 18, 2019, 04:19:07 am by Nikita_Sadkov »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #141 on: December 20, 2019, 12:46:19 am »
Something which gets largely unnoticed: modern video game and movie fantasy art is greatly inspired by American illustrator Darrell K. Sweet. In particular Legend of Kyrandia games are completely in his art style. Lord of the Rings movies took Darrell's character design (i.e. Saruman is definitely Sweet's Saruman). And Heroes of Might & Magic too. That mantricore in HoMM3 is Sweet's invention. Original manticore wasn't that cool looking (woodcut author obviously drawn it from his home dog, due to a lack of reference photos). HoMM6 has a non-Sweet manticore, and it looks messy (although still better than the broken wing Russian shitfest in HoMM5). Kyrandia games even have main character, Zanthia, named after the book series Sweet illustrated.


Offline Stoddard

  • Colonel
  • ****
  • Posts: 478
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: XCOM Inspired Fantasy Game
« Reply #142 on: December 21, 2019, 09:55:05 am »
Which is sad. He won a Hugo in 1983 for cheesy book covers and while he surely was better than anyone else, book covers, illustrations and everything were and are still crap. Sad, useless crap. You literally can't even wipe your ass with them.

Even this is better.

« Last Edit: December 21, 2019, 09:57:56 am by Stoddard »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #143 on: December 21, 2019, 11:57:05 pm »
Which is sad. He won a Hugo in 1983 for cheesy book covers and while he surely was better than anyone else, book covers, illustrations and everything were and are still crap. Sad, useless crap. You literally can't even wipe your ass with them.

Even this is better.


Book covers and covers in general sell products. Unless they catch your eye, you won't be reading the book.

But yeah, everyone's favorite illustrator is Boris Vallejo, because of naked girls on the covers. In fact Vallejo's cover art is so stereotypical, it is exploitable. Other famous cover artist is Larry Elmore: instead of girls, he draws dragons. In particular Elmore done art for Dragonlance and Might & Magic games. Unfortunately Elmore doesn't draw anything but dragons (have to keep the reputation I guess). Ultima Online cover art was done by Hildebrandt, also known for Star Wars poster. I like their Saruman, although it is not suitable for motion picture, compared to Sweet's art.


Offline Stoddard

  • Colonel
  • ****
  • Posts: 478
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: XCOM Inspired Fantasy Game
« Reply #144 on: December 22, 2019, 10:22:48 am »
Well, idk. If you for example look at Baen Books covers, they are all utterly atrocious. They require a conscious effort to ignore them lest they spoil the pleasure of reading the text. If that's what they call 'selling', then I'm at a loss for words. Unselling imo.


best one I've seen was черная книга арды 1995 edition, which was very worn and lacked the front cover entirely - only had plain black back one - since it was so widely shared it somehow lost it (and half a dozen pages too). But at least you could see at once that there was demand.

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #145 on: December 22, 2019, 01:22:01 pm »
Well, idk. If you for example look at Baen Books covers, they are all utterly atrocious. They require a conscious effort to ignore them lest they spoil the pleasure of reading the text. If that's what they call 'selling', then I'm at a loss for words. Unselling imo.


best one I've seen was черная книга арды 1995 edition, which was very worn and lacked the front cover entirely - only had plain black back one - since it was so widely shared it somehow lost it (and half a dozen pages too). But at least you could see at once that there was demand.

You haven't seen bad book covers.




Offline Stoddard

  • Colonel
  • ****
  • Posts: 478
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: XCOM Inspired Fantasy Game
« Reply #146 on: December 22, 2019, 05:01:45 pm »
The pizdets is on par with what I wrote about, really.

There is someone responsible for the style I'm sure. And I hope they're dead and enjoying being damned every time someone looks at this shite.

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #147 on: December 23, 2019, 03:27:41 am »
Returning to The Spell of Mastery. While the game has city view and borrows some mechanics from Hammer of the Gods/HoMM, the city has limited visitor pool size, controlled by buildings (i.e. building inn would increase it). On the other hand there is also fame parameter, controlling how fast the pool is being filled (i.e. building say a temple would increase city fame). Unhired creatures spill over and go wandering around the map, potentially attacking other players or occupying some dungeon. The price of unemployment. The pool itself increases on daily basis. I believe that HoMM3's weekly basis is a huge design flaw and was fixed by Jon van Caneghem himself in HoMM4, which was completely ignored by later games in the series. Anyway, the metaphor is that city building themselves don't produce creatures, but attract them.

Of all these Civilization clones, Hammer of the Gods had funny recruiting system: instead of building the city player completed the quests from the gods, which rewarded with various fantastic creatures, while non-fantastic creatures were gained by plundering cities (i.e. gaining fame as warlord). That is as far as you can get away from Civilization rules, because say HoMM games are just Civilization clones where multiple productions are allowed at the same time and word map objects large more importance.

Unfortunately all the HotG recruiting was done in capital, which allowed recruiting only a single stack of 8 units per turn. So if player amassed large number of units, would be impossible to ever recruit them. Early strategy games had numerous such blatant mistakes.

Another game, RTS Blood & Magic, had unusual (for Dune 2 clone) resource gathering and unit production mechanics. Basically player has basic unit, golem (produced at player's start location - a portal into pocked dimension), which them could be turned into different units at special training buildings, which can't be build only at very specific foundation sites (similar to potential city places in Hammer of the Gods). If left alone, these golems accumulated mana - the game's only resource. Which then had to be collected by player, manually, by clicking each golem and then additionally clicking "Transfer button" (similar to plants vs zombies). If left uncollected the mana was lost. That would have produced exponential economic growth, if not for player's limited clicking ability. Additional quirky feature of the game was its overhelmingly discrete nature. The first unit to score a hit would be the winner. Given that units have only a few hitpoints, it is very easy to predict the outcome of any fight. Given the advertised AD&D nature, new buildings were unlocked through amassing experience given for killing enemies, in particular, neutral mobs. Yeah, B&M invented DoTA long before Warcraft 3. Also, compared to a bit copypaste looking early Blizzard games, the game had really complicated non-uniform tilesets.



« Last Edit: December 23, 2019, 04:31:41 am by Nikita_Sadkov »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #148 on: December 25, 2019, 09:16:40 pm »
I've already mentioned, that this game project is largely a glorified unit test for my programming language, Symta, so in design I try to pick hard-to-implement and diverse subsystems to see how they will work together, so I could then use the gained knowledge to update the language design. The idea was already a huge success, since it uncovered numerous flaws with my language and potential solutions to them. Still the game code currently has no networking or a site, which I too plan to implement using my language, together with a webserver, since any language should be capable to create webserver and and a site on top of it. Instead of HTML I would also use my language on the back end, since HTML/XML is really nasty way to express SEXPs. Dunno about the database though, since proper relational database needs really mature language to implement. I already have the wish to have database, since ingame entity lists could be better implemented with a rational database, but external SQL would be an overkill.

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #149 on: December 30, 2019, 05:09:59 am »
Inventory theme. For some reason people still implement the grid based inventory. Original XCOM is one of these games, using "Tetris" inventory, meaning player has to spend time arranging items, instead of playing the game. Other games using Tetris items are Might & Magic, Diablo and several Russian made, not worth mentioning.

Modern XCOM remake dropped the idea of Tetris inventory, instead using more streamlined slots, which are filled from a list of items with icons. Same with later Bioware games, which too dropped the grid based inventory. They did that for several good reasons. But the foremost of them is that linear list with icons is simple and good enough. Finally it looks aesthetic, compared to the mess we seen in Might & Magic games. Other approach to inventory would be Ultima style, where items just clutter the backpack, limited only by weight.

I do use grid inventory, but all items take single grid slot in backpack. Don't see any reason implementing the XCOM type Tetris inventory. Although I had the idea of introducing "space" parameter, in addition to weight parameter. It would solve the realism issue, without requiring player to play Tetris.

As a side note, Japanese were smart enough to never implement grid inventory, especially not the Tetris one. It is just non-fun.