OpenXcom Forum

OpenXcom => Offtopic => Topic started by: Nikita_Sadkov on January 03, 2019, 12:37:07 am

Title: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 03, 2019, 12:37:07 am
Hi, folks! I'm working on an XCOM inspired fantasy game. It is not a carbon copy, and the most striking difference is that I don't use RNG, leading to numerous different design decisions. For example, instead of chance to hit, to penetrate high defense armor, attacker has to spend action points. This allows for example using some at first glance useless unit, with a lot of action points, like say bird, to distract defender, while slow heavy hitter does the damage. The next difference is the shift towards spellcasting and terraforming map. For example, if player has imp worker, it can dig underground passage into a prison under castle, free inmates there and then attack the castle from underneath. The other way would be flying over moat (with flight spell or flying creatures), teleport there, pass through walls with wraiths (which also see through walls), create elevation to reach castle wall. Obviously, player can just storm the heavy guarded front gate.

The game engine also supports portals and large doors (you cant have a proper castle with puny little door). And AI uses them too.

Still the game borrows a lot of elements from Gollop's games, especially Lords of Chaos and XCOM. I.e. there is chryssalid style monsters and a raise dead spell producing undead units, which are very resistant to non-enhanced attacks. The game has a world map, invasion threat and randomly generated maps (cities, dungeons, etc...), but I also plan adding ability to play as bad guys instead.

Do you have any suggestions or wishes for such a game? For example, what do you think should happen if two units teleport into the same place or if unit tries to teleport into the fog of war ends up teleporting into a wall? For now, just strongest unit survives (i.e. the wall).

