aliens

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

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #60 on: April 24, 2019, 03:31:44 pm »
Solved the concave polygon render with multi-pass raster scan, without any flood fill queue. Comes out nicely with a tail of islands on demand. Mirroring it would produce figures for a new Rorschach test :D

The shapes are still triangle based, but I can also fed in a rectangle or a hexagon or any polygon.

It is also useful to rotate these brushes, so had to invent the algorithm to rotate a point P around the origin O:

Code: [Select]
rotate A O P =
| Dir = P-O
| DX,DY = Dir
| CosA = A.cos
| SinA = A.sin
| NX = DX*CosA - DY*SinA
| NY = DY*CosA + DX*SinA
| [NX NY]+O

The hardest part is noticing that you don't need to compute the length of P-O, because division by it gets cancelled anyway.


Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #61 on: April 24, 2019, 06:47:52 pm »
A while ago I was looking into map/globe generation for OpenXcom, was inspired by the world generator at https://donjon.bin.sh/world/. I liked the method of using randomized great circle slices of the globe since instead of needing a pre-defined grid of points for a height map, you can generate the polygons by storing the intersections of the great circle cuts. I ended up having to reduce them to triangles later to fit the way X-Com globe data works, and never really completed the generator, but I do have some WIP results posted here on the forums.

If I pick it up again, I'd probably need to add some functions after the initial polygon generation to randomize the coastlines a bit, since they tend to bear the hallmark of the great circle lines, making them look boring and obviously computer-generated.

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #62 on: April 25, 2019, 09:26:09 pm »
If I pick it up again, I'd probably need to add some functions after the initial polygon generation to randomize the coastlines a bit, since they tend to bear the hallmark of the great circle lines, making them look boring and obviously computer-generated.
I doubt there are any better algorithm than the midpoint displacement, which is very robust, corresponds to real life islands and can fill-in very precise shapes with arbitrary constraints.

People also use it to generate electricity or lightning like effects. And it also can serve as an input for sound generation, if you need some beefy synthetic sound  effects for your sci-fi setting video or game https://soundcloud.com/nikita_sadkov/explosion

I.e. the algorithm is a goldmine of cheap content, when you have no money to pay artists or sound designers.



Although I've found that the midpoint algorithm on a square grid has apparent bias, because it needs to sample from all 8 nearby cells, but the distance to four cells is 1, while distance to the four other cells is sqrt(2), meaning that N,S,W,E directions have less influence that they should, so the result isn't perfectly random and has predictable patterns, like say 45 degree lines are 1.4 times more likely than 90-degree ones. I.e. again we have that nasty square situation :D Googling has shown that people fix this sampling bug using some advanced math, beyond my grasp. But I'm sure it can be fixed by using hexagon grid instead, and then sampling down to squares. Still for my purposes these subtle errors ain't that noticeable and diagonal walls look more gamey.

Anyway, here is the current state of island generation. Several of these islands will be merged together to create game world.



« Last Edit: April 25, 2019, 10:19:13 pm by Nikita_Sadkov »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #63 on: April 28, 2019, 12:38:44 am »
Slowly it comes to something usable in the game. Tilesets taken from Freeciv  :P

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: XCOM Inspired Fantasy Game
« Reply #64 on: April 28, 2019, 04:54:22 am »
wow, looking good.

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #65 on: April 28, 2019, 03:54:05 pm »
wow, looking good.
Unfortunatelly it is a bit tricky to generate rivers. One may suggest a simple gradient descent, but then rivers will end at a local minima. So it requires waterflow and erosion simulation to get out of local minima, without flooding like half of the island into a swamp. It is easier with the graph methods, where one can just send waterflow along the edges.


Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: XCOM Inspired Fantasy Game
« Reply #66 on: April 28, 2019, 04:39:23 pm »
Why not just flood half of the island into a swamp? I see nothing wrong with it. ;)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #67 on: April 30, 2019, 12:59:49 am »
Why not just flood half of the island into a swamp? I see nothing wrong with it. ;)
Typical for Troll :>

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: XCOM Inspired Fantasy Game
« Reply #68 on: April 30, 2019, 09:45:36 am »
Typical for Troll :>

An ogre! Ogre! :)

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #69 on: May 11, 2019, 01:37:31 am »
Finished the initial version of island generator. For now it is good enough to test gameplay. Random generation is surprisingly methodical, it appears there is just one right way to do it, but countless wrong ones.

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: XCOM Inspired Fantasy Game
« Reply #70 on: May 11, 2019, 02:02:45 am »
Looking god mate, reminds me of Heroes of might and magic.

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #71 on: May 11, 2019, 01:28:03 pm »
Looking god mate, reminds me of Heroes of might and magic.
It doesn't really have much in common. HOMM3 obviously used voronoi diagrams to generate maps, judging by the geometrically perfect biome shapes. I'm not using them, because they don't appear to have any advantage over fractals and harder to control. Especially when it comes to placing roads and rivers. With fractals, you have mountains, rivers and forests forming naturally, which give birth to settlements, which are then connected with roads. With voronoi people typically placed rivers/roads along voronoi cell edges. It is also easier to fine-tune fractals by say replacing random with statistically correct data, so you could get islands having curvature similar to that of Ireland, or some Moon crater :D

Also, for now I've reduced the amplitude of road variation, as it was too noisy.



Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #72 on: June 07, 2019, 05:14:50 pm »
The progress is steady  :D

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #73 on: July 16, 2019, 09:33:51 am »
1. Is this buildable from https://github.com/saniv/spell-of-mastery ?

2. What is/was your nick at L.O.R. ?

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #74 on: July 16, 2019, 08:09:06 pm »
1. Is this buildable from https://github.com/saniv/spell-of-mastery ?
I doub't anyone but myself can build it - few IT skilled people tried but failed. I won't be making the build user-friendly, not until I've finish the programming language design. This game is basically a big unit test for the language design and helped me to find the parts needing improvement :D

2. What is/was your nick at L.O.R. ?
What is LOR? Linux.Org.Ru? I've been at LOR long time ago, but they banned me for anti-GPL shilling. I dislike the share-alike clause, which forces one to release all the source code, so he/she cannot monetize any investments into it. For example, you cant take Linux, improve it and sell it, because you don't retain the exclusive copyright (contrast that with BSD). This clause in fact only helps big players, like Microsoft, as long as Linux is inferior to Windows, but superior to any small-player commercial alternative, becasue it makes market-entry harder and suffocates competition.
« Last Edit: July 16, 2019, 08:11:10 pm by Nikita_Sadkov »