(https://i.imgur.com/Z5QBTue.png)
(https://i.imgur.com/af8IRwV.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: luke83 on January 03, 2019, 12:52:55 am
Very nice mate, i would like to test your game then i could you my 2 cents worth :), please PM me if you want a game tester.

Title: Re: XCOM Inspired Fantasy Game
Post by: Valken on January 03, 2019, 09:00:14 am
Beautiful pixel artwork! Would love to see a demo video once you have a working alpha build.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on January 03, 2019, 01:15:09 pm
In deed it looks promising. Overall right now I only see couple of things that could be improved in graphics.
First of all this selection box should be have some graphics not some green lines (or it is only debug thing?).
Second is to show not visible tiles as black, right now edge of visibility look too "sharp" (tiles look like they hangs in space because you do not see other around).
Some thing like that is done by OXC. Probably best version would be if tile is show as black only if it is adjacent to visible tile. With this edges will look more pleasing and you will see this star background too

btw all star "spikes" should have same orientation: https://en.wikipedia.org/wiki/Diffraction_spike
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 03, 2019, 04:55:50 pm
First of all this selection box should be have some graphics not some green lines (or it is only debug thing?).
The cursor is a paceholder which will be eventually replaced with proper graphics.

Second is to show not visible tiles as black, right now edge of visibility look too "sharp" (tiles look like they hangs in space because you do not see other around).
Some thing like that is done by OXC. Probably best version would be if tile is show as black only if it is adjacent to visible tile. With this edges will look more pleasing and you will see this star background too
Yeah. Fog of war needs future improvements. But for now it is of lower priority, than implementing features. I'm curious how Magic & Mayhem and XCOM games implement FOW. I did it though bruteforce raycasting. But I doubt original XCOM used such resource intensive routine.

Anyway, the game has Facebook page. I will post future updates there:
https://www.facebook.com/groups/298041333699422/
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on January 03, 2019, 06:28:34 pm
Yeah. Fog of war needs future improvements. But for now it is of lower priority, than implementing features. I'm curious how Magic & Mayhem and XCOM games implement FOW. I did it though bruteforce raycasting. But I doubt original XCOM used such resource intensive routine.
This depends on number of "rays" you use and more importantly what limitation you can impose on this.
First of all this will be only calculated when unit move to next tile, this mean this will happens only once per second, in this time you could render normal graphic using raycasting.

Some time ago I added new light engine to OXCE that propagate more realistically (walls block it). Each source of light was separately calculated.
This was a lot more computation intensive that simple FOV calculation. Example of hardest case was opening doors when on one side of it rage fire storm.
Then I would need update around 20 source of light for some large area. Naive implementation give 1s lag each time you open/close door.
After adding lot of limits and optimizations now this is not visible (at least on my hardware :D).

https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Battlescape/TileEngine.cpp#L399
https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Battlescape/TileEngine.cpp#L503
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on January 03, 2019, 08:23:58 pm
It all looks very pretty and intriguing, but I assume you want honest feedback, so...

The "I don't use RNG" is a complete deal breaker to me. It's fine in a card game, but a combat strategy? Sorry, but no.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 04, 2019, 01:07:19 pm
Naive implementation give 1s lag each time you open/close door.
Yeah. That will get even more involved if you remove map height restriction. And suddenly you need to use something like octress to traverse the map. For example, I use use height=32, and that already forces me to use a lot of hacks, to avoid traversing every tile for FOW and pathfinding. Gollop was genius to implement that for Amiga! (an 80ies computer)

The "I don't use RNG" is a complete deal breaker to me. It's fine in a card game, but a combat strategy? Sorry, but no.

1. Random decisions are still allowed for AI. If AI has two similarly powerful spells, you will never know which one AI will use (unless you manage to lock AI's ability to cast that spell). Or say what route AI units will take to attack player.
2. Maps are randomly generated, with items also placed randomly.
3. Player creature and spell selection is also slightly randomized. There could be no elven mercenaries available at that time, because they are at war with dwarves. Or shortage of ingredients for that flight spell.

So there RNG is still here, just the non annoying kind. So if you want to polymorph that orc into a chicken, you will always get a chicen and not a dragon. So yeah, it is more of a puzzle game.

And the game is designed with multiplayer in mind, so RNG is a no-no for that. Unless you want players to insult each other about being lucky n00bs.

Although I still plan to add additional RNG-mode for players wanting that kind of experience of having to miss 50% of time. But that is of lower priority, because there already a lot of games with such RNG.
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on January 04, 2019, 01:50:54 pm
Thanks, I understand your decision.
It's just not a game for me... I don't care for e-sport mechanics. :P
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 25, 2019, 06:28:34 pm
Thanks, I understand your decision.
It's just not a game for me... I don't care for e-sport mechanics. :P
Yup. It is hard to make a game that will cater to everyone, so for now I'm trying to make something unique.

I also plan adding different campaign modes, beside scenarios and XCOM style: one roguelike, and the other similar to what you see in Cortex Command. In future I hope making it into a very modable open source engine, which could be used to implement any similar game, from games like Final Fantasy Tactics like to Dwarf Fortress and Minecraft type games.
Title: Re: XCOM Inspired Fantasy Game
Post by: FeruEnzeru[RETIRED/I QUIT] on January 25, 2019, 11:34:09 pm
@Nikita_Sadkov
In future I hope making it into a very modable open source engine, which could be used to implement any similar game, from games like Final Fantasy Tactics like to Dwarf Fortress and Minecraft type games.
Aw that's a good one! :)
Man, i wish XCOM:EU2012/EW (not Long War 1) was moddable til 2020s or 2030s instead of 2019/this year. :-\
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 27, 2019, 01:44:42 pm
Aw that's a good one! :)
Man, i wish XCOM:EU2012/EW (not Long War 1) was moddable til 2020s or 2030s instead of 2019/this year. :-\
I checked this XCOM reboot when it came, and found that the reboot is completely different game from original XCOM. It seems devs looked over screenshots from original XCOM and made unrelated game with the same name. Nice graphics, but everything else is static and scripted so tightly, you may as well watch a TV show instead. It is like visiting paleontology museum vs traveling with time machine to see real dinosaurs. Even worse story happened with System Shock reboot, where devs showed nice demo, made selfies with Warren Spector, collected money and ran away with them.
Title: Re: XCOM Inspired Fantasy Game
Post by: Stoddard on January 27, 2019, 03:51:43 pm
I checked this XCOM reboot when it came, and found that the reboot is completely different game from original XCOM. It seems devs looked over screenshots from original XCOM and made unrelated game with the same name.

There's project lead's interview floating on the net where he talks about making an true sequel prototype, presenting it and then Sid Meier showing him the light. Pathetic, really. But explains the mess.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 06, 2019, 03:10:01 pm
Made a playable preview release:
https://nikitasadkov.itch.io/spell-of-mastery-demo

Suggestions are welcome.

(https://i.imgur.com/PvGTCZY.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Stoddard on February 06, 2019, 05:57:38 pm
Made a playable preview release:
https://nikitasadkov.itch.io/spell-of-mastery-demo

Suggestions are welcome.


Cool! But it looks like you put lib directory instead of src or a link to github into the .zip

Edit: ah, now I get it. It's your own runtime and your own lisp. Very cool.
Title: Re: XCOM Inspired Fantasy Game
Post by: Meridian on February 06, 2019, 06:44:02 pm
Very nice colors and shades.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 06, 2019, 07:12:05 pm
Cool! But it looks like you put lib directory instead of src or a link to github into the .zip

Edit: ah, now I get it. It's your own runtime and your own lisp. Very cool.
Yeah I'm a big fan of Lisp, so I decided to write game in Lisp. Spell of Mastery is actually my second game. The first one was Warcraft 2 engine implementation in Common Lisp (SBCL). It was fairly complete with working AI and all spells implemented: https://www.youtube.com/watch?v=-k8jkeFfnl0
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 12, 2019, 02:02:09 am
Implemented fire, lightning and explosions burning grass and flammable objects. Also added a bugfixes to the demo at https://nikitasadkov.itch.io/spell-of-mastery-demo

Remaining major features:
1. Collapsing structures. This one require introducing material strengths. Metals can have large overhangs than soil.
2. Water/lava dynamics. Moving water is actually an important tactical feature. Say flooding a cave full of enemies. Or in multiplayer maps player can create bottleneck by flooding trenches. Fantasy setting makes it easy to introduce such feature, because there could be say a flood spell.
3. Passable objects blocking vision, like smoke screen or tall bushes, which could be especially useful to burn down.

(https://i.imgur.com/JW3VU0H.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 14, 2019, 02:51:13 am
Ok. Done implementing fog/tall grass blocking vision. Also fixed a ton of bugs. As always, comments and suggestions are welcome.

(https://i.imgur.com/nL6DjS1.png)

The Fog of War regeneration mechanics is actually allows some choices with various drawbacks. For example, FOW can be regenerated at the end of players turn, at start of player's turn, both at the start and at the end, or when any unit finishes movement. Deciding how to implement FOG of war, I made a pros/cons table (such tables appear to be a common game design instrument).

End of Turn:
- Pros:
  - Player doesn't see enemy movement in territories he left.
  - Player can still see enemies which killed his units or casted Mist.
  - Player can see all terrain he uncovered during this turn. Makes it easier for player to remember stuff. Especially if player loads the game after few days.
  - AI handles it easily, noticing positions of your units.
  - Intuitive.
- Cons:
  - Effects like Mist wont blocking vision won't be immediately noticeable.

Start of Turn:
- Pros:
  - Effects like mist blocking vision will be immediately noticeable.
- Cons:
  - Player can see enemy movement in territories he left.
  - Player can still see all enemy movement in mist until the start of his turn. That will be just an annoyance.
  - Really hard to make AI handle it.
  - Non-intuitive.

Both Start and End of Turn:
- Pros:
  - Some combined pros of both approaches.
- Cons
  - Really hard to make AI handle it.
  - Non-intuitive.

Each time unit finished its movement:
- Pros:
  - Very intuitive.
  - Spells like Mist immediately take effect.
- Cons:
  - Less tactical depth: player cannot move a scout close to uncover enemy units, then move that scout away and nuke the enemy with some area of effect spell, that would otherwise harm the scout.
  - Computationally intensive on large maps.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on February 14, 2019, 09:28:03 pm
Some thoughts about mist and fire. Overall I think its look bit out of place and do not fit good rest of graphic. It look bit too much diffused compared to rest of sprites.
Overall graphic is nice looking pixel art and this effect look like from some 3D game.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 15, 2019, 07:55:13 pm
Some thoughts about mist and fire. Overall I think its look bit out of place and do not fit good rest of graphic. It look bit too much diffused compared to rest of sprites.
Overall graphic is nice looking pixel art and this effect look like from some 3D game.
There is a number of reasons I decided to use non-pixelart effects.
1. Alpha channel allows to easily show objects inside mist and fire. And blends nicely with any object, as opposed to say dithering. In XCOM artists had to keep flames really small and close to the ground to avoid obscuring units. You just don't get that massive firestorm effect burning trees. Same with mist, which should be the height of a unit to actually block sight, otherwise it will look silly.
2. It is a common practice to use alpha-channel true-color effects in modern pixelart turn-based games, and even in some older, like Age of Wonders (it combines index painted pixelart with pre-rendered graphics), Master of Magic, Magic & Mayhem and Mage Knight Destiny Soldier for GBA.
3. Full color gradients and transparency make special effects stand out.
4. You just cant nicely model mist and fire using pixels. Especially with large sprites. It will have a lot of ugly dithering, and nasty gradient jumps. I also found it much harder to produce good looking pixelart effects.
5. There is a good amount of ready to use true-color stock art effect templates, both free and commercial. Just load them into particle editor and create what you need. In fact, I had to convert a few pixel art effects I took from OpenGameArt into continuous color, because, while the effects were okay, they were looking just wrong with that dithering.
6. I still use pixelart for a few effects, like the magical goblet for bless spell.


Also, there is an indie game called, Waves of Fate, they do use pure pixel art effects in it (down to scary dithering in place of transparency), but it looks okay due to generally non-realistic art style: https://store.steampowered.com/app/467270/Weaves_of_Fate/

Then again, many older pixelart games, like Final Fantasy Tactics, combine everything that works. Although I always thought that FFT's 3d landscape is the ugliest part of the game, after the pre-rendered intro cutscene, which was outsourced to that infamous Russian studio, which made Zelda Phillips CDI games. Still FFT's 3d magic effects were really beautiful, and impossible to achieve with pixelart.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on February 16, 2019, 01:40:01 am
You did not get exactly my point. I fine with transparency and special effects on graphic, some thing I did:

https://openxcom.org/forum/index.php/topic,1532.30.html
https://openxcom.org/forum/index.php/topic,322.msg4504.html#msg4504
https://openxcom.org/forum/index.php/topic,2059.0.html

I once made default fire semi-transparent in some old branch of OpenXcom.

My point was that graphic used for this effect was too much blurred compare to rest of graphic. Transparency can have impact on this but I do not think this main reason.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 16, 2019, 05:27:17 pm
My point was that graphic used for this effect was too much blurred compare to rest of graphic. Transparency can have impact on this but I do not think this main reason.
Well, it is a fog, it is supposed to be blurry and annoying to players. There are a few spells, like tornado to get rid of it.

Also, implemented rain effect, which would reduce sight, extinguish fires and prevent fire spells from being cast at outside locations. I'm unsure how much and when rain should go. Maybe the rain could be that one place where RNG will be allowed? I really want to avoid RNG and make game as fair as chess, but making it rain every 31st turn would look silly. Obviously rain should be controlled by biome, so there will be no rain in the desert, but a lot of rain in rainforest. Should rain spawn mist? How to spawn mist in deterministic way, without RNG? Then again, what do I know about raining? Or maybe making rain into a spell, casting which would change weather?
(https://i.imgur.com/NyvIq6T.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 18, 2019, 03:30:31 am
Dynamic water - done. In future I will also add lava, which would set nearby objects on fire and cool into stone under rain or in contact with water.

Still these liquid interactions are rather tricky and allow for a lot of possible implementation, with various drawbacks and game design shortcomings.

(https://i.imgur.com/luhKzVH.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 24, 2019, 01:45:00 am
Ooookay. One huge update. Dunno if you people can implement the same in OpenXCOM  :P I'm sure in one thing, with XCOM style map cell format you will have to use different approach.

Version 0.9a changes:
- Smooth fog of war, due to multiple requests. For some reason people were really annoyed by contrast square fog tiles   :-\

Version 0.9 changes:
- Dynamic Water.
- Cataclysm spell to flood your enemies and open a passage through waters. Finally you can play as Moses!
- Tornado spell, which scatters units and removes mist.
- Proper time system, instead of abstract turns. Now every turn models real life hour.
- Night time: every 8 turns out of 24 turns day, from 22:00 to 6:00. Undeads have more defence at night, while units without darkvision have reduced sight.
- Rain, which extinguishes flames in outdoor areas and prevents the use of fire spells, like firestorm and fireball. Units inside rain get -1 to sight.
- Proper wood bridge tile, instead wooden floor.
- Fixed fog sight bug, when cell below or above give units cant be accessed inside fog.
- Fixed bug with invalid empty check, affecting several spells and leading to potential crashes when one creature teleports into another creature.
- Fixed crash hiding drowning unit.

(https://i.imgur.com/OSD4KZ8.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on February 24, 2019, 06:11:39 pm
(https://i.imgur.com/luhKzVH.gif)

Does it mean we can blow up parts of the map to drain water? :)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 25, 2019, 02:38:14 am
Does it mean we can blow up parts of the map to drain water? :)

Yup. It would also allow randomly generating puzzles, if water reservoirs are placed randomly. Although soil is really explosion resistant material, unless it is really heavy explosion leaving a crater, so currently I have limited terraforming only to the imp unit, which also digs passages, builds ladders and bridges. In XCOM game that would be a soldier with a shovel (I'm surprised OXC havent implemented trench digging yet). The flood/cataclysm spell was a little overpowered, so I had to reduce ranger and implement accretion time, so AI will have a few turns to move out of the way.

Here I imp below digged under the river, redirecting the flow and drowning in the process.
(https://i.imgur.com/RI9bx8O.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 28, 2019, 09:49:53 pm
Done collapsing terrain, killing units caught inside and giving fall damage to the ones standing on top. Still needs some proper animations. IIRC, collapsing multi-floor buildings were major feature of XCOM Apocalypse. I haven't seen them in any other game.
(https://i.imgur.com/0JI93cF.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 05, 2019, 10:47:36 pm
Original XCOM engine had somewhat intricate sprite format, requiring artist to carefully split sprites into into multiple cells. That was especially annoying with larger objects, like trees or tanks (dunno if Gollop had some cool algorithm to do that automatically). I just use free form sprites, leading to more complicated draworder algorithm, especially when most humanoids have a height of 2 cubes. I also limit movement direction to north,south,west,east, which requires me to draw sprites only in two directions. Still a lot of routine work.
(https://i.imgur.com/j63HGSl.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 05, 2019, 11:07:53 pm
Some interesting notes from original XCOM Apocalypse developer:
http://www.terrygreer.com/xcomapocalyse.html
Quote
The editor was an updated version of the one used for the earlier xcom games.

Every tile was designed to occupy a volume of space. Many tiles had multiple versions showing a succession of destroyed states.

In the description off each tile there was a series of properties such as ‘health value’ and ‘destroyed tile type’. when the health value was eroded away the tile would then be replaced by the ‘destroyed tile type’ (which in turn could have its own health and destroyed type). Chains like this could be as long or short as required. Tiles could of course also bed invulnerable.

This approach meant that potentially anything in the map could be blown apart and destroyed. This was made even more true in Apocalypse as tiles could also be flagged as supportive, and if a supportive tile was destroyed then those above it could also fall.

 

Tiles were complex data structures. Each one also had a reference to line of sight definition – this was a simple 4x4x4 grid – a sort 3d texture – where each cell was either solid or empty. There were a relatively small number of these solid line of sight definitions, but enough to approximate the 3D shape of any shape of tile created. This meant that the world was effectively broken into a 3d voxel grid where weapon fire could be accurately ray-traced. It was a ball ache to set up initially, as every tile had to have a line of sight definition assigned, but really made life easy later on as collision in game then became automatically generated from the map editor.

It was a genius approach, especially in the years before decent 3d raytracing – and one of the key identifying features of an xcom game. Players always loved being able to snipe enemy forces from right across the map through a couple of windows or blown open walls. It’s also a technique which I think useful to reinvent for use in conjunction with true 3D worlds and can think of lots of good mechanics you could use them for.

 

While some mission maps were hand crafted (especially apocalypse and the end missions of every game), many other mission maps in XCom games were made procedurally (especially in the earlier games).

 

The procedural rules would:

  1. Decide on the location type (e.g. farm, port, city etc)

  2. Then, using a look-up table specific to the location type selected a look up table would let a number of small hand crafted sections be chosen at random (though rules would restrict how often each piece could be chosen).

  3. Mix together these sections (with simple rules that specified which sections could be adjacent to which other sections).

The result was a vast number of possible layouts – for all intents and purposes near infinite, and unique to each user.

The procedural nature of these maps made the games feel more personal to each user.

The recent remake eschewed this approach and instead went for a large number of hand crafted maps instead, although with random starting points (which was a shame).

Sadly I don't have screenshots of the tools we used for these isometric games

Were these tools ever made public? Or maybe their code was left in the game's executable?
Title: Re: XCOM Inspired Fantasy Game
Post by: Stoddard on March 06, 2019, 12:52:40 am
many thanks for the link.

it only emphasizes why great games are not ever done by big or even medium-sized studios.

editor: no, while i'm sure it's still out there somewhere, it's hopelessly outdated anyway. we have MapView

the rest is documented in ufopaedia.org and the source code.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 06, 2019, 11:54:04 am
it only emphasizes why great games are not ever done by big or even medium-sized studios.
Yeah. That Terry Green also designed other cool and innovative games, such as http://www.terrygreer.com/xenomorph.html (a System Shock style game long before System Shock). https://www.youtube.com/watch?v=QKVNnnqyuZY

It was an obvious inspiration for System Shock, down to soundtrack.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 09, 2019, 03:10:11 am
Implemented different biomes. Because you cant have lava without snow :P

Things to do:
- Cell temperature, melting ice/snow and setting objects on fire. Then things like lava and fire could just increase the temperature of creatures caught inside them.
- Air/oxygen. Closed rooms with creatures lose oxygen level, making non-undead creatures to die.
- Lava damaging flyers staying over it (should come with the cell temperature).

Well it is hard keep todo list from growing, because many features come naturally. You need lava damage and convection, you have to implement air and cell temperature. Lava should be really hot inside closed spaces.

(https://i.imgur.com/3kQ1DTn.png)
(https://i.imgur.com/safbafK.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on March 09, 2019, 01:06:31 pm
Dude, you are insane in the best way possible.

If only you considered dice rolls... ;)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on March 09, 2019, 07:26:31 pm
This is too insane :D
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 14, 2019, 11:38:07 pm
Dude, you are insane in the best way possible.

If only you considered dice rolls... ;)
I do consider them as an option, something like hardcore mode.

Anyway, further work on gas diffusion would be introducing the scent propagation: each scent has a umber of components, and different units emit different proportion of these components. So if you have say a dog on a team, it may sniff the scent of the alien hidding behind the corner. Or you may use it for the usual diffusion based pathfinding, which would reduce the otherwise complex pathfind problem to just O(1). And the scent diffusion is an embarrassingly parallel problem, so in real-time setting one can easily run diffusion on several CPUs, or update diffusion it once in a few game cycles, when there isn't much going on.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 01, 2019, 07:23:01 pm
Implemented halved tiles. When designing an isometric engine, there are numerous decisions one has to make:
1. Will the engine allow truly 3d world without hacks? Like i.e. room over room.
2. Would the game world be cell-based, continuous or combine both approaches?
3. For cell based worlds, one has to pick unit-sized cell. Like i.e. 32x32x32 cube of 1x1x1 voxels.
4. What would be the cell format? Are walls going to be embedded into tile as well as floor or use separate tiles?

For example,
1. Magic & Mayhem has cell based world, but uses 32x32x16 cells. That approach is simple and robust, but requires splitting everything into such very small tiles or use some ad-hoc hacks for topologicaly sorting larger tiles, so they won't be ovedrawn with tiles behind
2. Original XCOM uses 16x16x16 cells and embed walls and floor into these cells, making it very involved to say trace a bullet path, while walls look really thin and units cramped into walls. Now cels can block vision from one side, while allowing to see from another.  Such approach also greatly impedes dynamic effects, like water flows. XCOM also allows fatter walls, further complicating engine. Yet it is very efficient, because it greatly cheapens topological sorting and extends map size, because walls are stored as part of cell and sorted with it.
3. Furcadia uses approach similar to XCOM, but walls can have any height, yet they still look very thin.
4. Ultima 8 and Faery Tale 2 use continuous world approach with cell sized tiles.
5. Final Fantasy Tactics allows only varying floor height. Many similar games are lazily implemented by making each tile type into a long pilar, which is just moved up or down to accommodate for height, instead of introducing proper tiling and draw order sorting.
6. Diablo have just floor and objects on top of that floor. The simplest type of isometric game to make.
7. Stronghold used some very complex approach, basically splitting every building into very small cubes, supposedly automatically. All these crenelations on towers properly obscured units. One of the more complex isometric game engines. Still unsure how the implemented pathfinding.

Anyway, picking base cell size doesn't really limit tile size, with some hacks one can implement finer 16x16x16 tiles in 32x32x32 engine.

(https://i.imgur.com/8QI0EVW.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 02, 2019, 05:51:52 pm
XCOM like Fantasy game which came out two years before XCOM, but I bet you never ever heard of it:
https://www.mobygames.com/game/four-crystals-of-trazere
>Armies of mutants are marauding through the land and it's up to the heroes to scour the cities, dungeons, and wilderness looking for clues to the source of the evil. The party moves from location to location on a strategic map avoiding (or ambushing) enemy patrols and armies while trying to find the clues and items they need in isometric dungeons and cities. The game also features an intricate magic system that lets players design and customize spells.

The game has very involved magic system, where player can adjust spell area of effect, time and range. I.e. instead of a single shot dispel cast, player can have a dispel field, removing enchantment from creatures entering it. Really neat concept although hard to balance and implement properly. I had an idea of refactoring spells into such system, after getting over with the basic game.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 08, 2019, 09:34:38 pm
Another feature - colored lights for various effects. It is probably possible to ray-trace sun's position and shade terrain behind walls.

(https://i.imgur.com/mGSv7DU.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 09, 2019, 02:55:54 pm
Some tricky hacks are required to implement even the basic lights in an isometric engine. But lights are a must in a game heavily focused on magic and throwing fireballs, which would look very bland as static sprites.

Although the basic formula is very simple:
Code: [Select]
lighten T E = T + T*E/Factorwhere T is the texture's light receptiveness, and E is the light's energy. Of course you need to apply that formula to each of the RGB components, unless you have the stylish black & white soviet TV. I heard they still use B&W TVs in Russia :D

Alas I never got why applying light is multiplication, not addition. Guess that is some complicated physics shit with typical square law.

That guy from Stencil forum actually raytraced lights: http://community.stencyl.com/index.php/topic,41034.450.html

surprisingly his code is efficient enough to run even in browser, although slowly. At that level you can just use completely raycast engine. Then again, even my hacky code uses some degenerate form of raycasting. There just no going around traversing space, when you need to draw lights.

(https://i.imgur.com/vXkGlAE.gif)
(https://i.imgur.com/zfC3kEM.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Anon011 on April 09, 2019, 05:45:56 pm
Very nice game Nikita, I like it so far.
Will you make a Russian localization for it one day?
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 10, 2019, 12:27:54 am
Very nice game Nikita, I like it so far.
Will you make a Russian localization for it one day?
The programming language I use doesn't support unicode.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 10, 2019, 11:48:34 pm
Another tricky design decision: how to implement floating islands. The most robust way appears to be implementing special floating property for tiles. That way it could also be associated with some control structure, allowing it to move in 6 directions, maybe even landing and crushing units below. It would be near impossible to implement even a remotely challenging dueling AI in this setting (given that we still struggle to implement competitive AI for Starcraft), therefore such maps should be kept to XCOM style exploration, puzzles or multiplayer. Although I've plans implementing dueling AI, like in Magic & Mayhem, but on simpler arena maps, and giving AI some bonus, like several lives and more spells.

For now I've redrawn a public domain fir tree: https://opengameart.org/content/pine-tree-16x16

I dislike drawing, but not getting away from it, when there are no suitable free assets.

(https://i.imgur.com/cayKbVi.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 12, 2019, 12:06:59 am
Ok. Resized the tree to match the game proportions, and drawn another fir tree. These trees are a bit out of angle, and it can be fixed by scaling it by Y and adding a few backside slopes to branches, but that wont really make it look better - pure isometry is little bit too boring.

Also, in case of XCOM and Magic & Mayhem engine trees, the lower branches would be occluding the stuff on the ground, like the corn. While graphically correct, that isn't really a good thing, because occluded thing can be say an important key, fallen out of a dead monster, and because occlusion requires properly shading the object below (bright corn under branches will look incorrect).

(https://i.imgur.com/NAQvJlC.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on April 12, 2019, 09:34:50 pm
I for long time think amount 2.5D graphic engine. This mean that each screen pixel have not only color but depth too. With something like this drawing order will be only secondary thing. You will check for each pixel you draw if you it behind or on front of background pixel.

With something like this you could add shadows too, special surface that have two depths, if background pixel have depth that is in this range we change shade of this pixel.

Overall each blit function will have not only `x` and `y` but `z` coordinate too.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 15, 2019, 01:52:04 am
I for long time think amount 2.5D graphic engine. This mean that each screen pixel have not only color but depth too. With something like this drawing order will be only secondary thing. You will check for each pixel you draw if you it behind or on front of background pixel.
That is called z-buffering. It is slower than draw-order sorting and doesn't solve the problem of higher layer popping through the layer below, or floor in front of a sprite cutting legs off large characters (that is why XCOM tanks are split into several cubes). Here is an example from Daimonin of what happens with naive approach (notice the cut off dragon legs and the poor botched wurm)
(https://i.imgur.com/xoshUcD.png)

To solve the problem you need actual 3d transformations,  and mapping each sprite as texture to a polygon. I actually tried doing it in software and it is orders of magnitude slower than topological sort. Although Ultima Online did it somehow in 90ies. I.e. it needs OpenGL, which requires 32bit textures in precise 512x512 pages, forcing to pack all graphics into such pages, which requires writing very tricky packing algorithms. In addition OpenGL doesn't support paletted textures, so no way to recolor units or do color cycling, so you need write a lot of tricky shaders to support that. And you will still need to sort transparent surfaces, which is especially nasty, when most of your sprites have some transparency. It is also harder to control 3d polygons. For example, same cell may have a pebbles sprite, a unit standing on top of said pebbles, a weapon that unit is holding and some effect, like explosion or fire over that unit. These elements should be drawn in that precise order, it would be silly if weapon gets drawn before the unit.

So yeah, OpenGL and any 3d brings in more problems than it solves. And of course say good bye to portability, because each graphics card does something differently.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on April 15, 2019, 09:24:24 pm
You missed one important aspect, EVERY pixel have depth, this mean destination and source too. If unit clip it should look like it dive into water.
And performance will not be very bad, OXC already do half of work that I image will be needed. Overall my idea how it will work is based on my work on OXC.
I already use some custom surfaces to make some special effects, like globe illumination using normal vectors. All done in software.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 16, 2019, 04:24:51 pm
You missed one important aspect, EVERY pixel have depth, this mean destination and source too. If unit clip it should look like it dive into water.
And performance will not be very bad, OXC already do half of work that I image will be needed. Overall my idea how it will work is based on my work on OXC.
I already use some custom surfaces to make some special effects, like globe illumination using normal vectors. All done in software.
Triangle rasterizing code is much slower than a direct blit, even if you optimize it with SSE. For each sprite you will have to project 4 vertices, draw 2 triangles, interpolating Z and UV across them. Here is the bare minimum to implement OpenGL-like triangle drawing in software:

Code: [Select]
static void draw_span(lerp *l, int y, int x, int end_x) {
typedef unsigned short fixcol;
#define fix(x) ((fixcol)(signed short)((x)*0xffff))
#define unfix(x) ((float)(x)/(0xffff))

int tt[640];
memset(tt, 0, 4*640);

// color layout: AAAA|RRRR|GGGG|BBBB

Uint16 mm0[4];
mm0[3] = fix(A(l));
mm0[2] = fix(R(l));
mm0[1] = fix(G(l));
mm0[0] = fix(B(l));

Uint16 mm1[4];
mm1[3] = fix(AD(l));
mm1[2] = fix(RD(l));
mm1[1] = fix(GD(l));
mm1[0] = fix(BD(l));

Uint16 mm2[4];
mm2[3] = fix(0.0); // ambient color shouldn't affect alpha
mm2[2] = fix(ambient_r);
mm2[1] = fix(ambient_g);
mm2[0] = fix(ambient_b);

// uv layout: 0000|0000|VVVV|UUUU
Uint16 mm6[4], uv_delta[4], uv_wh[4], uv_bp[4];

mm6[0] = fix(U(l));
mm6[1] = fix(V(l));
mm6[2] = 0;
mm6[3] = 0;

uv_delta[0] = fix(UD(l));
uv_delta[1] = fix(VD(l));
uv_delta[2] = 0;
uv_delta[3] = 0;

uv_wh[0] = texture->w-1;
uv_wh[1] = texture->h-1;
uv_wh[2] = 0;
uv_wh[3] = 0;

uv_bp[0] = texture->format->BytesPerPixel;
uv_bp[1] = texture->pitch;
uv_bp[2] = 0;
uv_bp[3] = 0;

fixcol one[4] = {0xffff, 0xffff, 0xffff, 0xffff};
float z = Z(l);
float zd = ZD(l);

Uint8 *dst = (Uint8*)screen->pixels + y*screen->pitch +
x*screen->format->BytesPerPixel;

// now we have following arrangements:
// EAX is temporary
// EBX points to zbuffer
// ECX is used for debugging
// EDX holds final location in screen buffer
// ESI points to texture
// EDI points to screen buffer
// MM0 holds light color
// MM1 holds delta for light color
// MM2 holds ambient
// MM3 holds resulting color between stages
// MM4 is temporary
// MM5 is temporary
// MM6 holds uv
// MM7 holds 0
// XMM6 holds Z
// XMM7 holds Z Delta
// others are unsed
// MMX code assumes that botch: screen and textrue are in BGRA format
asm (
"movq %0,%%mm0\n\t"
"movq %1,%%mm1\n\t"
"movq %2,%%mm2\n\t"
"movq %3,%%mm6\n\t"
"pxor %%mm7,%%mm7\n\t" // mm7 = 0

"movss %8,%%xmm6\n\t" // z
"movss %9,%%xmm7\n\t" // zd

"jmp loop_start\n\t"

"loop_body:\n\t"

// Z-BUFFER TEST
"test $1, %%ecx\n\t"
"jz skip_ztest\n\t"
"movss (%%ebx), %%xmm5\n\t"
"cmpss $2, %%xmm6, %%xmm5\n\t" // xmm5 <= xmm6
"movd %%xmm5, %%eax\n\t"
"test %%eax, %%eax\n\t"
"jz loop_advance\n\t"
"movss %%xmm6, (%%ebx)\n\t" // save new z-value of this pixel
"skip_ztest:\n\t"

// TEXTURE MAPPING (mm3 holds result)
"movq %%mm6,%%mm3\n\t" // mm3 = uv
"pmulhuw %5,%%mm3\n\t" // mm3 = u*w, v*h
"pand %5,%%mm3\n\t" // mm3 = (u*w)%w,(u*h)%h : wrap
"pmaddwd %7,%%mm3\n\t" // mm3 = linesz*vh+colorsz*uw
"movd %%mm3,%%eax\n\t"
"movd (%%eax,%%esi),%%mm3\n\t" // mm3 = packed_texture
"punpcklbw %%mm7,%%mm3\n\t" // mm3 = texture

// LIGHTS (mm3 holds result)
"test $2, %%ecx\n\t"
//"jz skip_lights\n\t"
"movq %%mm0,%%mm4\n\t" // mm4 = light
"pmulhuw %%mm3,%%mm4\n\t" // mm4 = light*texture
"pmulhuw %%mm2,%%mm3\n\t" // mm3 = ambient*texture
"paddusb %%mm4,%%mm3\n\t" // mm3 = (light + ambient)*texture
"skip_lights:\n\t"

// BLENDING (mm3 holds result)
"test $4, %%ecx\n\t"
"jz skip_blending\n\t"
"pshufw $0xff,%%mm3,%%mm4\n\t" // mm4 = src_alpha
"psllw $8,%%mm4\n\t" // convert mm4 to fixed point
"pmulhuw %%mm4,%%mm3\n\t" // mm3 = src*src_alpha
"movq %6,%%mm5\n\t" // mm5 = 1
"psubw %%mm4,%%mm5\n\t" // mm5 = 1-src_alpha
"movd (%%edi),%%mm4\n\t" // mm4 = dst_packed
"punpcklbw %%mm7,%%mm4\n\t" // mm4 = dst
"pmulhuw %%mm5,%%mm4\n\t" // mm4 = dst*(1-src_alpha)
"paddw %%mm4,%%mm3\n\t" // mm3 = src*src_alpha + dst*(1-src_alpha)
"skip_blending:\n\t"

// ENDING
"packuswb %%mm7,%%mm3\n\t" // pack pixel in mm3...
"movd %%mm3,(%%edi)\n\t" // and puti it to final resting place

// ADVANCE
"loop_advance:\n\t"
"paddw %%mm1,%%mm0\n\t" // advance light
"paddw %4,%%mm6\n\t" // advance uv
"addss %%xmm7,%%xmm6\n\t" // advance z
"add $4,%%edi\n\t" // advance x
"add $4,%%ebx\n\t"

// LOOP CONTROL
"loop_start:\n\t"
"cmp %%edx,%%edi\n\t"
"jl loop_body\n\t" // jmp if edi < edx

"emms\n\t" // reset FPU after MMX
:
:
"m" (*mm0), // 0
"m" (*mm1), // 1
"m" (*mm2), // 2
"m" (*mm6), // 3
"m" (*uv_delta), // 4
"m" (*uv_wh), // 5
"m" (*one), // 6
"m" (*uv_bp), // 7
"m" (z), // 8
"m" (zd), // 9
"c" (flags), // ecx
"b" (zbuffer+y*screen->w+x), "d" (dst+(end_x-x)*4),  "D" (dst), "S" (texture->pixels)
);
}
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on April 17, 2019, 04:16:39 am
I want 2.5D engine, not 3D engine :>
I not even try implement drawing triangles. Simply biting 2D sprites with depth (that can be implemented as two normal surfaces but one is not treated as color but as depth).

https://github.com/Yankes/OpenXcom/blob/master/src/Geoscape/Globe.cpp#L987
https://github.com/Yankes/OpenXcom/blob/master/src/Geoscape/Globe.cpp#L175
This is shading I spoke before, each pixel have predefined normal vector and based on this I calculate sun shading on globe.
And everything still 8bit.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 17, 2019, 05:05:04 pm
I want 2.5D engine, not 3D engine :>
I not even try implement drawing triangles. Simply biting 2D sprites with depth (that can be implemented as two normal surfaces but one is not treated as color but as depth).
Where will you get the depth surface? 3d software generates it together with sprite? I remember there was some zombie-shooter game demo, where artists hand-drawn such z-surface onto each pixelart sprite, so dynamic light would highlight these sprite properly from any angle. A ton of work, and I havent heard about them since then. Guess their project is dead. And as I said with just z-buffer you will still get wrong draw order like: https://www.youtube.com/watch?v=BJYH-UrQ2xs
That guy solved it with two zbuffers, one for draw order, another the usual depth buffer. I solved it with topologically linking objects in a tree of what occludes what, but did that locally and only for specific units. I'm not using zbuffer now (although I had it in the first version), instead just sorting by x,y,z towards frustum.


https://github.com/Yankes/OpenXcom/blob/master/src/Geoscape/Globe.cpp#L987
https://github.com/Yankes/OpenXcom/blob/master/src/Geoscape/Globe.cpp#L175
This is shading I spoke before, each pixel have predefined normal vector and based on this I calculate sun shading on globe.
And everything still 8bit.
XCOM globe is an actual 3d object, so you get normal vectors for free with it.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on April 17, 2019, 07:41:57 pm
Where will you get the depth surface? 3d software generates it together with sprite? I remember there was some zombie-shooter game demo, where artists hand-drawn such z-surface onto each pixelart sprite, so dynamic light would highlight these sprite properly from any angle. A ton of work, and I havent heard
about them since then. Guess their project is dead.

Yes, you need prove it as separate surface, this need be lot of simpler than doing main graphic on its own. Flat shades that represents different depths could be enough in 99% cases. Alternative could be done using approximation form main graphic (inner parts should have more thickness that edges).

And as I said with just z-buffer you will still get wrong draw order like: https://www.youtube.com/watch?v=BJYH-UrQ2xs
That guy solved it with two zbuffers, one for draw order, another the usual depth buffer. I solved it with topologically linking objects in a tree of what occludes what, but did that locally and only for specific units. I'm not using zbuffer now (although I had it in the first version), instead just sorting by x,y,z towards frustum.
I do not think he use z-buffer in same way as I thinking how it should be used. You could consider each pixel of graphic as voxel in space 3D space. How one voxel with less z can occlude voxel with bigger z? Trick is that flat tiles shroud have ramp in z values, and tile ramps in some cases should have flat z values (this depend on angle of ramp compare to screen). You could even blit together background as one surface and reuse it in each frame.

This is important difference. You can see in this YT video that this buffer get brighter when it going to left side, this is wrong, it should be brighter when going to bottom edge of the screen.

I dig up my very old z-buffer test. Example in images. Red circle is draw as last but it overwrite all green "boxes". Second image is normalized z-buffer.

XCOM globe is an actual 3d object, so you get normal vectors for free with it.
globe is not 3d object, its drawn using 2d polygons, all 3d math is done on our side. Normals are only avaialbe because we know that globe is sphere, with this I can precalculate them for each pixel of screen and zoom level.

https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Geoscape/Globe.cpp#L914
https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Geoscape/Globe.cpp#L1988
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 17, 2019, 11:09:20 pm
globe is not 3d object, its drawn using 2d polygons, all 3d math is done on our side. Normals are only avaialbe because we know that globe is sphere, with this I can precalculate them for each pixel of screen and zoom level.
Reminds me of Ecstatica, but they actually preserved all 3d geometry from the raytrace stage to properly occlude everything:
http://dingevoninteresse.de/wpblog/?cat=12

During the raytracing stage they also used really interesting texturing method by filling rocks with randomly placed sharp boxes, and organic objects with ellipsoids, instead of modelling then in a 3d editor. They had no 3ds Max or Maya back then, or large memory sizes to push that many polygons even for offline rendering. That gave the game its immediately recognizable clean art style.

(https://i.imgur.com/lKqWkUT.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 19, 2019, 03:28:02 pm
With a game world split into discrete cells, especially large ones, there is another tricky design moment: picking hexes or squares. Squares are a bit easier to implement, yet naturally allow movement into only 4 directions. That is - squares create space with non-Euclidean topology and use Manhattan distance as a metric. Of course, trying to remedy that, you can also allow diagonal movement, opening a can of worms on its own, because units now move diagonally faster than they do horizontally. Surprise!

You can try solving that by further replacing the discrete number of action points with say a floating point number, subtracting 1.41421356237 for each diagonal move, instead of 1, but sqrt(2) is an irrational number, so there will always be some bias, unacceptable for a competitive turn-based strategy. Even worse, if you have two walls, sharing a corner, then a unit could still stick through it, even if it looks impassable.

(https://i.imgur.com/fMbbnUy.png)

Diagonal movement is clearly bolted on, but moving in just 4 directions would be too inaccurate and limiting for an strategy game, and that is why people prefer hexes to squares.

Yet with picking hexes, we have to make another important design decision: hex lattice can be rotated differently on screen. For example, Heroes of Might & Magic uses grid with vertically shared edges, while Battle for Wesnoth uses horizontally shared edge.

The case of vertical sharing allows for wide-screen friendly viewport, when each player has its own side of field, and units move without zig-zaging. Battle for Wesnoth maps on the other hand tend to placing two opponents at the north and south, because movement east and west will go in zig-zag.

Heroes of Might & Magic style grid also cheapens graphics production. In Wesnoth they have to draw units both facing south and north, while HOMM unit's sprite can be simply mirrored. That is in addition to nicer looking diagonal walls on castle siege maps. That saves both artist's time and and video memory.

Another decision is how to lay out hexes in a map. Obvious decision is to lay them in a square grid. Yet it would be a very bad idea to organize hexes as a square. A round world would be orders of magnitude better, as it allows easily making well balanced symmetric maps for any number of players, instead of just 4 corners or 4 edges of square grid. Round maps are important, because in hexagonal world area of effect and just larger structures too have hexagonal form. That is in addition to simplifying programming (it is a tricky task to pack hexes into a box).

That what they call good design - not fighting mathematics, but go along with it.

TLDR: my biggest mistake was picking squares over hexes. I would recommended hexagonal lattice even for real-time strategies. Unfortunately Blizzard doesn't feel enough competition to fix their competitive games and make the next Stracraft into a perfect game.


(https://i.imgur.com/Czy4mR9.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on April 19, 2019, 03:41:34 pm
I gotta say though, I hate hexes with a passion. The reason is simple: you can go in a straight horizontal line, but not vertical (or vice versa). This feels pretty shitty.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 19, 2019, 09:49:51 pm
I gotta say though, I hate hexes with a passion. The reason is simple: you can go in a straight horizontal line, but not vertical (or vice versa). This feels pretty shitty.
That can be remedied a bit by moving units vertically, when that is possible (i.e. there are no blocking units or triggers in the way), but only visually, behind the scenes units would still move on the lattice. In case of RTS, that will require more hacking obviously. Of course wargames, like Panzer General, move units directly in straight line right to their destination.
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on April 19, 2019, 09:58:20 pm
That can be remedied a bit by moving units vertically, when that is possible (i.e. there are no blocking units or triggers in the way), but only visually, behind the scenes units would still move on the lattice. In case of RTS, that will require more hacking obviously. Of course wargames, like Panzer General, move units directly in straight line right to their destination.

I'm fine with dirty tricks. ;)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on April 20, 2019, 07:47:48 pm
One solution would be not use hex but triangles, if they are arranged in hex then you keep all hex good properties but you still can have orthogonal moment.
Trick is that 1TU allow you to move thought 2 triangles. I added small graphic that show this, All red dots are valid unit positions, black lines are allowed "half" moves. Effective this is multiple hex grids overleaped on each other.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 21, 2019, 03:08:18 am
One solution would be not use hex but triangles, if they are arranged in hex then you keep all hex good properties but you still can have orthogonal moment.
Trick is that 1TU allow you to move thought 2 triangles. I added small graphic that show this, All red dots are valid unit positions, black lines are allowed "half" moves. Effective this is multiple hex grids overleaped on each other.
Yeah. That could work. And you can still reuse the same hex tileset.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 21, 2019, 01:15:23 pm
Digging out procedural map generation. The following appears to be the state of art:
https://github.com/redblobgames/mapgen4
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 21, 2019, 05:20:08 pm
A reverse engineered explanation of the original Civilization map generation algorithm:
https://forums.civfanatics.com/threads/civ1-map-generation-explained.498630/

basically, Civ1 accumulated several random-walks, and then fixed the resulting map so unit wont be moving across what appears impassable body of water.

I've used similar code in my ancient Warcraft II map generator: https://github.com/saniv/wc2gen/blob/master/src/wc2gen.c

But instead of random walk patches, I've just put several seeds, and then applied cellular automation to the whole map, first for landmasses, then for hills, and then for forests. After that trying to place resources and player bases.

Mapgen4 also uses same tactics with placing emitters, but then builds voronoi polygonal surface, instead of running cell automata or random walk.

Alternatives: fractal generation, with midpoint displacement; overlaying some noise functions (like Minecraft does with perlin noise); and XCOM and Spelunky style of combining premade map pieces (Minecraft also embeds premade pieces inside noses-function generated map).

Instead of voronoi, one can probably uses other methods to interpolate inside point cloud, like quadtrees or metacircles: https://dribbble.com/shots/1776495-Metacircle-effect-source-file
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 23, 2019, 07:14:52 pm
Decided to use midpoint displacement. It is trivial to implement, and orders of magnitude easier to control, compared to say perlin noise, voronoi or random walk. Although one can surely tweak random walk to produce something similar to midpoint displacement. In the end, all these methods are closely related.

Also, naive perlin noise generator producing circular(!) rivers:
https://mccormick.cx/news/entries/blog-post-game-code-dabbling

But yeah, some people love crazy abstract stuff. Many fans very unhappy when Minecraft's map generation got tuned down to be less extravagant, killing stuff like overhanging terrain.

(https://i.imgur.com/zBiFeRj.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.

(https://i.imgur.com/7c63s3n.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: ohartenstein23 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/ (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 (https://openxcom.org/forum/index.php?topic=5955.0).

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.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.

(https://i.imgur.com/CCQm7JU.png)

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.

(https://i.imgur.com/GGFK2vX.png)
(https://i.imgur.com/pMidLdS.png)
(https://i.imgur.com/6YBtfW0.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 28, 2019, 12:38:44 am
Slowly it comes to something usable in the game. Tilesets taken from Freeciv  :P
(https://i.imgur.com/VsxHCxH.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: luke83 on April 28, 2019, 04:54:22 am
wow, looking good.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.

(https://i.imgur.com/DbhZyrQ.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch 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. ;)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes 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 :>
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on April 30, 2019, 09:45:36 am
Typical for Troll :>

An ogre! Ogre! :)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.
(https://i.imgur.com/j3rulgy.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: luke83 on May 11, 2019, 02:02:45 am
Looking god mate, reminds me of Heroes of might and magic.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.

(https://i.imgur.com/W2e7nHf.jpg)
(https://i.imgur.com/q7w0Hve.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on June 07, 2019, 05:14:50 pm
The progress is steady  :D
(https://i.imgur.com/zR122do.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: tkzv 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. ?
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on July 19, 2019, 11:48:29 pm
I dislike the share-alike clause, which forces one to release all the source code, so he/she cannot monetize any investments into it.
Do game asserts fall under GPL? If not you can still sell them and add game engine as free bonus.

For example, you cant take Linux, improve it and sell it, because you don't retain the exclusive copyright (contrast that with BSD).
This is double edge sword, because it prevent big companies on profiting on your work for free. They need contribute back if they want use your work.
Red Hat is not MS but they still can profit from Linux and improve it.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on July 20, 2019, 11:20:43 am
Do game asserts fall under GPL? If not you can still sell them and add game engine as free bonus.
This is double edge sword, because it prevent big companies on profiting on your work for free. They need contribute back if they want use your work.
Red Hat is not MS but they still can profit from Linux and improve it.
Big companies have big budgets - they can easily hire the best engineers and artists of their own. What they are really afraid of is losing their market monopoly.

Do game asserts fall under GPL? If not you can still sell them and add game engine as free bonus.
AFAIK, GPLed game assets are treated as GPLed DLL files - i.e. the code you load at runtime. Similarly to how you can use GPL-licensed plugin with Photoshop. So they can be good as a value added content, but not something you can really build upon. I.e. you can't take a GPL licensed sci-fi novel and write a sequel to it, because you will still have to publish the sequel under GPL, including the LaTeX source code, and then everyone could print it or get for free - i.e. you have no copyright. That is why people introduced CC-BY license instead, so producers of derivative work still retain their part of copyright.

I think there need to be also a standard profit sharing version of CC-BY, which mandates sharing the parts of profits with the author, if it brought any. That can be some percent or a fixed one-time payment.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on July 20, 2019, 06:34:48 pm
I mean something else with game assets, they are NOT GPL, and my question was is legal to bundle them together with GPL exe.
You own all Copy Rights to it but none to your code. Image selling Piratez as standalone game as it still need OXCE.


Big companies have big budgets - they can easily hire the best engineers and artists of their own. What they are really afraid of is losing their market monopoly.
I mean case as MS long time ago pulled off: https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguish
They use it to expand they monopoly by consuming smaller markets.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on July 21, 2019, 02:54:43 pm
I mean something else with game assets, they are NOT GPL, and my question was is legal to bundle them together with GPL exe.
You own all Copy Rights to it but none to your code. Image selling Piratez as standalone game as it still need OXCE.

I mean case as MS long time ago pulled off: https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguish
They use it to expand they monopoly by consuming smaller markets.
You can bundle GPL'ed data with any other licensed data. For example, Apple OSX includes BSD, GPL and proprietary code. Although they have replaced the GCC with a BSD license clang compiler. Dunno what was the reason for that, but it broke some of the more tricky code.

Regarding Piratez, it runs on the OXC engine, which is, AFAIK, a result of reverse engineering the proprietary code, in addition it requires assets from the original game. You can probably replace assets with something from OpenGameArt, but the engine code is still very murky legally, because it has the same abstract structure as the original Gollop's code, even if variable names are different.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on July 26, 2019, 12:44:12 pm
Regarding Piratez, it runs on the OXC engine, which is, AFAIK, a result of reverse engineering the proprietary code, in addition it requires assets from the original game. You can probably replace assets with something from OpenGameArt, but the engine code is still very murky legally, because it has the same abstract structure as the original Gollop's code, even if variable names are different.
Only some parts are reverse engineered. Most code was created using https://en.wikipedia.org/wiki/Clean_room_design
And OXCE is even more different when I alter some behaviors to be more generic.

But this was not my point, get same situation but OXC is pure and independent GPL program not connected to original game.
You profit from selling data not exes.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on July 28, 2019, 09:16:27 pm
Only some parts are reverse engineered. Most code was created using https://en.wikipedia.org/wiki/Clean_room_design
And OXCE is even more different when I alter some behaviors to be more generic.

But this was not my point, get same situation but OXC is pure and independent GPL program not connected to original game.
You profit from selling data not exes.
Given that it replicates original very closely, that itself can be problematic. Many Tetris clones were taken down, due to them having exactly the same game design, down to the playfield size: https://forum.unity.com/threads/how-likely-is-a-tetris-like-game-to-be-taken-down-on-the-play-store.398902/

So I guess game mechanics itself could be a subject to copyright, not patents. But classic XCOM is not as popular as Tetris, in fact it is very niche, so I doubt anyone would go after it, after all there are several very similar clones being sold at Steam.

Anyway, I think making 1-to-1 clone is boring and not worth the effort, that is why I re-redesigned everything, like using no-RNG combat. And Gollop himself with his latest games moved a bit into different direction, instead of repeating his previous games.
Title: Re: XCOM Inspired Fantasy Game
Post by: tkzv on August 07, 2019, 03:15:21 am
What is LOR? Linux.Org.Ru?
Were you "anonimous" (note the "i", not "y")? Did you register in 1999 or get the account later? (People are making bets...) Were you "logicoop1"? (If yes, punched tape was invented in 1725, 2 centuries before Zuse.)

Dude, you are insane in the best way possible.
Probably more true than you think. As far as I know, he's been working on this project since mid-2000s to test his unorthodox ideas about programming and language design. He's kinda Terrence Andrew Davis of game design, but atheist and self-taught.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on September 09, 2019, 09:18:35 pm
Now I'm trying to decide on a story. There are three stereotypical variations:
Background Story 1:
The Great King [KingName] the [First, Second, Third] of [Dynasty Name] has hired you and several other warlords to protect the kingdom from increasing monster attacks and investigate their cause.

Background Story 2:
The ruthless tyran rules this land, taxing poor people to no end. Can you put an end to his rule? Beware of king's still loyal generals.

Background Story 3:
The king of this land has died, leaving no heirs. Now it is up to local warlords to fight for the throne. You're one of these warlords.

Well, as Carmack said story is very secondary to the game, and all three variations are very similar, but story could have various cosmetic nuances affecting gameplay and driving it forward (i.e. what competing forces player will have and how he/she will compete with them). Obviously the best solution would be picking one randomly at the start of the game, or letting player to pick the setting. Yet that will require some time to polish and playtest, so the best idea for now is to implement some single story. Then adding some other possibilities.

Were you "anonimous" (note the "i", not "y")? Did you register in 1999 or get the account later? (People are making bets...) Were you "logicoop1"? (If yes, punched tape was invented in 1725, 2 centuries before Zuse.)
 Probably more true than you think. As far as I know, he's been working on this project since mid-2000s to test his unorthodox ideas about programming and language design. He's kinda Terrence Andrew Davis of game design, but atheist and self-taught.
That is untrue.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on September 11, 2019, 02:04:49 am
Added some barebone supply/demand economics for shop items. Guess in future I could also add crafting and/or trading by allowing city shops to have different prices. That way player could raise some funds without any battles or dungeon exploration, by just traveling between cities. Although that somewhat duplicates the delivery quests. And it is not obvious how bandits would hunt player inside such system. Maybe competing merchants will hire assassins?. Still I'm not really creating anything truly new, because long ago there was that Merchant Prince game by Holistic Design, who also did another great game - Emperor of the Fading Sons.

Countless other additions, among them are multithreading, SSE optimized RLE blitting and dynamically animated lightnings for main menu, which required implementing software 3d rendering, because you can't deform polygons without taking Z-dimension into account for texture space, otherwise without Z it will result into what is known as affine texture mapping. So even such simple lightning effects require full blown polygonal renderer.
(https://i.imgur.com/XbGdcrX.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on September 12, 2019, 04:49:17 pm
The problem with adding more features is that each feature usually relates to other feature, creating combinatorial explosion. For example, if you add rain, then it would look stupid if fire would continue burning under the rain, so you must add the feature of water extinguishing flame. Same way, when you add barebones gas dynamics, like oxygen, the same flame must also burn oxygen down and stop if there is no oxygen. Now that somewhat restricts level design, like you can't have a closed castle dungeon with torches, because you can't have flames in vacuum, and must provide some ventilation, which I've solved for now by allowing doors and windows to pass air.

Another feature is world/travel map, which obviously should allow player to pre-equip his units before combat. Original XCOM had no world map equip feature, forcing player to reequip his units during each battle, while say Realms of Arkania, required doing everything on the world map. In my case, I use scripting to apply item effects on the unit, and site-level script isn't available on the world map. Solution: add camping mode, which would present player with makeshift map with a campfire, so the player could pre-equip his units or say cast healing spells.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on September 20, 2019, 01:23:48 pm
While XCOM/Spelunky style maps generated from premade parts work fine in many cases (especially for modern city streets), they are a bit repetitive, with obvious seams, severely limited in geometry and require creating many parts. Now I want local maps to closely correspond to the world map, which requires more fine grained resolution, that can be used as an input for fractal generator.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on September 20, 2019, 11:42:58 pm
Ok. Initial fractal heightmap is working. As usual, it is the easiest part, much harder would be planting trees, objects and caves. Although say roads and rivers are fractals too, but they need special handling. In serious applications they are generated from statistical data, but I'm using ad-hoc constraints, parts of which should be passed from world map.

(https://i.imgur.com/C3FW3ty.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on September 22, 2019, 01:53:29 am
For now rivers are implemented as the good old stencil layer applied to the fractal. It is not ideal, because I want some nice waterfalls and inflows going from out of hills. But that can be done by an opportunistic algorithm, sampling search space randomly for potential nice features.

IIRC, people reverse engineered different sim cities. I should look how they did that. But I already guess they used some hacks that worked for them, but will unlikely work for me.

(https://i.imgur.com/jJbJyw0.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: ohartenstein23 on September 22, 2019, 05:00:17 am
What about a gradient-descent model combined with a small amount of umbrella sampling? If the map has a large elevation feature like a mountain, have a weighted decision to source water there. Otherwise, build a very rough estimate of which edge of the map and where on that edge is the most elevated, then use a coarsely-sampled version of your map to determine where the flow goes, allowing for some "erosion" to occur so it doesn't just get stuck at a local minimum. Maybe let it run this a small number of times and pick an averaged or most likely route for the water from that.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on September 23, 2019, 01:01:56 am
Here is actual OpenSimCity project: https://github.com/nicholas-ochoa/OpenSC2K

It doesn't have any map generator (loads pre-made maps) and doesn't appear to be a serious reverse engineering project, as it is in JS and rewrites everything from scratch. So it can't be used as a source on anything and I'm too lazy to reverse the generator myself :( guess for now it will remain a mystery, how SimCity did it. Still SimCity generators don't appear to be using a simple perlin noise or voronoi, because rivers actually look like rivers, plus a few ponds, because real cities are built along rivers and have bridges, so a river is a must. And it also has island maps (obviously a special case)
https://www.youtube.com/watch?v=eUaCyUkC_jM


What about a gradient-descent model combined with a small amount of umbrella sampling? If the map has a large elevation feature like a mountain, have a weighted decision to source water there. Otherwise, build a very rough estimate of which edge of the map and where on that edge is the most elevated, then use a coarsely-sampled version of your map to determine where the flow goes, allowing for some "erosion" to occur so it doesn't just get stuck at a local minimum. Maybe let it run this a small number of times and pick an averaged or most likely route for the water from that.
That is what I already do for world map. In a non-toy 3d apps it is also used for erosion (they pick random points and then descend from them, subtracting from heightmap), but it takes a few seconds even on modern GPUs. But in my case, I build from the data passed from world map. I.e. if player explores a site with a river at corner, there should be a river there. If it is near ocean, there should be an ocean. I also pass world map seed to the local site generator. Otherwise players will complain that they entered camping site exploration on the edge of forest, but there is no forest to be seen, so world map serves no purpose.

I'm planning to introduce some poaching into game, so there will be some incentive to explore even non-quest sites, therefore I need the generation be tangible and well integrate with world map. There is also a system, which favors using a few leader units, but still allows having grander battles. Similar to Lords of Magic followers vs mercenaries system.

Anyway, one problem, is that fractal generation requires power of 2 map dimension (i.e. 32,64,128,256), because it subdivides the fractal by 2 each step, so in the end it produces say 64x64 map, while I need 50x50, because such chunks are more user friendly. Say I have 1000x500 pixels world map, which are subdivided into 10x10 chunks, which then provide enough features for the site 50x50 generator. I could either downscale the map, getting some nasty results or cut out the require 50x50 chunk out of 64x64 map, risking to miss some features from the world map, which can be avoided by passing 13x13 world map samples to generator, instead of 10x10.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on September 23, 2019, 10:53:17 pm
For now roads will automatically dig caves through hills and place bridges over rivers. That is stupid and it produces a lot of tunnels, but should be fine for playtesting. I will replace it with something more fun in future.
(https://i.imgur.com/mnH2EOU.png)
(https://i.imgur.com/54RdSW1.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on September 27, 2019, 03:49:12 pm
Randomly generating rock deposits appears to be a non-trivial problem. For now I just use a hack:
(https://i.imgur.com/1h8mtQW.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: N7Kopper on September 27, 2019, 05:10:19 pm
Dude, you are insane in the best way possible.

If only you considered dice rolls... ;)

I'm reminded of Zone of the Enders: Fist of Mars actually. A little-known GBA tactical RPG (no grinding, similar to most Fire Emblems) that was an interquel to the fast-paced mecha fighting ZoE 1 and 2. To bridge the gap between it and the other two games, it actually had a feature that let you remove all the RNG from the game in favour of skill-based hits, crits, and dodges. The stats still mattered, though - the difficulty of landing or avoiding hits was based on what the hit chance would have been if you were playing in Luck Mode. There was even a feature that let you increase your damage output by decreasing your accuracy and evasion, letting you blow through overlevelled enemies if you mastered the mechanics of hits and dodges.

If it were up to me, I would personally mix this sort of design with Paper Mario's Action Command system, letting you actively contest the AI/other player to try to land hits and crits, with the advantage being given based on what the odds would have been if it was just random. RNG is great for immersing yourself in the feel of playing as a commander or tactician, but if you want the player to feel as if s/he's controlling an entire party of units, not just ordering them about, less RNG is better for that.

Background Story 1:
The Great King [KingName] the [First, Second, Third] of [Dynasty Name] has hired you and several other warlords to protect the kingdom from increasing monster attacks and investigate their cause.

Background Story 2:
The ruthless tyrant rules this land, taxing poor people to no end. Can you put an end to his rule? Beware of king's still loyal generals.

Background Story 3:
The king of this land has died, leaving no heirs. Now it is up to local warlords to fight for the throne. You're one of these warlords.
If you go with 2 or something similar, I vote for an optional evil campaign. The gaming world is starved for good evil campaigns.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 01, 2019, 12:19:46 am
I'm reminded of Zone of the Enders: Fist of Mars actually. A little-known GBA tactical RPG (no grinding, similar to most Fire Emblems) that was an interquel to the fast-paced mecha fighting ZoE 1 and 2.
Looks cool. Thanks for hinting at. Also, GBA had actual XCOM-like game from Gollop, called Rebelstar. It was heavily stripped down to make accessible for younger audience and play nicely with GBA hardware, but still has destructible terrain.


If you go with 2 or something similar, I vote for an optional evil campaign. The gaming world is starved for good evil campaigns.
I decided to mix it all. The king has died and there is now a succession war, between different sides, with an impostor capturing the throne and taxing population. That scenario allows for the most freedom and any number of sides. I've also abandoned the idea of linking player character to be a wizard, so now player can promote any unit into a leader and have any number of leaders.

The development took some really wild turns. Initially the game was just a Chess clone with some modifications, like Sokoban block moving, but then I found that small maps are very limited, so I abandoned the Chess like mechanics, adding HP, but retaining the no RNG paradigm. Then I found that my engine is a bit inflexible, it would be had to impossible to implement proper cutscenes and more complex animations, so I turned the engine into realtime RTS one, with turn-based limitations just added on top. For a short time I played with idea of making a dwarf fortress/dungeon keeper like game, adding room building and cave excavation (the imp character was originally used for that), even some initial resource gathering, but I found it boring and overused, so I kept it turn-based, but retained the terraforming part, because I believe it is cool to chop down trees and make a raft to cross the river, if player has no flight or water walking spell, or any magician at all, or to dig a tunnel under a prison to free prisoners. Anyway, now I have clear idea how it all should combine into a solid game.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 02, 2019, 01:10:39 am
Ok. Time to place some quest locations inside these auto-generated maps. Guess I will need some special generator for castles and cities, but for now pre-made XCOM style parts should be good enough.

(https://i.imgur.com/lpiH3RX.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 04, 2019, 02:06:13 am
Another important part of map generation is the player's entry point and the initial unit placement. Should it be connect by road to all important areas or maybe letting player building his own road? Guess I should indicate on the world map, where there are roads and where there is wilderness, and the player will be required some magic, construction workers, flyers or swimmers to reach his/her destination.

One of the inspiration for my game is that old DOS Spellcraft game ( https://www.mobygames.com/game/dos/spellcraft-aspects-of-valor ), which indeed required player to be prepared to traverse the map. In a nutshell, Spellcraft is the Gollop's Lords of Chaos, but in real time, very similar to Magic & Mayhem. Guess they actually cloned it.

In XCOM it was assumed that player isn't obliged to have flying suits, but I clearly remember that during my first ever XCOM terror mission I destroyed a ladder in that island house, and there was no way to get onto the upper floor, where the last alien was hiding. So yeah, ability to build ladders could be the difference between winning or losing :D

(https://i.imgur.com/3C0wqsD.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Hashirama015 on October 04, 2019, 06:39:03 am
Looks neat. Anyways I have  a question, will it be something like mount and blade where you travel the world  map or will the geoscape be totally removed?
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 06, 2019, 02:12:23 am
Looks neat. Anyways I have  a question, will it be something like mount and blade where you travel the world  map or will the geoscape be totally removed?
There is a random world map generator. But no globe - just a 2d maps with several islands, which player can visit using ship. The world map movement is also turn-based, compared to XCOM. As usual, player explores world map, completes quests, which are randomly generated, as well as quest sites. There are also several cities, including port cities, where player can rent a ship.

World map is divide into sites, which, while randomly generated, remain constant during single playthrough. I.e. if there is a multiplayer match, defending player could pre-explore the map, having that advantage against attacker.

Between cities there is some trade, and player can rob caravans. That is exactly the part I'm currently working on in site generator - ambushes. For now it is just an encircled ambush. Victory condition is simple: defeat all enemy leaders. To retreat, defending player will have to move all his/her leaders towards the edge of the map. Given that the game centers around magic, there is an alternative victory condition for most maps: activate some percent of magic nodes, required to cast the Spell of Mastery. Obviously that needs player to have some wizard alive. But compared to enemy leaders, nodes are revealed on minimap. So if enemy leaders cast invisibility or go into defense, another player could just activate the nodes, as part of endgame. That should eliminate infamous "find that last alien" problem of XCOM.

(https://i.imgur.com/wd5rTrv.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 07, 2019, 09:38:41 pm
Recently one guy (the creator of Cube World) conceived similar idea to mine about replacing experience by auto-generated relics:
https://www.youtube.com/watch?v=wAm3sFRqJLI

Wow! I thought my idea is unique :( well, at least his game is real-time and more minecrafteish (read legend of Zelda based). Also, the fans who funded his kickstarter got really angry that he totally redesigned everything since the alpha, so there is a huge drama. Good thing I have no fans, funders or any responsibilities :D

And Cube World also has circular rivers, which flow upwards, due to how perlin noise works: https://youtu.be/Oko9vr5WpS4?t=908

Circular rivers is the symbol of our time!

(https://i.imgur.com/ZLg92Bb.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 08, 2019, 11:41:19 pm
With a few more lines of code, we can now have parts with arbitrary outlines, compared to square 10x10 cells XCOM map segments. Obviously it employs the same fractal generator code used to generate the world map :D

Here is a party placement around campfire in the wilderness:

(https://i.imgur.com/TWnpK3h.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 09, 2019, 06:25:49 pm
Enemy Infestation - the closest one gets to a real-time XCOM. While it looks like a Commandos clone with aliens, it is not. Compared to XCOM, each unit in EI has explicit specialization, there are numerous interactive map objects (XCOM had only doors and lifts). The weapons are almost all unorthodox: fire extinguisher, shrinking ray, zapper gun, etc... but the aliens design is one of the most uninspiring ever, and that is in a game about aliens.

Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 11, 2019, 01:41:02 pm
Didn't know that but all Diablo games use the same map generation algorithm as XCOM and Spelunky, so the layout is a bit predictable and exploited by speedrunners:
https://www.boristhebrave.com/2019/07/14/dungeon-generation-in-diablo-1/
https://www.diablowiki.net/Randomization#Map_Generation_and_Size
https://www.youtube.com/watch?v=eZ7nqNgzjTI
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 14, 2019, 09:16:14 pm
New games already began using AI approaches to generate contents. Most popular of these appears to be wavefunction collapse algorithm:
https://robertheaton.com/2018/12/17/wavefunction-collapse-algorithm/

It is very similar to markov chains and the limitations of markov chains. Dungeons generated with it are not much better than texts generated by markov chain. But it could be useful for generate inherently random patterns, like animal fur color texture. Although biologists would likely correct me that animal fur color is not truly random, but a result of some complex gene expression in action, but then again, nothing is truly random.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 18, 2019, 02:34:47 am
Came with a simple dungeon generation algorithm. It is relatively flexible and can fill in any stencil constrained area. Should be good enough for now
(https://i.imgur.com/1d6VijZ.png)(https://i.imgur.com/jLRx1hs.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 18, 2019, 08:47:14 pm
Currently my code generates dungeons of hierarchical topology. Such dungeons are a bit boring: enemy can't  surprise you by approaching from behind. Basically they would feel too safe. Regarding loops in dungeons: naturally human made buildings usually have hierarchical topology, so we actually need a good excuse to introduce loops: say have both stairs and a lift to reach higher floor: that  way if player secured the 1st floor, but have chosen stairs to reach 2nd floor, aliens could use lift to descend to the first floor left unsecured.

Badly placed loops stand out in the architecture. Diablo had a lot of them, but they usually created passable loops, appearing more like alternative way to reach the room. Then again, Diablo's dungeon is a cursed ruined cathedral. But, for example, Chocobo Dungeon generator produces some really nasty out of place loops, which would likely annoy player. Here a path splits before both forks entering the same room:

(https://i.imgur.com/OmuGfv6.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 19, 2019, 08:55:47 pm
Speaking of lost opportunities:
http://journal.stuffwithstuff.com/2014/12/21/rooms-and-mazes/

That guy got pretty unorthodox idea of generating dungeons, but then he botched it by pruning out the maze part, and levels lost the iconic look :( Better idea would be creating some gameplay around that maze-room concept, where say player sees entire maze and is given limited time to pick the passage to next room, or when picking passage leads to blocking it to the competing player, while botch players must navigate to goal (maybe to each other start loations). Each maze passage could have some specific bonus. But yeah, that would be completely different real-time action game, not tactics or roguelike, but I'm sure one can turn it into an instant smartphone hit  :'(

(https://i.imgur.com/ZA6v0io.png)
(https://i.imgur.com/bcnlCi6.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 21, 2019, 12:41:25 am
It appears Daggerfall dungeons are not completely random, but made out of big pre-generated blocks (i.e. like in XCOM)
http://www.gamesas.com/just-how-random-daggerfall-t27043.html
Quote
The dungeons are built of "blocks", with any dungeon having about 3, with as much as 5 or 6 and as little as just 1. The blocks are HUGE, though, so if you enter a block you have done a lot before, then you have a pretty big area that will feel familiar. That said, the blocks are big, twisted, and crazy, so just because you've been to that block before doesn't mean you're going to know the route by heart. It takes quite a while before the same block gets old--besides, the monsters and loot always change. Learning a block only makes it easier to navigate, which can be a good thing.

Some blocks are very recognizable; for instance, the whole of Privateer's Hold shows up sometimes, Others, such as those with very large central chambers are easier to learn. But there are quite a few blocks that consist of nothing but maze, and I'm convinced you can't learn those. Ever.
https://en.uesp.net/wiki/Daggerfall:Dungeons
Quote
a dungeon consists of up to 32 blocks, each of which may be connected to any (or all) of the four cardinally adjacent blocks since there are two connecting passages in each of the four cardinal directions, and thusly there are eight paths leading out of each block. While most dungeons may appear to be a random conglomerate of different modules, they were hard-coded in the release media and thus are never-changing. These were most likely generated via a pseudo-random program of some type, but Main Quest dungeons are an exception, because these were all hand-crafted.

While Main Quest dungeons may be the biggest dungeons in the game, it has been commented by some that even the least of the random dungeons are logically too large for the majority of quests. It has also been voiced that because the number of blocks in the source material is limited, most dungeons lack diversity/variance and hence all dungeons tend to look like each other.

Dungeons are built from blocks by assembling them together side-by-side on a 2D grid. Of these blocks there are two types of blocks: internal and border.

Internal blocks
    These provide the meat of the dungeon where most rooms and corridors are placed. Every internal dungeon block has two door openings in each one of its fours sides, one above the other. Each door opening is used to link to a nearby internal block or to an external block.
Border blocks
    These are used when it is necessary to close the side of an internal block. These are primarily composed of a single corridor which reflexively leads back to the same block of their origin. These are most often used to seal a dungeon's peripheral blocks, but could be used to create isolated areas within a dungeon. Border blocks do not contain any quest locations.

Cities are generated using exactly the same grid algorithm as XCOM uses.

So Daggerfall's dungeon generator doesn't handle Z dimension at all.

(https://i.imgur.com/KpIQYUu.jpg)
(https://i.imgur.com/UqIbwxE.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on October 21, 2019, 02:21:15 am
I always enjoy reading your "blog" here. It's pretty interesting!
Title: Re: XCOM Inspired Fantasy Game
Post by: Precentor Apollyon on October 21, 2019, 05:39:34 pm
It appears Daggerfall dungeons are not completely random, but made out of big pre-generated blocks (i.e. like in XCOM)
http://www.gamesas.com/just-how-random-daggerfall-t27043.htmlhttps://en.uesp.net/wiki/Daggerfall:Dungeons
Cities are generated using exactly the same grid algorithm as XCOM uses.

So Daggerfall's dungeon generator doesn't handle Z dimension at all.

(https://i.imgur.com/KpIQYUu.jpg)
(https://i.imgur.com/UqIbwxE.png)

So you do daggarfall modding eh? Nice! I do Skyrim modding before I started this ufo project. What I did, I add Caravan masters and Merc Captains in Tavern where you can escort Caravan across Skyrim.  Also I have 5000+ spawn points with a script that generate random monsters all over the map. So, every trip from one town to another with a Caravan.. is a hellish fun experience..
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 22, 2019, 02:21:36 am
So you do daggarfall modding eh? Nice! I do Skyrim modding before I started this ufo project. What I did, I add Caravan masters and Merc Captains in Tavern where you can escort Caravan across Skyrim.  Also I have 5000+ spawn points with a script that generate random monsters all over the map. So, every trip from one town to another with a Caravan.. is a hellish fun experience..
Nope. I'm not a modder guy. Just researching prior art, hoping to get few nifty ideas. But in most cases people use what works for them. I.e. in Daggefall they had level actual human designers, so it was a good idea to create many big human-crafted parts, than creating more sophisticated generator, which is really hard to do and would be much slower than loading parts from disk. But yeah, creating a full featured random generator for Skyrim/Morrowind/Oblivion would be possible, although a bit on the harder side. Then again, people managed to add even multiplayer to these games.


Anyway, I've integrated the initial generator into the game. The approach I use would allow unlimited number of Z-levels on the same map - I can layer them as much as I want. It could also be used to generate cities and villages, if I specify more constraints, like city streets and building coming out onto them. That should be good enough for a simple indie game, but proper world generator for an AAA game will need an AI-based algorithm working from actual statistical data for real world cities, forest distribution and vegetation.

(https://i.imgur.com/Bdvj7Bi.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 23, 2019, 02:30:50 am
Original XCOM was very efficient in its use of map cells, where each map element contains walls and ceiling. Dwarf Fortress uses similar format, where map cell has floor attached. Early on I decided to go full voxel approach, but in addition making character height 2 cells, so sprites won't look squashed/superdeformed and get somewhat realistic look, so instead of 1 cell, have to use 3. Yet some characters could have 1-cell height and fit inside 1-height passages, while other characters have height of 3 and need some area. Yet there is 1/2 cell height support for stuff like low-angle sloped terrain, which I added, because 45 degree roof looks stupid on larger buildings. That greatly complicates everything, especially when flying creatures get involved. Map generation is no exception, and I still get few occluding tiles improperly cut, due to difference in ceiling, used for heuristics.

Guess my current approach to 3d cursor movement appear to be wrong and people fail to grasp it. Better idea would be to make cursor move akin to ingame creature, so it wont cut through terrain, but jump on top of it. That would complicate cutting tunnels or casting spells inside solid terrain, but that feature wont be used that much, and it could be implemented as special mode. The other problem is quickly getting cursor back inside building, when it is not anchored to specific floor level.

(https://i.imgur.com/JUkOGcY.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 24, 2019, 03:18:40 am
Improved the 3d cursor movement, which appeared to be the most confusing part about my game to other people (and even myself):

Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on October 27, 2019, 02:28:04 am
Another seemingly easy subject is battle resolution. Well, it is easy in simpler games, like Final Fantasy, but not in XCOM-style games, where you can leave site, without recovering all characters and/or items, or recovering part of them. So there can be no precise victory condition, where you need to just recover that specific alien technology or a specimen, and then retreat. I decided to break player forces into mercenaries and leaders, so player can retreat at any time when his/her all leaders are at the map's edge, or when he defeated all enemy leaders, or when he/she has cast the Spell of Mastery for that specific site. If some of the leaders are not at the edge, they will be lost, but all mercenary units will retreat by themselves. There is a catch to that: player must have at least one leader, otherwise it is an instant defeat (yeah, leaders are akin to lives in arcade games), but leaders require constant upkeep, while mercenaries require larger payment for each battle. Trying to cast the spell of mastery instantly reveals all player leaders to the enemy, and frees AI to use all his many units at once against the player.

Obviously not all sites allow casting the Spell of Mastery, and not all dungeons have leaders. In some cases player just have to recover the quest item or plunder some gold. And if player say starts with a thief, it can gain some quick money by getting inside dungeons, around the guards to reach treasury room, or maybe rescuing some prisoners taken by orcs. I.e. that exact mechanics from the preview demo.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on November 08, 2019, 03:20:16 am
The idea with moving all player units to the exit squares/map-border was flawed. It is just boring and not really that tactical. So the new approach is allowing player to leave with all units or specific units, which were out of enemy sight for a few turns and have full movement points. For now the idea is that most sites are heavily overpowered and player has no resources to deal with all enemies, so his objective is quickly complete the objective and leave the site (i.e. retrieve the spell scroll wit the the new spell). Although quest items should be first given to the leader, before leaving the site. That would force the player to somehow get out of the heavily patrolled dungeon or risk losing his leaders.

Currently I don't have unconsciousness status, so there is no problem with resolving such units.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on November 09, 2019, 03:49:22 am
One thing I disliked about the original XCOM is its basebuilding centered world map. There is no sense of adventure and the number of possible scenarios is rather limited. I.e. you can't re-enact say Lords of the Rings scenario in XCOM engine. Player just boringly waits for the next alien event to happen, without doing any exploring or guiding the game somehow. XCOM Apocalypse tried to fix it (Phoenix Point addresses it even further), allowing player to visit sites on demand and say raid internal city enemies, like Cult of Sirius. That works with XCOM setting, but not enough for a fantasy like game. Good example of turn based fantasy game would be heroes of might & magic series, which has fog of war for global map and strucutures, like lookout tower and eye of magi gradually uncovering it, yet allowing player to decide where to go next, depending on his/her strategy. XCOM unfortunately missing that, and its research tree is a rather linear - you just go for laser rifles, ignoring everything else. But yeah, for XCOM world map was rather bolted on. I.e. no need to secure some unobtanium mine or raiding opposing camp psy-labs for that mind control tech.
Title: Re: XCOM Inspired Fantasy Game
Post by: Precentor Apollyon on November 10, 2019, 06:58:59 am
I have done some experimentation of a fantasy/ Historical type sea battle.

This is a ship from Nord's Chronicle mod. Unused. I have modify it. Now it is a sea sailing ship. In a fantasy mod or historical mod, imagine having two ship side by side and you fight a deck to deck sea battle using swords and shields.

Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on November 11, 2019, 02:48:10 am
I have done some experimentation of a fantasy/ Historical type sea battle.

This is a ship from Nord's Chronicle mod. Unused. I have modify it. Now it is a sea sailing ship. In a fantasy mod or historical mod, imagine having two ship side by side and you fight a deck to deck sea battle using swords and shields.
Wont be really that exciting, because the map is a bit too small. Also, with terraforming spell, ship made out of would could get destroyed. But yeah, one can probably have enchanted ships. For me there would also be problem of implementing retreating, because usual rules of moving away from enemy, possibly sacrificing some units, wont work. But for pirate style campaigns ships battles are indeed a must. And you can make whole XCOM style game around pirates. For a fantasy game one can think of flying ships, flying island, flying castles or say flying turtle, like in Discworld. But flying island map would require bottomless pits below, so units flown away by say tornado or dragon wings would fall down properly. I.e. all these are advanced features requiring a lot of coding and playtesting, turning already large project into a non-ending one.

(https://i.imgur.com/UDwi1Fr.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Precentor Apollyon on November 11, 2019, 10:07:45 am
Wont be really that exciting, because the map is a bit too small. Also, with terraforming spell, ship made out of would could get destroyed. But yeah, one can probably have enchanted ships. For me there would also be problem of implementing retreating, because usual rules of moving away from enemy, possibly sacrificing some units, wont work. But for pirate style campaigns ships battles are indeed a must. And you can make whole XCOM style game around pirates. For a fantasy game one can think of flying ships, flying island, flying castles or say flying turtle, like in Discworld. But flying island map would require bottomless pits below, so units flown away by say tornado or dragon wings would fall down properly. I.e. all these are advanced features requiring a lot of coding and playtesting, turning already large project into a non-ending one.

(https://i.imgur.com/UDwi1Fr.jpg)

The map size can be modified in Aliendeployment and also with mapscript. I have yet to find a way to make the enemy ship or ufo to lash next to the players ship. Perhaps a future modder want to take on that challenge with consultation with ohartenstien23. I am just throwing ideas around. Ship made out of wood can get easily destroyed. This is the whole point of the game in Battlescape. Trying to kill the opponent before your ship is destroyed. You have to board and kill your opponents, capture their ship and gold. Then, sell off survivors as slaves or recruit as your crew. You have turrets as cannons with sailor firing out from ports and holes on the ship. The cannons can blast holes and kill your sailors. This is what's historical 17th century pirate vs galleon is like. You don't have to play as a pirate, you can be a privateer, a govt establishing order in the sea.

My interest in this is purely historical, not fantasy. If a mod like this is only historical, the only coding needed I am foreseeing is having craft bounded to sea terrain texture. However, if you are using TFTD as a base to mod off, no extra coding needed... maybe because ufo can go on land. Anyway, your base instead of underground it will be towns. With mapscript and verticallevels, that can be done easily. Sea battles would have no interception like Aircraft vs ufo, it is straight into battlescape battle. You can use missionscript and alienmissions to generate towns that's alienbase. Using region coordinates to make sure they are spawn at the right place in the globe, like port royal and these towns can send ships to patrol the seven seas and also attack your base.

If I am not doing my current mod now, I might be interested in giving this a head start. Unfortunately, one can only drink so much water..
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on November 13, 2019, 03:50:33 am
Sea battles would have no interception like Aircraft vs ufo, it is straight into battlescape battle.
Why not use some interception mechanics? It fits nice with pirate theme. Traditionally pirates damaged sail of the vessel they attacked, and then boarded it. There was special ammunition to destroy sails: https://en.wikipedia.org/wiki/Chain_shot

So I imagine you could have two kinds of cannons: one sinking ships, and other taking them down. That maps 1-to-1 into the original XCOM mechanics.

But yeah, you will need swords and muskets instead of laser rifles.
Title: Re: XCOM Inspired Fantasy Game
Post by: Precentor Apollyon on November 13, 2019, 06:39:38 am
Pirate ship have no radars.. and also they don't have laser, autocannons or missiles. Battlescape battles is logical in the resolution for such outcome and its fun.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on November 21, 2019, 05:22:53 pm
Stumbled upon a Japanese clone of Gollop's Magic & Mayhem, but then again, one can call Gollop's game a clone of Spellcraft :D

Title: Re: XCOM Inspired Fantasy Game
Post by: Precentor Apollyon on November 21, 2019, 05:33:07 pm
If you want to have a look of the ship from the screenshot I have posted. Just download my Hybrid mod from the Mod release page. In the New Battle, I have the boat there for anyone whom is interested.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on November 26, 2019, 03:57:25 am
Finally found some time to design proper distance combat. Before that ranged units had all the same mechanics as melee, which is a bit unrealistic. Ranged units also had fairly low range of only a few cells, like in Starcraft. Guess I'm one of a few persons who really hates Starcraft/Age of Empires ranged units mechanics, which don't really take into account distance, visibility or height, and Starcraft players don't really feel threatened by ranged attackers. I also believe Warcraft/Starcraft is one of the worst RTS games, learning nothing from competitors, like Warhammer, which it originally cloned.

In tabletop Warhammer ranged units were able to shot over whole battlefield if not impeded by walls, and same was the case with its computer implementations, like Shadow of the Horned Rats, predating Starcraft, but feeling much more massive, especially with proper 3d engine and huge armies. But Blizzard were a bit conservative and kept cloning to death the same Dune 2 concept.

Anyway, I had to devise a way to calculate range penalties without using random numbers. I used the already existing attack stat (which basically says how many move points that unit can put into attack per turn or how accurate it is), and used its max value as a cutoff, after which more attack points spent wont would result in less defense points penetrated. Same way, if enemy gets too close, ranged unit will lose some of its attack points.

(https://i.imgur.com/PldIANg.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on November 26, 2019, 09:41:53 pm
Finally found some time to design proper distance combat. Before that ranged units had all the same mechanics as melee, which is a bit unrealistic. Ranged units also had fairly low range of only a few cells, like in Starcraft. Guess I'm one of a few persons who really hates Starcraft/Age of Empires ranged units mechanics, which don't really take into account distance, visibility or height, and Starcraft players don't really feel threatened by ranged attackers. I also believe Warcraft/Starcraft is one of the worst RTS games, learning nothing from competitors, like Warhammer, which it originally cloned.

In tabletop Warhammer ranged units were able to shot over whole battlefield if not impeded by walls, and same was the case with its computer implementations, like Shadow of the Horned Rats, predating Starcraft, but feeling much more massive, especially with proper 3d engine and huge armies. But Blizzard were a bit conservative and kept cloning to death the same Dune 2 concept.
I think you should more think about starcraft as chess than simulation of battle field. In Supreme Commander you have weapons that can do exactly as you like, shoot for very long distances (and only if you have LoF, because bullets can hit ground).

"Starcraft players don't really feel threatened by ranged attackers"
this is probably not true, I see many times players avoiding combat because enemy have lot of range units or thanks to range they dominate game. Overall this is more question of balance. Many builds have same win chance, this mean range attacks cannot have real life advantage other wise would dominate game.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on November 26, 2019, 10:29:30 pm
In Supreme Commander you have weapons that can do exactly as you like, shoot for very long distances (and only if you have LoF, because bullets can hit ground).
Unfortunately I've never played Total Annihilation/Supreme Commander, but I heard these are really good RTS games, compared to most of the Dune 2 clones. I was always puzzled why people were so prone to clone Dune 2, when countless original RTS concepts are possible. Just look at numerous Japanese RTS games!

(https://i.imgur.com/w0pMst3.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on November 27, 2019, 10:11:44 pm
I remember they ported the original Baldur's Gate for the original PlayStation, but found there is no market, and it was never released, outside of leaked version. Now they finally properly ported it for consoles. While the game is not new, the port is still interesting how they solved the human input device issues, because consoles don't have mouse and keyboard. I doubt they will ever do a proper remake, because it took them so many years to consider remaking Final Fantasy VII, which is an immensely more popular game and with more relevant story, while Baldur's Gate setting is just too dated and boring - no huge robots and flying ships.

It is strange that 1998 was the year when they discovered the pausable real-time: both Might & Magic 6 and Baldur's Gate allowed pausing timeflow, but Might & Magic 6 had much smarter design, allowing for completely turn-based combat inside real time engine. Vert similar to XCOM Apocalypse, which was released in 1997. I'm sure they  all were inspired by Gollop, because it looks too big for a coincidence. Japanese game design for example evolved completely differently from strictly turn-based gameplay: they introduced these filling with time cooldown bars, which give player some time conceive some tactics, but don't block the enemy from moving, compared to pausable realtime or purely turn-based approach. So I'm surprised Japanese haven't made multiplayer RPGs with it. And then just dropped it in favor of Baldur's Gate pausable realtime in Final Fantasy 12, which looks like a Baldur's Gate clone with bigger everything, including even the programmable AI of party members.

Also, there were many purely turn-based Japanese games, most never released outside of Japan (like Guarding Recall). They mostly use interchanging turns scheme, were each player moves all his units during given turn, but a few, like Final Fantasy Tactics, used that speed based scheduling, where each unit gains turns independently, according to its speed. I'm still unsure which is better, but I guess speed based scheduling could be better for multiplayer, so players don't have to white for too long. Other approach is Chess, where player can move only single game piece per turn (i.e. instead of units having speed, player has it).

One unusual game is Age of Wonders, a Civilization/Master of Magic clone, which had simultaneous turns - whoever clicks faster moves his units first. It was really confusing and orders of magnitude worse than say Japanese ATB system. I do consider implementing limited realtime for my game, but based on this extended Japanese approach, using cooldown bars botch for each unit and for the player (yup, copying Chess, with its limit on moves per turn). But yeah, there are countless ways one can implement time in a game, but the main rule one has to design his engine initially realtime, and then build a turn-based structure on top of it, otherwise nasty conflict can be possible, similar to multithreaded programming problems (i.e. if two units are ordered to move into the same cell, what would happen?).


Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on November 29, 2019, 10:35:15 pm
Thinking of it, there were a few original RTS games, like Creeper World and Netstorm. But Creeper World isn't really a proper RTS, because there is no other players, just player vs environment. It is closer to a puzzle game. I doubt games like Majesty or Kohan are original because they are basically just dumbed down usual RTS games. I.e. in Majesty player is limited to base building, which picks determines economy and army composition, but units fight for themselves. In Kohan there is a dumbed down base building - instead of a base, player has cities, like in Civilization, but still a neat proof that all turn-based concepts can be use in RTS games too. Say Warcraft 3 is basically a Heroes of Might & Magic game in real time, because it introduces large number of map structures and mobs guarding them. Mobs can also prevent players from attack each other in early game, if placed at bottlenecks, serving as a kind of grace period timer.

(https://i.imgur.com/VBMITgy.jpg)
(https://i.imgur.com/uTd6gQt.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on November 30, 2019, 09:33:24 pm
Ok. Since I'm continuing the development of my game, I need money to buy some itch.io assets, so I want to convert a few BTC into PayPal USD. CoinBase requires a stolen European or American ID card to connect with PayPal, and they could block transaction if they notice a forged identity. So I decided to try Russian solution, which promises to send anything anywhere. Most of Russian sites exchange only larger sums at once, but one, Magnatus, appears to exchange any sums. For now I've sent them 10USD worth of BTC, and waiting for the result. Hope they don't steal such small sums. Guess it is the one of the profits of knowing Russian language - you can find and use shady barely legal services without google translate :D

So what BTC exchanges you people use here?

Anyway, I need PayPal USD to buy these assets: https://galefirerpg.itch.io/isometric-dungeon-designer

Which I plan to used as base and retouch into pixelart, since license allows it and it is easier to work with existing art than doing research to designing your own, especially since I'm doing everything myself. But then again, working alone means you have no responsibilities before other team members :D
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on December 02, 2019, 02:56:49 am
Ok. I thought Russians defrauded me: they claimed transfer cannot be made, due to some nonsensical PayPal error (imagine a high profile American service used by millions having an error!). I expected nothing less from Russians. But surprisingly once in a life-time Russians told truth:
https://www.paypal.com/en/cgi-bin/webscr?cmd=_display-country-functionality-outside

PayPal indeed doesn't work with Ukraine, although it works even with Albania, Bahrain, Morocco and Uruguay! Only Ukraine and some worst African countries, like Niger and Nigeria, are not allowed to receive money through PayPal, which appears to have no plans to ever support them. Guess it will be ages until racism finally gets defeated and everyone will get access to clean water and PayPal for that matter.

These Russians exchanger refunded half of the money I tried to transfer, but there were other problems discovered with my Ukrainian issued USD Mastercard, which makes it totally useless for the purposes of video game development, so I cant buy these assets :( Such issues, like me being a persecuted illegal immigrant and having no access to proper banking, are actually the hardest for this project. But, well, that is how gamedev works in Ukraine for you. Otherwise I would be working on some higher profile project with actual 3d graphics :D

Anyway, I keep working on the world map, implementing various Master of Magic style parts, since the game has to be a seamless hybrid between the two classic Microprose games. For now each city has associated castle with garrison and the actual city or village part, where tax subjects live. When player A attacks player B's city, player B has a choice to either allow player A pillaging it or using the garrison for the city defense. To actually conquer the city, player A has to attack the city's castle, which can have some fortifications, requiring powerful spells or siege equipment to break through (or maybe digging though with the imp). Think the first Age of Wonders, where siege equipment was mandatory for the city siege and destroyed battering ram meant that attacker had to retreat.

(https://i.imgur.com/c54lCMW.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on December 06, 2019, 02:38:59 am
In a fantasy game instead of laser guns charges you have arrows, greek fire and spell charges. There are several ways to implement sharing them between multiple parties: one way would be a single warehouse available to all players squads, other is a per-squad warehouse. The former is easier to implement and for player to use, but I decided on a per-party storage, because it makes it too gamey, and in future it would allow for supply chains and implementing specific scenarios, where some side has limited ammunition. I.e. if you implement a LOTR inspired map, where fellowship has to split, and it would look silly if two separate entities, many miles apart, share food rations. Still it would be a nice game-design exercise to reduce original XCOM down to a table top version.

The gif is from some crazy Japanese indie game, where player controls squads, instead of separate units.

(https://media.indiedb.com/images/games/1/49/48488/HS_SquadMenu_optimized.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on December 06, 2019, 09:27:34 pm
I remember back during the reign of DOS there were several exploration games, among them is Merchant Prince and Hammer of the Gods. These games had very unique fog of war implementation. Usually in games like Civilization or Dune 2 the undiscovered territory is just covered in black, but in Merchant prince it still had some vague form, which got more incorrect the further player moved from the start location.

These games were actually based on a 1991 Japanese game, called Atlas, which was about exploring the world and making trade routes. Same way, Tycoon series also appears to be based on Japanese game from the same company Artdink, which is like Japanese Microprose, but still alive today. In particular they recently remastered their Atlas game, although making it a bit more casual. Still love the flat world resting on a turtle idea :D Other curious Artdink's  game is Lunatic Dawn, which deviates greatly from your typical linear story driven JRPGs and has more freedom than most western RPGs. Hope it will get a proper translation one day, because I'm a bit too old to start learning Japanese :D

For now I think about implementing that Merchant Prince fog of war system for world map, because just black area is a bit uninspiring. Unfortunately I use purely software rendering so doing properly such effects can be a bit tricky.

Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on December 07, 2019, 11:45:49 pm
Another way to implement time comes from roguelikes, where monsters move after player moves. It is nice, because player doesn't have to press end-turn button, but unfortunately a bit limited. Although there are a few rather complex games using such scheme. One of them is Valkyrie Profile 2 (not to be confused with Valkyrie Chronicles). While the first VP game had the usual turn scheme, the second one even allows creating several squads, which move rogue-like style. The scheme can be adapted for multiplayer, if say the more one player moves, the more other player can move. If one player moves too far, he/she gets some handicap, and or opposing player gains bonus.

Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on December 11, 2019, 08:05:33 pm
Been working on a city view prototype. Since the game is inspired by Master of Magic, it should have similar city view, where player can quickly asses what buildings are completed. Maybe even drawing available for recruiting units near inn. Since compared to heroes of might and magic, the pool is limited, there should not be a problem displaying all recruitable units. As a side note, I'm considering to introduce that reputation/fame system, similar to Lord of Magic. Lords of Magic was another of these turn-based strategies with "pause", while that game was unfinished and had very messy design, it was very innovative. I've already borrowed several features from it. Guess game design is an evolutionary process, some early games must fail, until people find how to properly implement their features.

In particular, I've mixed Lords of Magic with Hammer of the Gods, hoping to ameliorate shortcomings of both games. But the quest system is now bound to the buildings the city has. I.e. the more higher tier the building combination, the harder the quest it gives and the better is reward. For example, if dwarven stronghold is present, dwarves could give the quest to kill the dragon, raiding their gold mines. Magic guild could also require some unlocking spells.

Anyway, there are a lot of buildings already and they all got assigned a role, with some buildings excluding each other (i.e. there could be either dwarven stronghold or orc fortress, because both settle in the mountains). For now I'm considering also implementing terrain dependencies for specific buildings. I.e. hydra and snakemen would require swamp. Such decisions are nice, due to how chaos theory works - they create natural chaos on a static map, without using random number generator. But Sid Meyer has already noticed that, even if he is no mathematician.
(https://i.imgur.com/k3npRTh.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on December 12, 2019, 02:56:29 pm
While the site exploration itself uses discrete square lattice for movement, the world map movement is continuous due to several reasons:
1. Homage to the original XCOM. Although I've dropped the realtime component.
2. To emphasize scale, which player can't micromanage by steps, and have to think strategically (i.e. should I send these units over mountain?).
3. To give player a break from the grid world.
4. Continuous maps look a bit better, than tile based (i.e. square shaped shore is always annoying).
5. To allow myself testing different algorithms, so I can asses better what needs to be change in my programming language.

Anyway, there is a bit similar to XCOM fantasy game, called Ogre Battle, which also had continuous realtime world map movement. It had no aliens, but a revolution, so cities were liberated, instead of being defended. Surprisingly it was released a year prior to XCOM, but still not enough prior time for accusing XCOM of borrowing game design decisions. Although the following game of that designer Japanese (Yasumi Matsuno, who is like Japanese Julian Gollop), Tactics Ogre (the precursor to Final Fantasy Tactics), probably had some inspirations from XCOM, although its world map was far more limited and discrete.

Anyway, Ogre Battle squads moved over continuous 2d space, accounting for terrain features (compared to XCOM, which had just aircrafts completely ignoring terrain), so movement over mountains took really long amount of time - you could made a coffee and then return back just in time. Other than that, the game had unusual approach to recruiting new units. Beside humans, recruited by liberating cities, monsters like wolves and griffins were recruited by traveling over their specific habitat locations. Anyway, the squads had leaders, and killed leader meant that squad had to retreat for regrouping. World map also had time of day, and specific units, like vampires and werewolves were vulnerable during daytime. Ogre Battle also had "reputation" resource, which controlled what units player can recruit, how much income player gets, how efficient are different spells and what quests will be available.

So how it all comes to my game? Well, my world map is continuous, yet turn based, so I can't use Ogre Battle's approach of wasting player's time, annoying him/her in process. I can't also count pixels or some other infinitesimals, because that would be too hard for player to grasp and too tricky to compute, wasting a lot of AI cycles. So I decided to implement simpler method: just entering mountains will take 3/4 of the movement. Now party is marked as mountain-ready for the remaining of current turn and can move spend the remaining 1/4 of its movement for moving over the mountains. Same with river, which cost 1/2 movement to cross. It also makes programming enemy AI easier, since it can now cross any terrain, without being blocked.

Same with water, with the exception that only small parties can enter water, and player must have free ships for them to use. Obviously naval fleet costs money to upkeep. I've simplified it to that table-top level, knowing how hard it is to program ship interaction even on lattice-based maps, especially for AI (before that I made fully functioning Warcraft 2 clone with AI: https://www.youtube.com/watch?v=-k8jkeFfnl0 ). Games like Civilization, Heroes of Might & Magic and Warcraft 2 had non-working ship AI, where AI had really hard time crossing the water. And when I fixed the AI in my Warcraft 2 clone, I found that usual campaign maps became unplayable, because designers relied on the AI being broken, in fact the game had special handcrafted AI for each campaign map, and all these AIs was non-functioning in a special way.

Now for that to look non-ridiculous, I need a single border of water with all the ship and somewhat abstract looking world map. Anyway, aforementioned Hammer of the Gods, had similar solution, although ships were carried by squads!!! That was the most laughable thing about it: carrying a viking drakkar boat over long distances.

In addition there are roads. These are just a few pixels in thin, so tracking them properly for player and AI will be very hard. Yet all parties have guard range, which specifies nearby locations such party has access to. If say a city is in guard range, then party can enter. Same with roads: if a road is in guard range, unit takes less time to move there. Yeah, continuous space is measured with ranges, so even infinitesimally small items can be isolated.

Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.

(https://i.imgur.com/Yd8UNx3.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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).
Title: Re: XCOM Inspired Fantasy Game
Post by: Stoddard 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.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.).
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.
(https://i.imgur.com/0n7PCBy.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.
(https://i.imgur.com/ZBS2E0I.jpg)(https://i.imgur.com/ajxyjY0.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Stoddard 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.

(https://lxnt.wtf/oxem/builds//df4ch800.jpg) (https://lxnt.wtf/oxem/builds//df4ch.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.

(https://i.imgur.com/Il3z96y.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Stoddard 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.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.

(https://i.imgur.com/KRku1Ra.jpg)
(https://i.imgur.com/mahcGtd.jpg)
(https://i.imgur.com/JVbp0FN.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Stoddard 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.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.


(https://i.imgur.com/ERRxogd.png)
(https://i.imgur.com/iNkBlT8.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov 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.

(https://i.imgur.com/Hk1WOmI.jpg)
(https://i.imgur.com/mJEA5qF.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 01, 2020, 02:58:09 am
I have a few free to use, but unfinished, sprites published long ago by a nice guy. To my knowledge they never been used by anyone. These mostly duplicate characters I already have in game, but guess I can use them for bosses. They are in the same style, my other sprites are, having exactly the same 64x64x128 proportions. I've already finished the Lich sprite.

Anyway, that guy, Joe Woynillowicz, had been developing some very cool looking and promising tactics game, called Darktide, in a beautiful artstyle (think chrono trigger with a bit more realistic proportions).
Unfortunately they stopped updating the devblog in 2017 :(
http://creoterra.com/

That always happens with promising games :(

(https://i.imgur.com/d8VwcDG.jpg)

Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on January 01, 2020, 01:22:51 pm
That always happens with promising games :(
Probably people define to ambitious scopes and can't deliver it. Maybe better approach is do MVP and then adding on top of this new functionality.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 02, 2020, 02:28:17 am
Probably people define to ambitious scopes and can't deliver it. Maybe better approach is do MVP and then adding on top of this new functionality.
Small team projects are also very dependent on each member. They wont survive "the bus test". I.e. if bus hits programmer, the project is done, if bus hits artist - same thing. On large AAA projects you have several programmers, so if lead programmer gets ill, others would still be able to carry the project, although with a few more bugs. They also have some art style guidelines and technical specifications. Here is for example art guidelines for Ultima Online: https://gallery.ultimacodex.com/ultima-online-kingdom-reborn-art-guide/

Indie projects are also worked on by unpaid people, so there are high chance of key team member losing interest in the project, especially if it takes too long to complete.

I personally don't have team members. Although I worked with freelance artists, and it was annoying experience, since external artists can't do anything without being micromanaged, even if you provide them with exact technical specs and examples of what to draw. Many artists also have troubles drawing isometric art - creating sideview platformer game art is one thing, while isometric graphics requires actual art skills, especially animating it (usually it is first pre-rendered, and then painted over), and gamedev artists frequently have no proper art education. They also mess up anatomy badly, like drawing creature tails growing out of their anuses, instead of spines. I'm no artist, but I have no such troubles, but yes I've basic math education. Anyway, I had to manually fix stuff after them.

Guess things are different when you have a professional full time artist on a team. But I heard full time artists are very lazy, since they get paid anyway, even if they do almost nothing. With freelancers you just change them, if they fail, but you can't expect of them much creativity.

Still original XCOM had rather basic and cheesy animations. XCOM Apocalypse used raw renders (they had no time to retouch them into pixelart), which looked just horrible in game, despite creature designs themselves being cool. And for Might & Mayhem they did claymation, which gave passable results, since sprites were large enough.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 03, 2020, 11:02:28 pm
As I mentioned, this is my personal project. While I have no team members and don't have to be responsible before anyone, I still hired freelancers in the past. I had some horrible experience working with Russian ones. For example, I have a Witch character sprite. The idea is that she is half human and half medusa gorgon. Obviously a play on the bipolar disorder stereotype. So I commissioned it to to several Russian artists in row. They all claimed to have pixelart and animation skills. Yet the best they were able to produce is the following:

(https://i.imgur.com/JKtYT15.gif)

Back then I've shelved the sprite, since it was not immediately needed in the game. But recently I had to finish it, which I did myself:
(https://i.imgur.com/knXlRHP.gif)

Have to remind you, that I'm no artist - I'm a programmer and I dislike drawing, yet I was able to do it better than a professional Russian artists with art school behind their back. Guess programming is a universal skill, allowing you to fill in any role, since you already know about light light propagation and animations from your 3d graphics experience. At one gamedev forum I've noticed a math professor guy doing okay isometric pixelart sprites for his games, while most artists usually have problems with isometry, especially animating it, while in Kyiv I met a girl who did Ada programming in university, but now does art for living (since nobody in Ukraine needs Ada programming after the fall of USSR). So yeah, if you want to become good artist, care to learn the frigging geometry at school.

Now you may wonder what was wrong with the original Witch sprite. Obviously animation is non existing, but artists also totally botched the palette, proportions and and art style of my game, despite me providing them existing sprites as example and explaining about proportions and the palette to use. I use that DOS gamma-level palette, inspired by games like Doom and Warcraft to get the retro feel. In fact, I took Warcraft 2 palette for player team colors as the reference point ;D The sprite is also very tall and fragile looking (in fact it is taller than elf and orc sprites), while game sprites have look sturdy looking (think Warhammer pieces) and easily discernible in the whole mess happening in XCOM-style games.

On the other hand, I worked with American and Mexican freelance artists. There were no problem with them. All animations were good. They were newbies yes, but responsible ones. Guess gamedev is hard only when you have to deal with my compatriots, because I actually wasted more of my time explaining Russians what to do than saved by their unhelpful help.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 05, 2020, 02:59:28 am
Experimenting if it is possible to have hexagonal map, but with with nicer boundaries. Also, time to say farewell to the Freeciv tileset. Also fun fact: these hexes correspond nicely with isometric cubes.

(https://i.imgur.com/nXoO2IN.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 05, 2020, 06:40:37 am
Larger sprites are bit easier to discern and click at and I don't need to have separate set of smaller sprites, which is pain to maintain. But the grass texture is a bit messy downscaled from 256x256, since low frequency details became high frequency.
(https://i.imgur.com/12zuIPw.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 05, 2020, 06:56:32 pm
Now there is a tricky part. The hexes in the tileset I'm using are not actually isometric, while buildings on top of them are indeed isometric. That is because isometry implies 45 degree angle, while hexes are straight top-down. Most artists and gamedevs don't notice it, since it can look fine. So we have games like Heroes of Might & Magic and Battle for Wesnoth using perfect hexes. Cant blame them, HoMM was produced by a hobbyist gamedev, who cared more about good game design, while Wesnoth is made by a hobbyist programmer, who wanted to make a clone of an old Japanese game, Master of Monsters. In the original Master of Monsters, player pieces were more like card tokens on a tabletop board, so they were looking fine, but Wesnoth tried to imitate Warhammer look and feel, so isometric angle is explicitly implied. Still Wesnoth doesn't use the pure isometric projection, but the so called "military projection", where angle is less than 45 degrees.

Then we have Fallout and Age of Wonders, which actually use properly angled hexes, because people behind them were very professional. Although Age of Wonders doesn't use the pure isometric angle, but something between the isometric projection and military oblique projection (i.e. the one used in Warcraft 2 and Ultima Online). Similarly to Age of Wonders, Baldur's Gate games too use their own unique angle. Although in BG's case that probably strives from the game's engine being originally created for an RTS, so they wanted more pure top-down angle. Germans from Blue Byte also used proper hexes in Heroes Online, although art-direction wise it was far inferior to Van Caneghem games or even Blue Byte's own games, guess they outsourced it to some freelancers.

Anyway hexes for the true isometric projection always look like this:
(https://i.imgur.com/YhhXi77.png)

Should I squash hexes in my tileset? Well, such angle gives 2-times larger vertical resolution - two times more stuff on screen! I've a restriction in that I want to keep the world map small and fitting single screen, since main game happens in the site exploration phase, so squashed hexes could be useful if I need more hexes on single screen. Unfortunately all the terrain sprites are made to stand on the pure hexes. They can't be squashed, only resized down, making them too small.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 06, 2020, 06:48:43 am
Just a few hours are required to implement hexagonal tileset. I lost like 1.5 hour, due to Symta being underdeveloped. It is a bit hard to use language without interactive shell to inspect the cause of bug inside the running program. Interactive shell requires JIT, and I never got to it, knowing that implementing and maintaining it would require a lot of work, so I don't want to do it until the language design is set in stone. The language itself needs a lot of improvements. It would be a challenge to implement them, while also moving the game to the new language version. Since the few features are total game changers, and would eliminate large sets of bugs, but require changing syntax and scoping rules.

But I doubt the progress would have been that much faster, had I been using Common Lisp, instead of making my own language. Then CL is a bit clunky and non-portable.

Anyway, here is the version with squashed hexes. Yeah, it doesn't look good, but there are two times more space and it plays nicer the isometric unit sprites from site exploration part.

(https://i.imgur.com/iGcYznB.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on January 06, 2020, 01:18:23 pm
I'm not a big fan of hexes, because you can only move in a straight line in 3 directions, and everything else is a zigzag. But you seem to have pulled it off amazingly. It all looks so great.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 06, 2020, 09:19:45 pm
I'm not a big fan of hexes, because you can only move in a straight line in 3 directions, and everything else is a zigzag. But you seem to have pulled it off amazingly. It all looks so great.
The problem with continuous world is that when you add obstacles it gets really confusing, where and how player can move. Most pathfinding related function also get out of control. It was playable but I got uneasy feel from it. And I'm the one who develops the game, knowing every little bit of it. Common player will get frustrated to no end with all these guard ranges and continuous related stuff. With cellular world everything comes in naturally and the code also becomes several times smaller, than the code for continuous world.

If you dislike hexes, then there are also Dirichlet tessellation, allowing to have arbitrary cell shapes. In fact, hexes are just a special case of Dirichlet space partitioning. I know exactly two games, which use Dirichlet for cells. First one is Russian game, Eador - some Heroes of Might & Magic clone, with emphasis on RPG elements, but I haven't played it. Still original Heroes 3 used Dirichlet to create distinct areas for each player, which were then filled with mandatory or arbitrary objects: i.e. each player must have a sawmill and an ore mine - one of the more dubious van Caneghem's decisions, but well, people used it to create some cool atypical maps, where say wood is scarce (there were historic real world scenarios with not enough good wood to build ships).

The other one is Europa Universalis, which tries to be as realistic as possible, but retain large basic cell size, therefore implements arbitrary country borders, instead of subdividing countries into hexes. Dirichlet tessellation can be useful if you want to generate a realistic political map for the XCOM-like plane, but for a simple fantasy game world map, it would be an overkill.

Anyway, I've decided to use squashed hexes, but allow sites take more than 1 hex, like in the classic Panzer General games. I've also used the grass texture as is, without downscaling it. Since the game has comical style, it is okay for it to have exaggerated non-realistic proportion (i.e. grass blade being the size of mountain). At this scale grass is relatively low frequency and looks fine. But forests and mountains need to be fixed using some separate method, since downscaled and squashed they look just horrible, like literal piles of dog feces.

(https://i.imgur.com/xDzfz51.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 07, 2020, 02:50:57 am
Now it looks more like it.

(https://i.imgur.com/J200iIr.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on January 07, 2020, 07:22:32 pm
Yeah, I get the idea from Eador and EU. It's a good system for games oriented towards provinces, but... that's pretty much it. If you want some other focus, it just doesn't make sense.

But this reminded me of something. When I was around 14, I made a home-made Transformers board game (it was damn big, every Cybertronian I could find any info on had their own stats), and the map was composed of intentionally uneven tiles. The general idea was that flat, easily traversable terrain was composed of big tiles, while difficult terrain was more densely packed. Every unit could move for a given number of tiles per turn, therefore open plains allowed fast travel, while mountains or bogs would be slow to traverse. However, shooting ranges as well as flying movement were expressed in cm, not fields, so terrain density didn't affect them. This system was surprisingly good, I am still quite proud of this game 25 years later, so I thought I'd mention it.

But if we talk even tiles, then hexes are fine. I like squares better, as they don't feel so jarring to me (as long as you can go diagonally and such movement costs more), but maybe it's just me and my fixation on X-Com-like things.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 08, 2020, 07:57:16 am
The general idea was that flat, easily traversable terrain was composed of big tiles, while difficult terrain was more densely packed. Every unit could move for a given number of tiles per turn, therefore open plains allowed fast travel, while mountains or bogs would be slow to traverse.
I'm pretty sure that is called quadtrees. It is in fact used for pathfinding in continuous space and for algorithms like ray tracing.


Now with large city sprites and some variations for mountains it looks a bit better (and definitely order of magnitude better than the Freeciv tileset with cockroach sized sprites). The hex shapes along the shore are actually a bug, but I think about leaving it alone for now, because it hinted me about the idea of shaded grid blending nicely into tileset, instead of the of the usual out place grid drawn in some annoying color.
(https://i.imgur.com/pdOF7Dk.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 09, 2020, 12:19:55 am
Now hex worlds have appear to have only one proper way about laying down rivers and roads. First you imply there is some there is space between hexes, now rivers can go along along hex edges, never approach hex centers, while roads go though cell centers, so units spend additional move points, when trying crossing into hex divided by river. That means units can follow roads, and cross rivers, or follow river along the edge. Very small number of hex games uses this rule, and they are all relatively modern, like Age of Wonder and Blight of the Immortals.

Most games, like Wesnoth and Panzer General, use half broken approach. For example, Wesnoth doesn't have small rivers, only large 1-hex sized ones. They don't look nice, but that was the original Master of Monsters design, which Wesnoth cloned. Later 1992 Master of Monsters, Rings of Twilight, actually implemented small rivers, which gone through centers of hexes, with the possibility of them messing with roads was prevented by the fact rivers came out of vertices, while the roads always crossed hex edges. Panzer General rivers were similar to later Master of Monsters ones - they also came out of hex vertices coming through hex center, but roads also came out of hex vertices, which was really dubious decision.

Original Japanese Daisenryaku (Panzer Genral is actually its faitful clone), one of the first computer hex strategies, just used large hex-sized roads, but 1991 version of it used proper road and rivers, although both connect though the edges, coming though hex centers, giving raise to non-uniformity of another kind. And then some hex games, like Armello, don't have rivers and roads at all.

(https://i.imgur.com/k6lSJpQ.jpg)
(https://i.imgur.com/OZPp2yO.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on January 09, 2020, 07:41:37 pm
Then I some time ago playing with design of game (similar to Master of Magic), I come to conclusion that both walls and rivers should be placed on edge of hex.
Only exception would be rivers that are very big but then it will be not "terrain" but "water" tile, and normal units could not enter tile with big river.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 10, 2020, 08:21:19 am
Then I some time ago playing with design of game (similar to Master of Magic), I come to conclusion that both walls and rivers should be placed on edge of hex.
Only exception would be rivers that are very big but then it will be not "terrain" but "water" tile, and normal units could not enter tile with big river.
It all depends on your game's mechanics. It is still possible to resolve roads/rivers clash several ways. For example, if river always comes out of an odd hex vertex, and roads always out of even vertices, then there wont be any inconsistency.

Rivers in the center of hex take more space, while river going along the edge allow placing anything in the center, like i.e. there can be a fortification surrounded by rivers from all sides. If rivers are allowed to go through hex centers, then that fortification would be sitting on top of a river. so it would get messy to decide, if it stuck in water, or supposed to be on some island inside river, or on one of the banks. That is important, if you have bonuses/penaties associated with rivers. I.e. in Panzer General traversing river incurred movement penalties and units on river hexes were vulnerable to attacks. Original Panzer General had such rivers because it is easier to implement them. Although it varied implementation. In PG1 engine rivers connected though corners, while in PG2 they connected though edges. PG2 also had some nice tileset at strange angle, which while not isometric still implies squashed hexes, but PG2 for some reason havent used them, using usual hexes.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 11, 2020, 08:59:19 am
Now comes one tricky subject: random names generation. Old XCOM games had numerous characters with Russian names. Although a few male characters got female surnames, like this "Leonid Gorokhova", because Gollop, a native English speaker, didn't knew that in Russian all words have gender, compared to more modern genderless English. In fact, it is impossible to speak Russian, without constantly thinking about gender. But yeah, long long ago, English, being Germanic language, was far more synthetic and indeed had genders.

Today English is more mathematics like, making it really good for programming or auto-generating messages. The only problem comes from plural noun forms, while in Russian everything gets mutated base on word and other words in a sentence, so it is near impossible to generate Russian messages without large framework.

I decided to use German stems to generate city names, actually using stems from a few real world European cities. With human names it is a bit trickier but I will likely use Germanic names too. For monsters I will use Greek stems - that is no brain decision, since there are a few Greek monsters, while Ogre Battle and Final Fantasy Tactics already made it into a tradition to use Greek and Latin names for monsters.

Now you may question what is the point of giving some random unit a random name? Well, it is far easier for human beings to to process than if characters are named by their internal serial numbers. I.e. I want to give player the quest to defeat bandit leader - such leader should have a precise name to discern him from other units in the dungeon.

(https://i.imgur.com/yxSsnTf.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 13, 2020, 03:06:30 pm
Decided to make magic system more complex by introducing reagents. That would make Spell of Mastery closer to the original Spellcraft and The Four Crystals of Trazere, since game is inspired by them, as well as by Lords of Chaos, which also had reagents, albeit only for most powerful summons.

In the initial design, building a magic school guild and its addons opened spell tiers, after which school's spell charges were available for purchase. Now each magic school has the base reagent, required to cast all that school's spells, the friend school's reagent, required to cast more advanced spells, neutral reagent required to cast more powerful spells and the enemy reagent required to cast most powerful spells. The catch is that neutral and enemy reagents are more scarce than base and friend ones - enemy reagent cant be purchased from local alchemist at all. For now all 4 reagents correspond to the four magic schools: life, death, order and chaos (similar to mana colors in MtG). I.e. instead of buying spell charges, player buys reagents. Such system has good sides as well as bad sides, compared to usual mana-based, memorization based and charge based spell systems.

Good sides:
1. Wider array of available spells, instead of just the purchased ones. I.e. player doesn't have to pre-plan everything, as long as he/she has the reagents.
2. More collectible items during site exploration, as well as the ability to interconnect it with other subsystems. I.e. purchasing some unit can also cost reagents.
3. More powerful versions of the same spell could just use more reagents, like with The Four Crystals of Trazere.
4. Reagents can server as a trade item, since their cost depends on the city's build up.

Bad sides:
1. Needs different super-system to limit availability of specific spells.
2. Can be too overwhelming for casual players. Spellcraft's system really scared most players, leading to the game being lost to obscurity.

I also considered the idea of units dropping related reagents on death, but decided that it would lead to a nasty and boring grinding, similar to the experience-leveling system. That would totally contradict my game's design, where player has very precise goals and all enemies should be avoided when possible. Of course I can introduce the dreaded time limit, but that would make the gameplay even more nasty. I really hated the Wesnoth and Fantasy General's grind planning to get as many experience in the limited time as possible. It actually prevented me from completing or even enjoying these games.

Also didn't knew that, but just a few months ago they actually released the unexpected sequel to Fantasy General (of all obscure games!), although I found original l FG a bit dumbed-down compared to the Panzer General, and really unbalanced, where only a few units types were actually useful to complete the game on any mode beside easy (the hard mode was just impossible in the final missions).

Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 14, 2020, 09:08:06 am
Since the game now uses different magic system, I had to implement proper item trade, including item stacks. Since stuff like reagents must to be stacked (there will be like 100 reagents per squad).

Regarding health potions. If they are allowed to be stacked, then player could overuse them, with single unit carrying like 100 of them (the worst example of that are Diablo games). So there should be some cooldown on potion use, or limit on stacking so single unit wont be able to carry more than some potion limit. I will likely implement some supply demand system - the more player uses potions the more they cost.


(https://i.imgur.com/xpPUAEh.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 14, 2020, 01:32:23 pm
While bloom is generally considered annoying effect, in some cases it can improve graphics. Like in lava scenes. But yeah, doing such post processing without 3d acceleration is a bit costly, even if SSE optimized.
(https://i.imgur.com/ysBLyQT.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 14, 2020, 04:05:13 pm
Another design decision is if there should be single abstract reagents pool for each squad or each unit should have exact reagents inside inventory. Reagents pool approach would be more strategic level, while per unit is more tactical. And it would also make abilities like teleportation and telekinesis more useful to transfer reagents across tactical map. Having consumables system unfolded also simplifies processing them uniformly.

But, yeah, for a tabletop game one will likely limit design to a global resources pool, which is already a bit on the complicated side, although in some table top games characters do carry personal consumables, beside other equipment.

The question still remains if gold itself should be represented as an item. For now any picked up gold immediately gets added to the abstract player's side entity. But I'm considering giving gold to the squads's main leader instead, and then link all activity to him/her. But that would open a can of worms, since economy would require further unfolding, maybe including such details as main leader's salary and loyalty, or some other parameter keeping him/her against revolting and getting away with money. Real life money are controlled by numerous factors, like monopoly to currency issuance, and based from that comes also officer loyalty in real life armies. That is tactical level, but of different kind, and can be hard to implement properly, especially since there are no prior-examples, beside maybe KOEI games, which tried to add officers loyalty into equation.

BTW, KOEI games are really good, all of them. And later added hex tactical maps. Westerners for some reasons never cloned KOEI games, although there were similar games, like Sierra's Birthright and SSI's Fantasy Empires - both D&D license and totally broken, especially the Birthright one, but still nice and unique games. These game also had no-uniform map borders. Birthright had Might & Magic 6 like site exploration and pausable gameplay, but with a 3rd person view, instead of being a blobber, and Myth/Total War like army battles. But Birthright was likely based of earlier Amiga game "War in Middle Earth" (another massively over-engineered monstrosity). For some strange reason most Western games of the 90ies always had a lot of potential, yet always were killed by some deadline and released as unpolished mess (beside Blizzard games), while Japanese never did that, always finishing and polishing their games. Guess that is because Japanese don't have xmas, so they can release games on the date when they are ready and when there are no competing releases.

(https://i.imgur.com/O9YDC3R.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on January 14, 2020, 11:12:48 pm
While bloom is generally considered annoying effect, in some cases it can improve graphics. Like in lava scenes. But yeah, doing such post processing without 3d acceleration is a bit costly, even if SSE optimized.
(https://i.imgur.com/ysBLyQT.gif)
One question what if you do some "palette" tricks like TFTD did with vapor, instead of calculating each time new color of new pixel you cache most of calculation and use tabled values. This is super cheap for 8bit graphic but for full RGB could be done too, simply you will need do some shortcuts.
One algorithm that could work is take most significant bits from each color combine them into index, using index get new set of RGB values that will be added to current pixel values. We will loose precision but it could result in close to desired effect.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 15, 2020, 05:27:46 am
One question what if you do some "palette" tricks like TFTD did with vapor, instead of calculating each time new color of new pixel you cache most of calculation and use tabled values. This is super cheap for 8bit graphic but for full RGB could be done too, simply you will need do some shortcuts.
One algorithm that could work is take most significant bits from each color combine them into index, using index get new set of RGB values that will be added to current pixel values. We will loose precision but it could result in close to desired effect.
I doubt palette animations can be used there. All sprites are independent from each other, in true color, and have personal recolor ranges. I.e. there is no global palette. So manipulating pixels is not cheap. Although I do recoloring on blitting, but that still requires using stencil buffer. Same way I'm going to use stencil buffer to mask regions and apply bloom filter to them. The fog of war should too be done with stencil (and it would likely be cheaper than what I use now). Anyway, without the bloom lava doesn't appear to emit any heat, while real life lava radiates light, so things near it should be colored in its color.

Palette can indeed be used to create rather complex animations (i.e. Stacraft used it to animate water without using additional tileset memory), but palette effects are all very cheesy and oldschool, requiring everything to be pre-baked. For example, in following demo I made the background is a single static image, only palette is changing.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on January 15, 2020, 10:55:08 am
I did say "palette" not palette :> My solution is approximate some index based on RGB values for 24bit pixel. let say 9bit index using most significant bits of each color using bit masks. For each "Index" you could have precalculated values that you can add to pixel values. You can skip all multiplications, dividing and branches and use only bit shifts and adding. Only drawback would be that it need load some values from memory using offsets, but at least will not make lot of cache misses because after couple of first pixels all memory will be hot.

Something like that:
https://gcc.godbolt.org/z/4gyUYH
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 15, 2020, 01:54:43 pm
I did say "palette" not palette :> My solution is approximate some index based on RGB values for 24bit pixel. let say 9bit index using most significant bits of each color using bit masks. For each "Index" you could have precalculated values that you can add to pixel values. You can skip all multiplications, dividing and branches and use only bit shifts and adding. Only drawback would be that it need load some values from memory using offsets, but at least will not make lot of cache misses because after couple of first pixels all memory will be hot.

Something like that:
https://gcc.godbolt.org/z/4gyUYH
Ooops! My bad! I though you suggested recoloring lava shore to match lava highlight and then animate it with color cycling for the heat haze effect.

Mark Ferrari some amazing color cycling pixelart animations for Magic the Gathering Battlemage. The game sucked badly, but Mark's illustrations were top notch. There was also Windows MtG version, and it was a bit better gameplay-wise, but it had no nice visuals or much graphics at all. It was also horrible programmed (i.e. its running speed was linked to CPU cycles), so it is a chore to run it even in emulator.

(https://i.imgur.com/ORn4AZR.gif)
(https://i.imgur.com/dlLln5K.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 19, 2020, 01:52:14 pm
Originally Spell of Mastery had just a single wizard leader, similarly to original Gollop's Chaos, but since then I decided to add non-wizard characters and allow several leaders, since some people would likely want to start with say a thief characters or a warrior.

Anyway allowing player to have several wizards and leaving spells really powerful would break balance, requiring to nerf spells - i.e. player could just spam lightning bolt, which is designed to kill any low tier unit in a single hit, so several wizards would kill even a dragon in a single turn, if player has enough reagents, which are, well, pretty cheap. There must be some better way to solve it. For single unit that is solved by having cooldown timer, personal for each ability,  so I decided to add global per player cooldown pool, so lightning spell can be used only once in a few turns.

The other way to solve it would be adding exponentially increasing costs for each cast, but that would be far more complicated than simple cooldown and would no doubt annoy players.

And going back, the original Spell of Mastery wasn't even an "XCOM clone", but a Chess clone, but with larger maps. In fact units abilities were bound to their spatial movement, and any unit killed any other in a single hit. There was also some Sokoban mechanics, using environment items to block units from attacking. But then I found that spatial movement patterns work badly on maps larger than a chess field. So I just converted it to usual turnbased tactics, yet deciding to keep determinism and the chess single hit mechanics to make it less annoying.

Also stumbled upon a video demonstrating how broken are the new XCOM games. That guy usually uses items duplication bugs, and these are indeed easy to overlook before release, but having a bug in turn scheduling requires some really bad programming practices. And what was the reason to allow player to save inside battlescape? To promote save scumming? If mission takes too long, then just break it into parts, add save limit (no more than 2 saves per mission), or better yet - redesign your game to make missions fast enough to be completed in under 30 minutes. Guess cool idea would be adding UFO self destruct timer - if it isnt secured in enough turns, UFO goes BOOM! killing everyone on the map and polluting area. That would surely add some tension, and a goal beside killing poor defenseless aliens, trying to hide from you.