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: 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: wcho035 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: wcho035 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: wcho035 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: wcho035 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: wcho035 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.

Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 25, 2020, 03:03:28 pm
Now comes the Lords of Magic inspired part. Lower tier dungeons have be the closest to player starting cities, while higher tier dungeons get remaining slots.

You've probably noticed that I use the same world map for everything. No. Random map generator is not broken. I just find it easier to debug the code with static seed. Unfortunately my programming language, Symta, is still in very early stage, so I can't debug the dumped core, like people usually do, when segfault happens, neither I can debug running program, as there is still no interactive console, beside very basic scripting language for even system. I decided to come back to JIT compilation as soon as I finish the game, because there are just a lot of changes to apply to the language based on the feedback from its usage.

It would be separate challenge to modify the language, while at the same time transitioning the game's code between its greatly incompatible versions. Games code is now several times larger than the language compiler's code, so I will have to create some transitioning toolset.

Thinking of it, the same happens with natural languages. You can't change English language anymore, it is now set in stone, while long ago it was far more mutable. Although Jews somehow managed to transition whole nation to artificially restored Hebrew language (most Jews spoke Germanic Yiddish language before transition). That gives hope, that more advanced languages, like Ithkuil, can be introduced as well, since English, while very good (compared to competing natural languages), is still not perfect.
https://en.wikipedia.org/wiki/Ithkuil#Possible_advantages

(https://i.imgur.com/xJiaDoL.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on January 25, 2020, 04:48:59 pm
Thinking of it, the same happens with natural languages. You can't change English language anymore, it is now set in stone, while long ago it was far more mutable. Although Jews somehow managed to transition whole nation to artificially restored Hebrew language (most Jews spoke Germanic Yiddish language before transition). That gives hope, that more advanced languages, like Ithkuil, can be introduced as well, since English, while very good (compared to competing natural languages), is still not perfect.
https://en.wikipedia.org/wiki/Ithkuil#Possible_advantages
If I could alter used language I would use Latin :D I'm very fond of this language even if I barely understood it.

For artificial languages, the proof of the pudding is in the eating it. What would happen when you release this language to hole nation?
I think it could start mutating very fast to meet need. How you could keep unambiguous when people start using mems, irony or subverting meaning of words.


Code: [Select]
It would be separate challenge to modify the language, while at the same time transitioning the game's code between its greatly incompatible versions. Games code is now several times larger than the language compiler's code, so I will have to create some transitioning toolset.
Could you show some snippets of you code? You could even do some highlight of its capabilities.



Aside from that. I was still thinking about your idea of global spell cooldown for whole team. It feel to much gamely, some artificial limit to make game work and be balanced. Lot better would be if limits go from game word.

One way I see this could be fixed is that we have some "elemental mana field" that spreed whole map. And each time you cast spell you drawn power from local area. This mean if you spam spells of one element to much in one place each spell will be lot of weaker than one before. You could counter act it by spending more resources to drawn power from bigger arena but cost would grown exponentially. After couple rounds field will regain its power.

This is basic idea and I see it could be even expanded. Spells could could affect this field too (aside form consuming it). Different elements could have iteration between them that encourage spell rotations (image that lighting is transfer of power from electric to earth element, then on place of impact casting earth spells will be more powerful).
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 26, 2020, 08:22:27 pm
If I could alter used language I would use Latin :D I'm very fond of this language even if I barely understood it.

You can learn Spanish. It is based of Latin, although more evolved and optimized. But my point is that natural language are not perfect, while artificial language can greatly improve understanding (orders of magnitude in some cases). That is already demonstrated by Set Theory notation and by programming languages. Romans used roman numerals, and it was real pain to do any calculations with them, other nations of the time had similarly broken systems, before Indian position system got widespread. Same reasoning can be applied to natural languages in general, since they leave a lot of ways for misinterpretation or get too verbose when representing some non-trivial concepts.

Alphabet can also be greatly improved, although Ithkuil's one looks too scary to me, like some actual alien glyphs.

For artificial languages, the proof of the pudding is in the eating it. What would happen when you release this language to hole nation?
I think it could start mutating very fast to meet need. How you could keep unambiguous when people start using mems, irony or subverting meaning of words.
English is somewhat static for the last 100 years, compared to previous stages of its development. But yeah, it got new words, like "meme", which is a shortcut for what previously require larger sentence. With Romance languages it is far more complicated.


Could you show some snippets of you code? You could even do some highlight of its capabilities.
It is a Common Lisp based language, but with modified garbage collection algorithm to guarantee real-time performance for interactive apps like games.

Typical snippet would be
Code: [Select]
wsite.add_unit UnitType hired/1 leader/0 garrison/0 noItems/0 =
| U = $world.units.alloc
| U.init{UnitType Me}
| less Hired: leave U
| U.hired <= 1
| when Leader:
  | U.leader <= 1
  | when $type><party: $set_spr{"[UnitType]"}
| less NoItems:
  | Type = U.type
  | when Type.upto{5}><unit_: Type <= Type.drop{5}
  | V = $world.visitors.Type
  | when got V: for [_ ItemType Count] V.items^~{[]}:
    | U.add_item{ItemType count/Count}
| U

I made major error in object system design, since I planned to minimize object use (OOP was just a quick made convenience for widget system), but found it near impossible to organize large system, like video game, without objects. So I have to use `$` to access members, while compilation unit variables are accessible by default and clutter method's scope. I have to do the opposite - make member variables easily accessible, but global variable to require `$`. That is really hard to do, considering the dynamic typing nature of the language - I can't do that using statistical analysis methods, but will have to go over every single line of code.



Aside from that. I was still thinking about your idea of global spell cooldown for whole team. It feel to much gamely, some artificial limit to make game work and be balanced. Lot better would be if limits go from game word.
Yeah. I thought about a system where casting the same spell over limit would cause aberrations, potentially wasteful and harmful to the caster. But that is a bit hard to implement, without random dice roll.

One way I see this could be fixed is that we have some "elemental mana field" that spreed whole map. And each time you cast spell you drawn power from local area. This mean if you spam spells of one element to much in one place each spell will be lot of weaker than one before. You could counter act it by spending more resources to drawn power from bigger arena but cost would grown exponentially. After couple rounds field will regain its power.
The problem with that is that I want it to be per spell base, not per large group of spells. Its purpose is to break the positive feedback loop  - i.e. to prevent the player from casting say Armageddon spell several times to kill all enemies in a single turn, or to spam the heal spell with 10 spell casters on a single tank, without risking anything:
https://arcaderage.co/2018/02/11/game-design-feedback-loops/

I already have reagent system in place to limit the number of spell casting by gold and carrying capacity. The one solution would be to make repetitive cast of the spell to cost more reagents. That is a common game design trick to solve feedback loop. Can be similarly explained to player that magic forces of the area got depleted and so need more resource to get invoked. In addition, economy should have some supply-demand simulation going on, so if game has some dis-balance, and player starts buying some healing/resistance potion, which was made OP by a design mistake, the cost of the potion will quickly skyrocket. Unfortunately I've no idea how it would work in multiplayer.

This is basic idea and I see it could be even expanded. Spells could could affect this field too (aside form consuming it). Different elements could have iteration between them that encourage spell rotations (image that lighting is transfer of power from electric to earth element, then on place of impact casting earth spells will be more powerful).
While the game is indeed inspired by Lords of Magic, There are no usual earth/air/fire/water elements, but instead just chaos, order, life and death magic schools, where chaos includes direct damage spells and spells like flood, life gets blessings and cures, death curses and sacrifice spells, order spells like telekinesis and teleportation. Each school has associated with it spellcaster unit type, and a few jack-of-all-trades spellcasters, that can't cast the most powerful spells (i.e. Ifrit can cast only basic chaos spells). The reason for that is elemental schools typically duplicate each other, having boring copies of the same spell. Now all schools have some damage inducing spells, but for say Order School that wont be some "spirit arrow" spell, duplicating "flame arrow" and "ice shard" from elemental schools, but instead "force push" spell that would be more powerful than flame arrow, but require some way to push target from the cliff or into the water, and also the target to be light enough to be pushed (no way you can push huge stone golem), and it would also make no sense to push flyer from the cliff, since they can fly, but for all other units force push would likely be the fall to death.

I've also considered the idea from Final Fantasy Tactics, where terrain affects spell power. In fact, FFT had Geomancer class, which casted different spells based on the target cell terrain type. Then again, FFT had a lot of innovative ideas, but was totally unbalanced (on top of nasty grinding), with Calculator class just ripping everyone to shreds on the whole map with a single spell cast.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 31, 2020, 12:03:25 am
Returning back to the item system. As I mentioned, it can be a bit hard to determine item value beforehand. If fact, items value can be dictated by world's state. Simplest example of that: player has full health, there is less demand for a healing potion. I remember Heroes of Might & Magic was notorious game for valuing items improperly, where some artifact place can have actually generally useful item, or some item protecting from some rare high level spell, which was never used by AI. Random item placement is generally involved problem, especially in games like Diablo, which are completely based around loot. Diablo-style games also have random item generation, where each item is composed of different parts, and can have some sockets on top of it, allowing player to further customize item for picked strategy.

Master of Magic was probably the first game to allow both composite items and player to create items, long before Diablo 2. Interesting is there some MoM making of interview? For what I can guess, the game was obviously heavily inspired by the MtG (i.e. magic the gathering on top of civ engine), but where did the composite item idea came from? Also, with all these MoM remakes, people forget that Japanese actually remade MoM for the original PlayStation console, calling it Civizard ( https://www.youtube.com/watch?v=Rm671VDbChs ).

Anyway, I dislike the idea of boring +1, +2, +3 items, so I will try making each item game changing. Items and prisoners would be the single reason for payer to explore dungeons. But some common items would still be produced at cities.

BTW, here is the meme on why I dislike RNG in games:
(https://i.imgur.com/6RMP19x.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on January 31, 2020, 01:02:17 am
Sure, let's find the worst possible implementation and make it a strawman against the feature.

I never did and never will play games with no randomness. At least not the kind which emulates some reality. No randomness means no uncertainty, and therefore no life or immersion. Such a game is dead, dead and dead. It has no appeal. I'd rather play tic tac toe, at least it doesn't fail miserably at pretending to portray some sort of setting.

It doesn't matter how good your game is if it's dead.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 31, 2020, 03:48:04 pm
Sure, let's find the worst possible implementation and make it a strawman against the feature.

I never did and never will play games with no randomness. At least not the kind which emulates some reality. No randomness means no uncertainty, and therefore no life or immersion. Such a game is dead, dead and dead. It has no appeal. I'd rather play tic tac toe, at least it doesn't fail miserably at pretending to portray some sort of setting.

It doesn't matter how good your game is if it's dead.
Then why people play Starcraft?
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on January 31, 2020, 04:01:17 pm
Because it's a e-sport, I suppose. It's not meant to be immersive, or actually simulate anything.

It's basically chess with fireworks.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on January 31, 2020, 11:32:06 pm
Because it's a e-sport, I suppose. It's not meant to be immersive, or actually simulate anything.

It's basically chess with fireworks.
But a lot of randomness arises from player actions. Starcraft's deterministic rules coupled with unpredictable user input are as good as random, but without the nasty parts of the random. Lets not forget, that in reality there is no such thing as "random" - it is just a buzzword for describing complex things, we don't understand. As Einstein said "God doesn't play dice". What appears to be random to us is just some complex high frequency process, which our brain can't handle, so we see white/brown/pink noise.
Title: Re: XCOM Inspired Fantasy Game
Post by: ohartenstein23 on January 31, 2020, 11:46:58 pm
As Einstein said "God doesn't play dice". What appears to be random to use is just some complex high frequency process, which our brain can't handle, so we see white/brown/pink noise.

Einstein said this in response to an interpretation of quantum mechanics because the math suggested the universe is not in fact deterministic, it just looks that way when you're in the realm of things that don't behave all that quantum mechanically. It's the opinion of a man who didn't like the interpretation of a new theory that is now taught as university chemistry and physics.

The blanket statement that the universe isn't random cannot be made definitively when the underlying math we're using to describe it is inherently about probabilities, not definite motions.

In terms of how this applies to game design, Starcraft can be interesting when you don't know what the other player is going to do. Without that knowledge, the inherent unpredictability could be modeled as a random process. It gets less interesting when "meta" strategies evolve and play becomes predictable again because the same input strategies will get the same counter-strategies, leaving the result down to hoping your opponent makes a mistake. Even then, you don't know if or when the other player will make a mistake, and an unpredictability will determine your outcome.

If you make a game without multiplayer, the interest is generated by the computer decision-making against you. To hold the player's interest, you either have to make something deterministic be suitably complex so that no player maps out the inputs to behavior and you get "one way to play," or you can make the computer opponent and situations unpredictable by adding complexity modeled by randomness. I personally wouldn't want to do the first method as that means I'm assuming my intellect is enough greater than my players' that they won't ever solve the deterministic problem I put before them. Not that I'd want to use the randomness as a cop-out either, but it does give a way to hold the interest of players longer.
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on February 01, 2020, 11:41:02 am
Lets not forget, that in reality there is no such thing as "random" - it is just a buzzword for describing complex things, we don't understand.

Sorry but when did you learn physics, in 1860s?
While some physicists today admit the Universe may be deterministic, even they unanimously agree it's meaningless, since other laws of physics prevent us from fully knowing the initial conditions. Therefore, for all intents and purposes, it is not deterministic.

A situation where two units fighting one another under the same conditions always lead to exactly the same result isn't even funny, it's a mockery of simulation.

You keep saying Starcraft this, Starcraft that, while constantly ignoring the elephant in the room: Starcraft is not a simulation game, it is - as I said before - glorified chess. In chess, both participants have access to 100% information and the game is about measuring your analytical penis against your opponent (who can predict the next steps better), which is a completely different kind of activity and has zero relation to real world, which is entirely chaotic.

But all this can be my misinterpretation. I was under the impression that you wanted to make a civilization game, since you keep referring to titles like Master of Magic which are such titles. If your goal instead is to make another chess variant, with closed information and only dependent on thinking X moves ahead, then you should have said so from the very beginning and I wouldn't bother getting excited about it.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on February 01, 2020, 03:47:15 pm
Another thing Starcraft have AGI component too, without decent APM you will be out maneuvered and lose more units than you should.
but
which is a completely different kind of activity and has zero relation to real world, which is entirely chaotic.
I disagree, if it would be entirely chaotic then you would not be able do do ANY thing, any planing, any strategy, any living. Big class of problems in real life can be solve by skill set similar to one that chess use, why? Because knowing EVERY thing about chess board state is impossible, plan 10 move ahead and you start risking running out of atoms on earth to store all possible states. You need only work on very small subset of possibles and you could miss one critical path.
Good players probably play knowing what they do not know, and place they figures in defense positions from some unexpected threads.
And this is skill that can be easy used in normal life. You can expects some groups of behaviors that can happens in real life, and knowing that some things are not know to you. With this "figures" you can plan your "moves".
Title: Re: XCOM Inspired Fantasy Game
Post by: Bobit on February 01, 2020, 06:46:41 pm
Solarius, hidden information is randomness. If two players play The Prisoner's Dilemma or  something like that, optimal play for them is to do something X% of the time and another thing X% of the time. Which may not seem like a big deal but in complex games (Stratego maybe for example, though as a mainstream board game it's not great) it leads to pretty much the same randomness as true randomness. Starcraft therefore has at least a small amount of randomness just due to fog of war.

I mean obviously no one's smart enough to solve Chess so it still has diversity. And even if Soccer/Football and Starcraft/Dota were "solvable", it would depend on a person's capabilities and skills at different aspects of the game, which is pretty realistic.

However, turn-based single-player games are much better off with "true" randomness, if only AI randomness unless they are handcrafted puzzle games, but I think those get boring after a few hours.

Also, physicists tend to take positions that are helpful to them and look pretty harmless, like Schrodinger's Cat being taken as serious evidence that two impossible things are true at the same time rather than simply not being able to know which one is true, but are philosophically very impactful. Though I don't want to dig further on that in this board.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 03, 2020, 06:00:38 pm
But all this can be my misinterpretation. I was under the impression that you wanted to make a civilization game, since you keep referring to titles like Master of Magic which are such titles. If your goal instead is to make another chess variant, with closed information and only dependent on thinking X moves ahead, then you should have said so from the very beginning and I wouldn't bother getting excited about it.
My design idea is closer to https://en.wikipedia.org/wiki/Dark_chess and https://en.wikipedia.org/wiki/Fischer_random_chess

I.e. there are random starting conditions (i.e. map is randomly generated), in addition to fog of war, acting like your typical pseudo-random number generator. AI is allowed to throw a dice in its decision processes. Then there are spells like "mist", which obscure vision. But the idea is that player can choice a strategy to reduce randomness. For example, player can build more scout units.
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on February 04, 2020, 07:38:15 pm
butI disagree, if it would be entirely chaotic then you would not be able do do ANY thing, any planing, any strategy, any living.

Well, I should have said "entirely chaotic within certain parameters". Though technically it is as you said - anything can happen anytime. The chances are just astronomically low. But that's nitpicking and is not really related to the subject.

Big class of problems in real life can be solve by skill set similar to one that chess use, why? Because knowing EVERY thing about chess board state is impossible, plan 10 move ahead and you start risking running out of atoms on earth to store all possible states. You need only work on very small subset of possibles and you could miss one critical path.

Yes, of course. But I can't remember ever talking about skills, I am talking about modelling the game world.

Good players probably play knowing what they do not know, and place they figures in defense positions from some unexpected threads.

Sure, all players are limited in this regard, which is why playing against each other is possible. But I don't think it relates to the subject.

Solarius, hidden information is randomness. If two players play The Prisoner's Dilemma or  something like that, optimal play for them is to do something X% of the time and another thing X% of the time. Which may not seem like a big deal but in complex games (Stratego maybe for example, though as a mainstream board game it's not great) it leads to pretty much the same randomness as true randomness. Starcraft therefore has at least a small amount of randomness just due to fog of war.

I mean obviously no one's smart enough to solve Chess so it still has diversity. And even if Soccer/Football and Starcraft/Dota were "solvable", it would depend on a person's capabilities and skills at different aspects of the game, which is pretty realistic.

However, turn-based single-player games are much better off with "true" randomness, if only AI randomness unless they are handcrafted puzzle games, but I think those get boring after a few hours.

Sorry, but this completely not on subject, at least not what I was discussing. Why is everyone trying to explain chess to me now? :)

Also, physicists tend to take positions that are helpful to them and look pretty harmless, like Schrodinger's Cat being taken as serious evidence that two impossible things are true at the same time rather than simply not being able to know which one is true, but are philosophically very impactful. Though I don't want to dig further on that in this board.

Yeah, me neither, though I know why this thought experiment was conceived and that it was pretty much criticism of certain aspects of quantum theory rather than support of it.

My design idea is closer to https://en.wikipedia.org/wiki/Dark_chess and https://en.wikipedia.org/wiki/Fischer_random_chess

I.e. there are random starting conditions (i.e. map is randomly generated), in addition to fog of war, acting like your typical pseudo-random number generator. AI is allowed to throw a dice in its decision processes. Then there are spells like "mist", which obscure vision. But the idea is that player can choice a strategy to reduce randomness. For example, player can build more scout units.

Fair, and I certainly won't criticize you for that. Just saying it's disappointing for me personally, because I don't care about this kind of games, and I thought your project was something different. But that's entirely on me.
Title: Re: XCOM Inspired Fantasy Game
Post by: Bobit on February 05, 2020, 08:29:07 am
Yeah I clearly jumped into a conversation without reading the context lol
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 06, 2020, 10:15:51 pm
Fair, and I certainly won't criticize you for that. Just saying it's disappointing for me personally, because I don't care about this kind of games, and I thought your project was something different. But that's entirely on me.
Yeah. I've decided to take "no explicit PRNG" rule as a challenge, similar to "silence vow" monks take. Then again, there are many explicit PRNG strategy games, while almost no true deterministic ones (beside Chess and Go), and I'm trying to distance my game from the mainstream a bit, so I'm looking for obscure features and try to insert them into the game. Like I've adapted numerous ideas from the Lords of Magic.

As I mentioned, adding random chance is easy. It is a game design shortcut. But implementing actually believable world without any Deus ex Machina is hard. Because then everything have to be explained somehow using in-game rules. Randomness is similar to God. It is really simple explanation and works for most purposes. I.e. card games are completely chance driven, yet still believable for people with imagination. But then there are autistic people like me with poor imagination, who need everything detailed, who will ask what source of entropy God used for creating that exact star system, what clothes he wore, what hair style he had, and the magic just fades away... :D
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on February 07, 2020, 04:50:49 pm
A very good point!

I totally get what you mean. For me a game as it is is only a part of what is going on in my experience, the rest is in my head. The game itself is a feeder which provides material for interpretation, this is simply what I like to do in games. So kudos for understanding that, even if you chose a different path.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 14, 2020, 03:47:34 pm
I think the game needs a better water shader. The current static blue water is really ugly. Something like the following would look orders of magnitude better.
(https://i.imgur.com/m7luqIS.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 19, 2020, 07:53:57 am
Further work on map generator. Now it creates cliffs and waterfalls. A lot more work is required to make it more general. I also need to implement proper city generation.

I've considered using something like wavefunction collapse map generator, but it is really slow, hard to control, and does basically the same I already do, albeit within a nice framework. Map generation is basically a pathfinding process inside some really complex space, but its goal is not getting to some precise point, but getting to a good enough point. Give that, you can apply all the genetic algorithms, from markov chains and neural nets to simulated annealing. Then again, when you generate your map from some predefined parts which have restriction on how they connect, you have a markov chain. The problem is that no generic algorithm would create a fun and non totally broken map, so a lot of manual workaround will be required in any case.

For example, I need a way to describe a branching river or a an island inside a river, or a river with a pond. Then there are roads and bridges interacting with them. All that stuff should be placed properly - no circular rivers or crazy roads: if the there is a cliff on the way, road should go around it. No idea how to easily describe that with say markov chains or WFC. ANNs are nice for classifiers and simple filtering, but not for complex structures, which should interact with game mechanics nicely.

(https://i.imgur.com/xN5rmEi.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: memmaker on February 19, 2020, 02:15:00 pm
Just wanted to chime in with an interesting note:

I believe randomness can be used to varying degrees. The less randomness and the more deterministic a game is, the more it resembles a puzzle instead of a strategy/tactics game.

Taken to the extreme, this concept can be seen in "Into the Breach" (https://www.youtube.com/watch?v=SZg8GAnjgyc).

A very interesting little game, which I would definitely put in the realm of puzzle games, even though it looks like turn bases tactics. Every move is completely deterministic and you even get a preview of what the AI will do next turn. Interesting concept.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 20, 2020, 09:22:17 am
The less randomness and the more deterministic a game is, the more it resembles a puzzle instead of a strategy/tactics game.
Not exactly. There are puzzle games with random factor, like Tetris and Match 3. Randomness is orthogonal to the genre.


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

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

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

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

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

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

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

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

(https://i.imgur.com/xbPo3un.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on February 29, 2020, 05:50:34 am
A glitch in city generator actually made me think of a suspended city. Where instead of these soil ramps, pavement will be resting on say columns, with other parts of the city underneath. Shouldn't be that hard to implement. Obviously it would need some railings to look nice.

(https://i.imgur.com/m27Sha7.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on February 29, 2020, 01:12:55 pm
Why stop halfway? Make it a floating city, suspended above the clouds! :)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 01, 2020, 06:53:44 pm
Why stop halfway? Make it a floating city, suspended above the clouds! :)
Well that would require implementing special flying support blocks, so the whole construction wont collapse. A can of worms will get opened, requiring implementing all relevant subsystems and answering game design questions. For example, can these levitating blocks be destroyed? Do they need some energy source? What would it require to damage them? Should destroying them be an important gameplay element, so random maps have to be generated taking their tactical significance into account? I.e. collapsing a flying ship with opponent's creatures or landing it on top of opponent's creatures?

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

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

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

But the gas feature itself is a very powerful game design tool for tactics games. For example, your squad can a have dog on the team, and that dog can smell nearby enemies, revealing their locations. Obviously that needs several gas types, so each object type could have some unique smell. Although CO2 should be enough in the most basic case, since that alone would allow for living creatures tracking. Undeads and inorganic creatures obviously don't breathe. I remember there was an old DOS game, called Wolf, where wolf had to sniff for hunters, bears, prey and other wolves. But it had no diffusion, just direction.
Title: Re: XCOM Inspired Fantasy Game
Post by: Rubber Cannonball on March 02, 2020, 02:22:53 am
The Nox have floating cities.  Invisible floating cities.  Actually more than invisible, phase shifted maybe.  I don't know, it never is explained.  The Nox appear to be a primitive pre-agricultural society living on a pristine world.  Actually they are advanced far beyond humans and their technology if one can call it that appears to be magic.  It doesn't have to have a complicated physics system to describe how it works.  It can just be.  A bit of mystery is a good thing.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 02, 2020, 03:55:55 am
The Nox have floating cities.  Invisible floating cities.  Actually more than invisible, phase shifted maybe.  I don't know, it never is explained.  The Nox appear to be a primitive pre-agricultural society living on a pristine world.  Actually they are advanced far beyond humans and their technology if one can call it that appears to be magic.  It doesn't have to have a complicated physics system to describe how it works.  It can just be.  A bit of mystery is a good thing.
Is it related to the classic Westwood's RPG? I don't remember it having flying cities. It was mostly indoors dungeon crawler. With a bit of interactive environment, compared to Diablo 2. IIRC player was able to move and stack boxes to form stairs. Nox was also a proto MOBA game, before DoTA was invented.

Title: Re: XCOM Inspired Fantasy Game
Post by: Rubber Cannonball on March 02, 2020, 06:00:43 am
The Nox are an alien race in the science fiction television series "Stargate SG1" for reference see: https://en.wikipedia.org/wiki/Stargate_SG-1 (https://en.wikipedia.org/wiki/Stargate_SG-1)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 05, 2020, 06:23:13 am
Ok. The new city generator is almost complete (although components were taken from the old generator). I've integrated with the dungeon and overland generators. So it can generate forest and cliffs around city, river inside city and sewer under the city. Remaining work is adding elevation with stairs, so some buildings would have higher ground. Then connecting it with world map, so cities will have contextual content.

(https://i.imgur.com/z2DQ2mp.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on March 05, 2020, 11:05:00 am
It's all mindblowing.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 17, 2020, 02:16:20 am
Implemented elevated high city with stairs upward. The idea is that elevation adds a bit of tactical depth, since shooters on top get to-hit bonus and relatively safe from melee enemies below.

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

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

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

(https://i.imgur.com/bBFDPd1.png)
(https://i.imgur.com/7HkZuW8.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 17, 2020, 03:31:02 pm
The planning doesn't always make sense, cliff edge pavement needs a special tile (otherwise it blends with the tiles below), and there is still a bug with warehouse door placement. But guess it is fine for now as a proof of concept. Still road planning needs to be addressed at some point. Like the screenshot below a road goes over a hill, and there is no alternate path around cliff.

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

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

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

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

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

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

I want all combat to resolve quickly, so on siege and party-vs-party combat attacking side will be encircling defending one. But city plundering is an optional thing. Same with wilderness exploration. So it is okay for little or no action happening in these sites.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 21, 2020, 01:42:53 am
I had an idea for imps building rafts instead of bridges. But then there are waterfalls. And I also plan adding flow direction to the river, so it would move light objects buoyancy with the flow. These things greatly complicate raft mechanics, which would need some propulsion mechanism. So bridges are just simpler and more robust solution. The earliest game with river flow was probably Tomb Rider, where river impeded player's canoe movement. But I dont remember it carrying other items.

Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 22, 2020, 03:16:18 am
Implemented the castle siege map generator. Given the existing framework it is a cakewalk, but still needed additional feature - road from the city properly connecting to the castle entrance. For now there is no gate, since siege units and siege AI are not implemented. So AI will just rush through the opening. There is also a backdoor feature for now implemented as a teleporter, but in future I will likely replace it with a proper tunnel.

Teleporters were a bit tricky implement, since teleportation implies non-euclidean space, so algorithms like A-Star stop working. AI also needs some special handling, and there is a special edge case when some unit already occupies one of the teleporters ends, requiring to decide what happens when somebody teleports inside of it. BTW, that Tomb Rider game I mentioned earlier had some tricky feature called "portals", allowing to create buildings which have more space inside than it appears from the outside. Like in Morrowind and JRPGs, where small buildings have large interiors, but instead seamless. IIRC, Duke Nukem also had that portal feature.

While teleportation is cool, I think also implementing a time travel spell. Basically it would involve saving current game state and allowing jumping back and forth. Even in multiplayer games. Obviously the feature would require solving the so called ontological time paradox, either purging already collected items from the map or from the time traveler. That will have to be a top tier spell with large ingredient cost.

(https://i.imgur.com/W9P2ycp.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 22, 2020, 03:46:45 am
Recently the original Tomb Rider engine got  reverse-engineered and apparently it worked similarly to maincraft - i.e. with blocks primitives, but supported sloped surfaces. Although devs do use AStar for some reason, despite the game relaying on portals:

Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on March 22, 2020, 12:16:52 pm
Recently the original Tomb Rider engine got  reverse-engineered and apparently it worked similarly to maincraft - i.e. with blocks primitives, but supported sloped surfaces. Although devs do use AStar for some reason, despite the game relaying on portals:

But this map look more as grid based than voxel based as minecraft, look closely at places where floor have different height, each box are unalignment if you consider height, something that is impossible in minecraft.

And for AStar, if you do not need pass multiple portals to reach target you could easy patch it by knowing beforehand what portal is needed to find target and run AStar to portal and Astar from portal. Probably important thing is that in TR each point is in same area that you can reach using normal patch or in different areas and need use portal to reach.
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on March 22, 2020, 10:58:38 pm
But this map look more as grid based than voxel based as minecraft, look closely at places where floor have different height, each box are unalignment if you consider height, something that is impossible in minecraft.

Yeah. Original Tomb Raiders were grid based, and the characters movement are also grid based. So Tomb Raider and XCOM have a lot in common.

I'm sure you can modify Minecraft engine to support vertical blocks instead of cubes. That is what I did for Spell of Mastery, which originally had only cubic tiles in the early prototype. But for Minecraft that would kill the blocky aesthetics.

Regarding AStar and portals, I doubt they needed full blown AStar in Tomb Raider, since enemy AI is rather primitive. I.e. that bear wont be pursuing player over all the level geometry. Compared to tactical games, where AI must properly use everything player uses.

Then again, early strategy game developers haven't even tried to create a competitive AI. Say both Warcraft and Command & Conquer had AIs with pre-build bases, and such AIs attacked player with waves of increasing strength following pre-made path, wasting resources. So instead of being proper strategies, they were actually tower defense games, since player was encouraged to build towers to fend of suicide waves. That made sense since good AI would be unfun for the player. Imagine XCOM aliens playing competently for once, instead of running randomly like cockroaches around the map. That would have been a totally different game.

Anyway, here is the footage of the level editor CORE used, allowing creating levels quickly and with easy (compared to Quake, or the modern Unreal engine):


Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 06, 2020, 03:57:40 am
An XCOM-like game obviously needs some artillery unit. I made a cannon sprite. But a cannon all by itself without a cannoneer looks silly. So I used previously scrapped gremlin sprite. Hope it looks passable now.

That gremlin is obviously hard coupled with the cannon. But allowing turrets to be operated by any humanoid can be a nice idea too, albeit a bit hard to implement. Especially for AI. I still plan adding mounts for some humanoids.

BTW, many games like Age of Wonders, Age of Empires and all Warcraft have possessed catapults moving without any service units. Warcraft 2 ones are provably possessed since they have "inorganic" property, meaning life drain doesn't work on them.

On the other hand a few classic games like Z and Fallout Tactics had explicitly manned vehicles and turrets. In Z that was a major feature with many maps featuring a race to capture unmanned vehicles.

(https://i.imgur.com/R9AUkKB.gif)
(https://i.imgur.com/FOsgboW.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 09, 2020, 05:27:52 pm
I've decided to rethink the ship sailing mechanics. There are several options
1. When a party visits a city with a shipyard, it can buy/rent a ship. Such ship will be shown like a usual roster unit, but wont be present in battle. It will have an inventory, which could only be accessed while in sea. Such ships can be traded between parties. This system still doesn't accommodate for a ship being bound to some single sea. But it is, well, simple.
2. Warcraft 2/Heroes of Might & Magic system. Like above, but the ship will be left on in the sea, when party disembarks. This system accommodates for several seas. Yet since the world map is randomly generated, it is not that useful and makes AI much harder to implement. Both Warcraft 2 and HOMM games had notoriously bad ship AIs (proper AI requires building a zone connectivity graph). And it resulted in a few crazy twists, like some party ending up landlocked, after its ship gets stolen or sunken. In HoMM games there is a low level spell "Scuttle Boat", which was used to trick and landlocked larger AI armies. I still don't get why one needs magic to damage a ship :D Many HoMM maps explicitly relied that the player will seize a boat from a disembarked AI party, which in some cases got stuck in a loop and failed to disembark (or disembarked at a wrong place), soft locking the whole game.
3. Some games, like Ogre Battle and Warlords, allow parties entering the sea even without a ship, but greatly slow down the movement, unless the party has some flyer or ship like units (i.e. octopus).

So yeah, picking anything here is a trade-off.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on April 11, 2020, 10:46:46 pm
Implemented sailing. This map doesn't really have a need for ships. It is the same old test seed map. But I plan adding several thematic auto-generated maps to the game, each with successive difficulty and tech level increase, so new player wont get overwhelmed from the beginning. One of the levels will be an archipelago with small islands. Now the game framework is literally finished. All important cogs are in place, so the game is playable from start to finish.

Next step would be determining average game length in turns to balance the AI and goals properly. And fixing minor things. Like i.e. when there are not enough mercenaries to defend the plundered city, their place will be taken by citizens, which are very weak units. Sprites for different dungeon types. Something tells me this could be like the other 50% of work. But it is rather simpler work of filling in the missing details.

Oh, and I had to change my name on social media, because the previous Russian name produced some biased attitude towards me, with people expecting me to speak Russian. I've planned to do that for some time, but had the idea to first do that formally in id card. Unfortunately my current status in Ukraine doesn't allow me to change my legal name. Guess changing informal handle first is better than nothing. Anyway, the name Nash is after the American mathematician John Nash, not the anime character. Gold is unrelated to that anime character either. Guess now people will expect me to watch this anime :D

(https://i.imgur.com/xgKNWug.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 16, 2020, 05:33:31 am
A little playtesting has shown that my initial idea with castle garrison intercepting city plundering was flawed. Since each city should have scouting range, allowing garrison to react properly. And plunder has little value beside killing city dweller and plundering the wealth, so attacker has little reason to do it, give there are enough strength to start castle siege.

Now defending player can also pay dweller to help defending the castle (which is cheaper than hiring them long term). But if the attacker has previously plundered the city, there will be no such mercenaries.

Anyway, the city can also be plundered by a thief unit, like halfling.

So yeah, there is no special interception mechanics now at all. Guess the game became less XCOM. Although there is an option of breaking out of castle siege, which would be similar to XCOM operatives getting into Skyranger and evacuating into a reserve base.

(https://i.imgur.com/xxpgef4.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Rubber Cannonball on April 16, 2020, 08:12:36 am
The picture in your previous post from about 4 days ago reminds me of the Civilization games.  Typically, cities would automatically spot non stealth units in the surrounding tiles which were free from the fog of war mechanic used in those games.  The Call to Power version also allowed the player to build remote detection structures outside the cities such as watch towers which removed the fog of war from a large area or radar dishes which showed enemy units on the minimap over a much larger area.  There were also sonor buoys which detected ships and non stealth subs iirc in the nearby water tiles.

In your game it might make sense for cities, towns, and castles/fortified structures to autodetect large raiding or siege forces in adjacent tiles.  A halfling thief would be a stealth unit that would have a reasonably high chance of infiltrating a city or village without being detected.  He could be used to steal a key artifact or other high value prize from a castle or slowly bleed off gold from a city over time.  A raiding party if successful could plunder a city viking style.  A large siege force would be capable of capturing a city and then defending it instead of just raiding it.

Another game series I'm reminded of is the Magic Candle series.  In those games, the various cities, towns, castles, and other structures weren't capturable as the player only had a small party of up to 6 adventurers.  Enemy towns could only be entered if someone in the party could cast a disguise spell.   Defenses for towns consisted of roving patrols outside the village that could be evaded if the party could cast a detection spell that would allow the party to see them in nearby tiles on the map or alternatively they could be defeated in combat and thus eliminated.  In the magic candle series for travel over water, ships could be rented by the player's squad or party similar to how taxi service works in real life.  Typically, major coastal towns would have a ship nearby available for rent by the day to allow the party to travel to various islands or to avoid travelling by land around a large bay or inlet.  The player could pay to have the ship wait a few days for the party to return to it, otherwise the ship would return to its origin when the party disembarked.

These are just thoughts of mine that came to mind while reading your posts, Nikita.  They may or may not be useful to you.
Title: Re: XCOM Inspired Fantasy Game
Post by: Thermite on April 17, 2020, 12:15:56 am
(https://i.imgur.com/Z5QBTue.png)
That's a lot of boots

(https://i.imgur.com/af8IRwV.png)
One thing I don't like: the sprites for the ground make it harder to know what is in front/back.
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on April 17, 2020, 12:39:14 am
Lovely sprites. Especially the hydra (?).
Title: Re: XCOM Inspired Fantasy Game
Post by: Nikita_Sadkov on April 21, 2020, 06:51:03 am
That's a lot of boots
That is a movement map. Boot icon means that the picked unit will be moving on land. There is also a wing icon, which hints the unit will be moving by air. When unit has to swap places with another unit, there is a swap icon. When unit has to jump down taking fall damage, there is a fall icon. Etc...

Alternative would by highlighting walk-able cells, which is a bit less robust solution, especially if the cell is transparent/invisible - there will be nothing to highlight. Final Fantasy Tactics games instead palce square movement square, but these don't look nice with sloped terrain, and are a bit more scifi-ish.

One thing I don't like: the sprites for the ground make it harder to know what is in front/back.
These are old screenshots.

Finally implemented the world map save/load. For example the save game for the map below would look like https://pastebin.com/ppFerZWH

It is a bit lispy and uses Symta's read/print to parse the save. Still needs some formatting to look nicer since Symta supports less cluttered syntax inside the Lisp-one. Then again, these maps are not really made to be directly user-editable for now, and there will be a proper adventure editor with ability to use a hand drawn map provided by user, instead of the generated one. That way one could quickly import say a Middle Earth map from google image search, setup terrain and make some adventure on it.

(https://i.imgur.com/nhZLynk.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on April 24, 2020, 02:21:23 am
Implemented a few features from Heroes of Might & Magic. Basically party gains movement based on its unit composition. In addition a party composed completed of flyers will traverse any terrain at the same cost. That will make some difference, especially when resource generating buildings get involved. HoMM was all about controlling map structures, yet was for some reason impossible to have flying army of say gargoyles stealing all mines. Even in HoMM4, which got more focus on the party composition and allowed even parties without, well, heroes.

Original XCOM unfortunately had no real notion of world map resources, so base placement made little difference. XCOM Apocalypse instead of resources had corporations supplying equipment. If one was to extend Apocalypse, a brain dead decision would be adding some resource gathering missions outside of the city. Still the game was already pretty massive in its scope, if even it was simulating just a single city.

(https://i.imgur.com/kejx2iI.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on April 24, 2020, 05:13:32 pm
Have you cloned yourself, Nikita?  8)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on April 24, 2020, 08:33:34 pm
Have you cloned yourself, Nikita?  8)
I've changed the name to Nash Gold, since the name "Nikita" created preconceptions and a lot of confusion, like some folks addressing me in Russian, or considering me a girl (Nikita is a female name in the West, because of Elton John song and the Besson movie). And "Nash" is also simpler 1-sillable word. Yet I had the old login info saved by browser, so by accident logged under the old name. Is it possible to lock the old account "Nikita_Sadkov" since it is obsolete?
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on April 25, 2020, 03:58:35 am
Ok. Implemented crystal resource together with mines. Crystals can also be purchased at cities with harbor and marketplace. Now all advanced building and units cost crystals. Crystals also have specials property that they are sold at very low price, while purchased at high price to prevent player from using them as a huge source of income. Same decision was done in HoMM. You wont notice all the thought put into the game design, unless you try to design a game yourself. In fact, initially I had no plan to include second resource beside gold, but apparently it is very important to have a very rare resource to create some conflict from the early stage, as well as to tie the production of high tier units to the map exploration and control. Blizzard games, like Starcraft, also have 2nd resource - gas, but they used it for different purposes. Warcraft games have lumber resource, which is basically unlimited, but takes some time to harvest. I don't completely understand the design logic behind it, but apparently it is to slow down the tech level progress, while still allowing creating units inside the achieved tech level.

(https://i.imgur.com/h4WzCqn.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on April 27, 2020, 01:47:41 am
At last spent some time writing music (instead of placeholders) starting with a proper game over theme:
https://soundcloud.com/nash_gold/spell-of-mastery-game-over-theme

Sorry for the ducks - they are for watermarking purposes, since some people are known to steal and reuse random stuff from soundcloud without giving credit.

I'm not really a musician, so I will keep it minimalistic and mostly ambient. I.e. most tracks will actually be duck tracks.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on April 27, 2020, 08:44:20 pm
Depending on usage, someone can anyway use it ;P
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on April 29, 2020, 05:08:11 am
Implemented castle and palisade gates. For now they work like usual units, so no special siege equipment is required.

There was once a Master of Magic clone game, called Age of Wonders, and it too had castle gates, while the only one way of damaging them was battering ram, which was really slow, especially when you move it from the other side of the map. Had you got a misfortune losing it, the battle was basically lost. It was annoying to say the least. Age of Wonders sequels completely removed that mechanics. Original Master of Magic had no city gates at all, but there was that firewall spell, which damaged enemy units entering the city. Then there was this British Stronghold game, built completely around castle sieges. Surprisingly they allowed any unit do damage walls, given enough time. There was also a fantasy version of the Stronghold game, with flying units, but they really rushed it and it ended up being garbage.

In my cases there are also engineering units, like the imp, which builds ladders and digs tunnels. Guess siege units, like cannons, do additional damage against the gates and walls.

Also, I have cleaned up the UI a bit, moving time and resource indicators into the panel right side. Now there are basically two buttons: end turn and leave map. Player can leave at any moment, without losing any unit that is not surrounded by enemy and has full movement. Obviously leaving castle a siege map leads to the loss of the city.

(https://i.imgur.com/LUVdNRS.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 04, 2020, 08:26:39 pm
Had to rethink how movement points work. Originally I had just `AP` stat associated with each unit. It got replenished with `full_AP` each turn. Then I have dropped the random to hit chance completely. That required introducing additionally `atk` state for each unit capable of attack. Atk basically mean how many AP unit can invest into defeating targets defense. Now some units are immobile, some or all the time. With simple units like destructive castle gates I can just set AP to 0, since gates are passive. But what about the stationary ballista turret, castle defender gets? It needs to have AP to invest into attack. Any any AP means the turret will be moving. That sucks, since I dont want player to move the turret.

Now I can add immobile, and some special kludge to prevent such immobile units from moving, but that wont solve the case with a turret mounted on top of a giant turtle. Giant turtle moves slowly, but the turret should still have a few shots per turn. That can be solved with mounting the turret as a separate unit from the turtle carrying it, but what about the gates with some active security system shooting intruders?

Given these shortcomings I have to introduce a hierarchical AP system. At the start of the turn units gets basic AP (based of stamina), which are then allocated in various sub-systems, like movement and attack. Alternatively one can use a disjoint system system, where all parts get their own AP meter, but living organisms usually have single energy source and single brain, while the time spent on movement or equipping some item is the time not spent to defeating opponents defense. So hierarchical dependency seems like a natural choice. In a real-time strategy you can probably incorporate it with your entity component system, but I have just hardcoded everything for now.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 06, 2020, 01:27:41 am
Added ballista turret for castle sieges.

Now the question is: should different weapon and armor types be implemented to make units a bit more different? Original XCOM games actually differentiated between explosion and piercing damage, as well as fire and laser damage. In addition units had full 3d armor directions, so units, like tanks, could be highly armored from sides, but still have a vulnerable belly. Other XCOM units had armor only in front of them, so any hit to the back or to the side were fatal. I currently have all units being vulnerable from behind and from sides.

Additional question: should armor reduce damage or just difficulty to hit?


Regarding castle sieges, they have remade Stronghold game once again, and it is even bigger mess of bugs.
https://www.youtube.com/watch?v=dg27Bvn4ElA
Firefly has beaten Blizzard to its game. Maps are even smaller. AI is non-existing. Comical Rowan Atkinson style characters are gone. And even from the graphical standpoint, shadows move separately from units, castle walls have a missing floor texture, while terrain looks like it came from some early 2000 3d RTS. Unfortunately Age of Empires now has no competition.

(https://i.imgur.com/WXVHyO0.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Rubber Cannonball on May 06, 2020, 05:05:27 am
Additional question: should armor reduce damage or just difficulty to hit?

Generally, many games treat armor as primarily reducing damage.  Better armor usually doesn't make opponents miss more but instead lessens the effects of the blows received.  Although, bulky or heavy armor may make it easier to be hit.  Special armor with magical attributes such as invisibility or displacement can make it harder to be hit.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 06, 2020, 12:50:26 pm
Generally, many games treat armor as primarily reducing damage.  Better armor usually doesn't make opponents miss more but instead lessens the effects of the blows received.
That doesn't always make sense. Say two knights wear plate mails and armed with short swords. Now one knight hits his opponent with a slash. A slash will get deflected by plates or by shield, and wont do much damage (beside maybe forced the opponent to backstep), unless he hits with the handle and to the head, resulting in some concussion damage. Now if that knight manages to get the sword between the armor plates, that will do the damage, and could be fatal. Same with a warhammer - it will do concussion damage, disregarding the armor.

In modern setting we have bullets and explosions. Bullets do piercing damage, if target has no armor, and concussion damage if target has bulletproof vest (i.e. a bullet can break you bone if shot into the vest from close proximity). Explosion is a pressure wave, which can break and send flying all kinds of objects, so there can be all kinds of damage, in addition to heat.
Title: Re: XCOM Inspired Fantasy Game
Post by: Rubber Cannonball on May 07, 2020, 05:31:19 am
I guess it depends on how complex a combat system you wish to make.  I was assuming hits that did 0 damage were still considered hits instead of misses.  OpenXcom seems to have a good combat system but perhaps there are some things you would like to do differently.  Maybe a hard hitting blow should always do some damage even against strong armor.  Or maybe a percentage of the damage blocked by armor gets converted to stun.  Maybe weapons should be a combination of damage types.  For example a grenade would do both blast damage and the shrapnel would do piercing damage.  Or a rifle bullet would be 80% pierce and 20% concussive while an arrow would be 50% pierce and 50% cutting.  This system could handle sandbags that can stop bullets but allow arrows to penetrate them and grenades that demolish them.  IIRC, the bullet arrow sandbag thing has to do with arrows having more momentum even though bullets have more kinetic energy.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 07, 2020, 05:34:51 pm
I guess it depends on how complex a combat system you wish to make.  I was assuming hits that did 0 damage were still considered hits instead of misses.  OpenXcom seems to have a good combat system but perhaps there are some things you would like to do differently.  Maybe a hard hitting blow should always do some damage even against strong armor.  Or maybe a percentage of the damage blocked by armor gets converted to stun.  Maybe weapons should be a combination of damage types.  For example a grenade would do both blast damage and the shrapnel would do piercing damage.  Or a rifle bullet would be 80% pierce and 20% concussive while an arrow would be 50% pierce and 50% cutting.  This system could handle sandbags that can stop bullets but allow arrows to penetrate them and grenades that demolish them.  IIRC, the bullet arrow sandbag thing has to do with arrows having more momentum even though bullets have more kinetic energy.

I think more robust idea would be simulating the underlying physics. But that wont be a game, since there would be no nice percentages and play will never know how exactly the explosion will behave. With more complex like stuff like sword fight, simulating physics would be very hard. Although one game, Exanima, tries to do that somewhat believable.

A few games, like Stracraft don't have to-hit system at all. Armor just reduces the raw damage. Although there are still different kinds of damage, so say flame throwers are very efficient against zerlings. Although Starcraft has an exception with Protoss units, which have regenerating energy shields. To damage them, you need to first remove the shield, so they are immune to several forms of opponent micromanaging, since a single hit will do nothing. But if you flank them, the shields will go down fast.

Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 07, 2020, 10:47:16 pm
Still trying to come up with the soundtrack direction (Again with ducks for watermarking):
https://soundcloud.com/nash_gold/spell-of-mastery-tambourine-loop

Unfortunately this style can appear a bit too serious for a turn-based indie pixelart game. I had thoughts about more upbeat approach with a trumpets, but it was sounding just too annoying. Also couldn't find any good tambourine sample. Those coming with sf2 fonts sound like ass.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 09, 2020, 02:34:30 am
To generate a mine dungeon, I will adapt the same city generator, but instead of streets there will be railroads and instead of buildings - caves

The city generator indeed needs to be extended since as of now it properly handles only overworld.

Crystal mine dungeon is like a requirement now, since there is now the crystal resource and all mines are obviously well guarded. Otherwise there is no justification of such crystals being a rare resource. Still have no name for the crystals, so they are just blue crystals.

(https://i.imgur.com/KFPZTeE.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Thermite on May 09, 2020, 09:36:44 pm
Hey, Nash, I have been thinking of making a XCom inspired game too, but never worked with graphics much, do you have any tips on how to draw things on the C family language? Preferably C++ and C#?
Title: Re: XCOM Inspired Fantasy Game
Post by: vadracas on May 09, 2020, 09:39:32 pm
If you don't want to use an engine, SDL2 for c++, don't know about c#. If you are fine with using an engine, Unity for c# and unreal for c++
Title: Re: XCOM Inspired Fantasy Game
Post by: Thermite on May 09, 2020, 11:27:39 pm
If you don't want to use an engine, SDL2 for c++, don't know about c#. If you are fine with using an engine, Unity for c# and unreal for c++

I was thinking of doing all the work, engine included...
Will look into SDL2.
Thanks luv.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 10, 2020, 08:16:20 pm
If you don't want to use an engine, SDL2 for c++, don't know about c#. If you are fine with using an engine, Unity for c# and unreal for c++

If you don't want to use an engine, there is a high chance you won't achieve anything beside wasting time, and maybe learning a few basic OpenGL things. So I suggest you to use Unity, not Unreal or Cryengine, but Unity since it targets small teams and even single devs. With Unity you just import your assets and write gameplay code, instead of wasting man-years on all unimportant stuff. Moreover, OpenGL is slowly being pushed out by Vulkan, which is even harder to use, especially for newbies, and designed to be a part of an engine, maintained by a team professional graphics programmers.

I personally use SDL2, but that is because the game is 2d and I'm developing my programming language Symta first of all, and as of now it has barebone floating point support (i.e. no unboxed floats). Yet I still plan to integrate with Unity in the future, when the language becomes stable enough. Since I still use a few 3d effects, but software triangle rendering a bit slow, even on modern hardware.

TLDR: go with Unity.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 11, 2020, 03:22:09 am
Done implementing mine generator for now.
(https://i.imgur.com/M9zVJ5R.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Thermite on May 12, 2020, 12:09:05 am
If you don't want to use an engine, there is a high chance you won't achieve anything beside wasting time, and maybe learning a few basic OpenGL things. So I suggest you to use Unity, not Unreal or Cryengine, but Unity since it targets small teams and even single devs. With Unity you just import your assets and write gameplay code, instead of wasting man-years on all unimportant stuff. Moreover, OpenGL is slowly being pushed out by Vulkan, which is even harder to use, especially for newbies, and designed to be a part of an engine, maintained by a team professional graphics programmers.

I personally use SDL2, but that is because the game is 2d and I'm developing my programming language Symta first of all, and as of now it has barebone floating point support (i.e. no unboxed floats). Yet I still plan to integrate with Unity in the future, when the language becomes stable enough. Since I still use a few 3d effects, but software triangle rendering a bit slow, even on modern hardware.

TLDR: go with Unity.
I wanted to do something in the same graphical view as original XCom (a fixed POV with different layers causing the impression of depth), does Unity works well with 2d games?
Title: Re: XCOM Inspired Fantasy Game
Post by: Bobit on May 12, 2020, 04:51:14 am
I imagine an isometric view is pretty complicated graphics-wise and unity might not be the best for it. But google unity isometric tutorials and see what you get.

But on r/roguelikedev there's a strong consensus that you don't need complex graphical engines, depending on what your plans are.  Very simple input and output things like bearlibterminal are consistent and powerful (for ASCII games, not isometric). Most of the more complicated stuff needs to be implemented/tweaked yourself anyways.

Just don't try to make something as complex to design as XCOM.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 12, 2020, 11:52:20 am
I imagine an isometric view is pretty complicated graphics-wise and unity might not be the best for it. But google unity isometric tutorials and see what you get.

But on r/roguelikedev there's a strong consensus that you don't need complex graphical engines, depending on what your plans are.  Very simple input and output things like bearlibterminal are consistent and powerful (for ASCII games, not isometric). Most of the more complicated stuff needs to be implemented/tweaked yourself anyways.

Just don't try to make something as complex to design as XCOM.
Actually, Unity has this thing called hardware Z-buffer and each sprite texel will get a camera Z, which would solve your z-sorting problem without much effort (your will still need to set up a proper orthographic projection).

I don't use Z-buffer, but instead actually sort sprites by a specially crafted Z, and then apply seveal tricks, so larger sprites, like dragon, wont have wings clipping through the ceiling, and multicell sprites, like say a dinning table, would be correctly drawn before the items stand on top of them.

Similar method (but only with neighborhood sorting) was apparently used in Ultima 8, while Magic & Mayhem had some tricky hacks. As a rule of thumb, when isometric game has more than 1 z-layer, expect a lot of ugly hacks, unless you use actual 3d hardware.
Title: Re: XCOM Inspired Fantasy Game
Post by: Thermite on May 13, 2020, 12:03:02 am
Actually, Unity has this thing called hardware Z-buffer and each sprite texel will get a camera Z, which would solve your z-sorting problem without much effort (your will still need to set up a proper orthographic projection).

I don't use Z-buffer, but instead actually sort sprites by a specially crafted Z, and then apply seveal tricks, so larger sprites, like dragon, wont have wings clipping through the ceiling, and multicell sprites, like say a dinning table, would be correctly drawn before the items stand on top of them.

Similar method (but only with neighborhood sorting) was apparently used in Ultima 8, while Magic & Mayhem had some tricky hacks. As a rule of thumb, when isometric game has more than 1 z-layer, expect a lot of ugly hacks, unless you use actual 3d hardware.

So, to Tl;Dr; it: make a 3D game, with only one view point and a layering component, that it will work out better?
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 13, 2020, 11:02:32 pm
So, to Tl;Dr; it: make a 3D game, with only one view point and a layering component, that it will work out better?
Yes.

Consider the following ship sprite (taken from my game). In a proper z-buffered 3d engine importing the ship into the game is as simple as breaking it into elements, assign them proper Zs and just passing to the engine. But in the original XCOM or in say Magic & Mayhem, you will have to break this ship into cubes or similar boxes (together with complex geometry objects, like the rope ladders and the masts with sails). Obviously will still have to devise some way to hide occluding items, even with the true 3d objects. So most 3d strategy games (i.e. Starcraft 2) and RPGs are actually 2d, having just a single layer, to avoid the confusion. XCOM/Dwarf Fortress like games open a pandora box of problems.

(https://i.imgur.com/yoJWain.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 17, 2020, 03:32:55 am
Was looking for a way to import that ship without breaking it into cubes. There is actually a special algorithm to do that - hierarchical sprite sorting. Basically one has to produce occlusion forest graph, and then instead of calling qsort, just walk the forest from the roots. It works, but it is slower than qsort, since building the occlusion graph is a non-trivial task.

(https://i.imgur.com/kSljc2W.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 17, 2020, 09:01:35 pm
Researching further, most of the slow down was the result of empty spaces now now being part of the input for the occlusion algorithm. I'm sure there is a way to optimize the handling of the invisible cells, but it wont be easy.

In addition, any occlusion graph makes it easy to create circular dependency bugs, including rarely occurring ones. And then you will wonder where it happened. Especially nasty problems occur when one large multicell sprite resides on top of another, since there is a large loss of granularity. The obvious way of solve is automagically breaking large objects into isometric tiles.

That is why you use 3d engine even for 2d games.

(https://i.imgur.com/z41TLyn.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on May 17, 2020, 09:06:18 pm
Or store accurate depths of each pixel in graphic and final surface. With this draw order will not matter but each pixel daw will take more time.
At some point I will try implementing something like that.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 17, 2020, 09:14:47 pm
Or store accurate depths of each pixel in graphic and final surface. With this draw order will not matter but each pixel daw will take more time.
At some point I will try implementing something like that.
That is called Z-buffer. A thing 3d hardware implements very efficiently.

But in case of tile-based isometric game with oversized sprites, you want to be very careful with Z-Buffer, so objects wont clip through walls. I.e. you want to render your giant units with Z-test turned off, just like you render HUD in FPS games to avoid it clashing with objects on screen. Then there are also transparent surfaces, which still require tricky sorting. Unless you do physically based rendering, where actual light rays travel the scene.

Although games like Warcraft III turned the clipping bug into a feature, providing buildings with foundation, that can be unearthed on uneven terrain.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 17, 2020, 11:37:53 pm
Ok. With some debugging I managed to avoid the circular dependencies (resulting in the locked-in areas not drawn), while still maintaining proper parts breakage. I.e. moving cursor behind the ship will hide its back revealing units behind it. Still a few draw order bugs, which can be easily fixed. Since the algorithm is slow, I will use it only for several special hand crafted areas, like ship boarding and boss battle arenas. At least until I find a way to optimize it.
(https://i.imgur.com/MzFNFZm.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on May 18, 2020, 01:31:34 am
That is called Z-buffer. A thing 3d hardware implements very efficiently.

But in case of tile-based isometric game with oversized sprites, you want to be very careful with Z-Buffer, so objects wont clip through walls. I.e. you want to render your giant units with Z-test turned off, just like you render HUD in FPS games to avoid it clashing with objects on screen. Then there are also transparent surfaces, which still require tricky sorting. Unless you do physically based rendering, where actual light rays travel the scene.

Although games like Warcraft III turned the clipping bug into a feature, providing buildings with foundation, that can be unearthed on uneven terrain.
This is correct, if done poorly then big objects will be problem, but if we use tiles then on load we can check if any pixel do not "escape" 3d box where it should be.
Then if it clip then it should clip, this WC3 example is why I think this is very good function why try use this approach. In some special cases I would like if unit clip through other objects. Water, high grass, mud, waterfall, ivy, bushes. magic portals etc.

Transparency is indeed problem, but I think of work around. Instead of multiplicative transparency use additive, with it order in each surface is draw will be irrelevant. First you will draw all not transparent objects, after this transparent.

To have reasonable speed this will probably require manual use of see4 intrinsic because compilers sometimes miss some transformations (same OXCE code have 3x time speed difference based on different GCC version).
Title: Re: XCOM Inspired Fantasy Game
Post by: Thermite on May 18, 2020, 03:57:05 am
Yes.

Consider the following ship sprite (taken from my game). In a proper z-buffered 3d engine importing the ship into the game is as simple as breaking it into elements, assign them proper Zs and just passing to the engine. But in the original XCOM or in say Magic & Mayhem, you will have to break this ship into cubes or similar boxes (together with complex geometry objects, like the rope ladders and the masts with sails). Obviously will still have to devise some way to hide occluding items, even with the true 3d objects. So most 3d strategy games (i.e. Starcraft 2) and RPGs are actually 2d, having just a single layer, to avoid the confusion. XCOM/Dwarf Fortress like games open a pandora box of problems.

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

Time to learn Blender then...
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 18, 2020, 01:23:05 pm
Time to learn Blender then...
Yeah. Blender or other 3d package can help. You can model even 2d scenes in it, and then export them as a set of objects for your ingame use. But I wont recommend Blender to newbies. It has a rather clunky, cryptic and generally unfriendly UI, mostly relaying on obscure hotkeys. No way you can learn it quickly and make something in a few days. 3ds Max is lot easier if you have access to it. But a room-mate artist where I live uses Cinema 4d, but I heard it is geared more towards TV and Movies, while 3ds Max and Maya were initially developed for gamedev people.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 19, 2020, 10:11:59 am
A gameplay question still remains: should these ships sustain damage from stuff like fire? How would it be implemented?

Basically that is just a scene which occurs when one squad with a boat attack another squad with a boat on sea. Now what if one party gets its boat destroyed or heavily damaged? As of now the boat inside the squad is just a usual unit, with damage meter, which is unused. XCOM games treated vehicles as a special entities. Especially XCOM Apocalypse. But it still had no way to damage them outside of air combat. Although in Apocalypse there was indeed map damage, resulting penalties for player and incentivizing scaling down the destruction, which was like fun police, but it still happened.


There are also flying boats, but the mechanics would be similar, with the exception of clouds replacing the water around the boats.

(https://i.imgur.com/VjJQH6V.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on May 20, 2020, 02:41:08 pm
That depends on whether you want to get into a complex vehicle system, where different subsystems (sails, rudder etc.) have some impact on the whole unit's performance, which is obvious if they get damaged. I think it would be very fun, but I'm not sure if it fits your general vision and plans.

And of course, a hole in the hull would fill the ship with water until it sinks. :) Countered by the crew using buckets and long-term by repairs.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 20, 2020, 03:54:57 pm
That depends on whether you want to get into a complex vehicle system, where different subsystems (sails, rudder etc.) have some impact on the whole unit's performance, which is obvious if they get damaged. I think it would be very fun, but I'm not sure if it fits your general vision and plans.

And of course, a hole in the hull would fill the ship with water until it sinks. :) Countered by the crew using buckets and long-term by repairs.

I will likely leave it for a post-release update, like say a pirate campaign. For now I have to balance just the basic game and do bug fixes. Then it will be easier just adding fitting parts to fill in the niche.

I.e. just adding these ships required a lot of modifications to the drawing algorithm and occlusion hiding algorithms. Ships masts had to be moved into separate class of objects, that always get "folded" to unobscure units behind them, when player moves cursor. Trees are handled differently. I.e. they don't disappear when cursor is on a cliff above them, only when it moves inside forest.

Original XCOM games handled it very differently, requiring player to manually switch layers. It worker well, but was a bit clunky and dated. Probably the worst part of the original games. Magic & Mayhem had just two layers: land and roof. And most of the time all trees were hidden, just like in XCOM where trees had only trunks visible most of the time. Beside being ugly visually and ruining the whole scene look, it also made it very hard to deal with floating aliens or aliens on higher layers, since player was bound to a single layer.

Now adding ships as separate vehicles could overly complicate the game for players. IIRC, most players had problems loading troops and items on the ship in the original XCOM game. That was a rather clunky part of the game. OpenXCOM modded it a bit, allowing to pre-equip items, but people still forget to load the operatives onto the aircraft, and then find themselves on a mission with a single squaddie.
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on May 20, 2020, 04:00:14 pm
Let me just say that I 100% love the manually switchable Z layers. They are both functional and aesthetically pleasing. Terrain features getting transparent look meh and are not very comfortable to understand where things are, especially in a terrain heavy game like X-Com.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 20, 2020, 08:26:02 pm
Let me just say that I 100% love the manually switchable Z layers. They are both functional and aesthetically pleasing. Terrain features getting transparent look meh and are not very comfortable to understand where things are, especially in a terrain heavy game like X-Com.
Well, in my case, there are like 64 layers (XCOM has just 4, and 9 in Apocalypse), and typical human unit is 2 layers tall. It would be incredible confusing to expose the layer system. Already in Dwarf Fortress layers are a nightmare, and I'm surprised authors decided to keep them for the commercial version.

So I've put a lot of effort to solve the problem with a large set of hacks. I don't make sprites transparent, I just cut their upper half, since transparency wont solve it.

BTW, Apocalypse had one interesting feature - units jumping over holes (that is before Quake 3 and Unreal bots, and still the only one RTS game with such feature):

Now I think resized to youtube wide screen the game looks more stylish, as opposed to the normal isometry, and the units are a bit fatter and easier to notice. And some people suggested modding Apoc to use XCOM1 pixelart graphics: https://www.deviantart.com/makus82/art/PSD-Aliens-Sprites-from-XCom-1-in-XCom-Apocalypse-804133851
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on May 20, 2020, 10:29:19 pm
Well, in my case, there are like 64 layers (XCOM has just 4, and 9 in Apocalypse), and typical human unit is 2 layers tall. It would be incredible confusing to expose the layer system.

Well, that's a different story then. :)

Already in Dwarf Fortress layers are a nightmare, and I'm surprised authors decided to keep them for the commercial version.

Why not? I have many complaints about DF, but layers? What's wrong with the layers? They're perfectly fine. What's so nightmarish about them? I can't think of a better solution.

Rimworld did away with these, and it's pretty much my only gripe with this game.

So I've put a lot of effort to solve the problem with a large set of hacks. I don't make sprites transparent, I just cut their upper half, since transparency wont solve it.

That actually sounds better. :)
Title: Re: XCOM Inspired Fantasy Game
Post by: Bobit on May 20, 2020, 11:10:51 pm
Non-isometric layers as in DF are difficult to see. Isometric layers with non-rotating camera as in X-COM is fine until someone walks behind an object. Isometric with rotating camera is perfect and what every high-budget game in the genre uses. See X@COM for an example of what non-isometric layers in an XCOM-like would look like. It's not a huge deal but it's less playable.
Title: Re: XCOM Inspired Fantasy Game
Post by: Rubber Cannonball on May 20, 2020, 11:45:04 pm
Let me just say that I 100% love the manually switchable Z layers. They are both functional and aesthetically pleasing. Terrain features getting transparent look meh and are not very comfortable to understand where things are, especially in a terrain heavy game like X-Com.

Well, in my case, there are like 64 layers (XCOM has just 4, and 9 in Apocalypse), and typical human unit is 2 layers tall. It would be incredible confusing to expose the layer system.

I agree with Solarius.  In original Diablo it was a pain to see objects through terrain transparency.  And sometimes the terrain didn't go transparent when I wanted it to.  As the player, I had no recourse if the game chose not to make occluding terrain transparent.  The layer view in Openxcom is really just a cross section view shown at an isometric view angle.  Using the mouse wheel in Openxcom to quickly scroll through the layers when needed is very convenient and not too taxing on the player.  Multi-level view (Openxcom's name for the view, it's really just a 3D isometric view) could be the default mode to show all the scenery.  Actually clicking the mouse wheel button could toggle between multi-level and cross section views.  In a fixed view angle game like Openxcom, giving the player the ability to control cross section views is both important and sufficient.  Otherwise, there will times when the player will want to see an occluded yet visible area of the map (such as the ship's deck occluded by the sails) even if nothing important is there but the game prevents it.  I have yet to see a program that tries to guess what I want to do and tries to do it for me that I don't end up fighting with when I don't like its choices.

Some games avoided occlusion problems by preventing anything from being in or traversing the occluded area.   I generally dislike this approach as it ruins immersion for me.  Diablo 2 does this quite a bit but not everywhere.  It also uses transparency and fixed cross sections.

If you have ever done drafting or fabricated parts from detail drawings or blueprints, you'll likely understand my point of view even if you disagree with it.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 21, 2020, 10:10:40 pm
Isometric with rotating camera is perfect and what every high-budget game in the genre uses.
One can implement rotation even in a 2d isometric engine. IIRC Stronghold had it. You just need a rotated version of each sprite, and there will be additional 3 views, each different by 90 degrees. These would solve most of "that unit got behind that hill" problems, but wont help with a unit inside the forest. I haven't implemented the general rotation as of now (since many objects, like the ship above, don't have all angles present), but there is a site part rotation, for premade parts, during site generation. Original XCOMs had no rotation for the same reason - some parts are missing. But I really dislike the collection of stumps forests.

BTW, if you have hexagonal tiles, you can 6 angles of rotation, instead of just 4 in square based tiles. Still puzzles me why only hexagons and squares produce perfect tesselations of a 2d plane, but as they say one person's square is another person's hexagon: https://en.wikipedia.org/wiki/Wigner%E2%80%93Seitz_cell

(https://i.imgur.com/xS2RfVy.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on May 21, 2020, 11:17:25 pm
Code: [Select]
You just need a rotated version of each sprite, and there will be additional 3 views, each different by 90 degrees.At first glance this is disadvantage, because you need do 4 times more work than normally, but there is trick, each tile can have its own rotation, this mean if you see 4 same item each can facing different direction, this mean every version can be used even if player do not rotate map, even once.
Title: Re: XCOM Inspired Fantasy Game
Post by: Rubber Cannonball on May 22, 2020, 02:22:27 am
Still puzzles me why only hexagons and squares produce perfect tesselations of a 2d plane, but as they say one person's square is another person's hexagon: https://en.wikipedia.org/wiki/Wigner%E2%80%93Seitz_cell

Equilateral triangles work if you allow for half of them to be rotated 180 degrees.  I'm not familiar with any computer game that uses them, but there are some board games that use them IIRC.  They end up being similar to the hexagons since a hexagon can be made with 6 equilateral triangles
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 22, 2020, 10:24:08 am
Code: [Select]
You just need a rotated version of each sprite, and there will be additional 3 views, each different by 90 degrees.At first glance this is disadvantage, because you need do 4 times more work than normally, but there is trick, each tile can have its own rotation, this mean if you see 4 same item each can facing different direction, this mean every version can be used even if player do not rotate map, even once.
Not really 4-times, you can mirror isometric sprites, and many sprites already have 180-rotated versions, while say trees can be reused for all directions, since they are nearly round. But rotating some locations (like that ship in TFTD) would indeed require supplying additional tiles.

Equilateral triangles work if you allow for half of them to be rotated 180 degrees.  I'm not familiar with any computer game that uses them, but there are some board games that use them IIRC.  They end up being similar to the hexagons since a hexagon can be made with 6 equilateral triangles
That wont be uniform and will create a lot of problems processing such structure. Even hexes are much trickier than squares.
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on May 22, 2020, 11:58:27 am
The problem with rotation is that you need to have 4 walls, not just 2 like X-Com does...
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 22, 2020, 09:11:06 pm
The problem with rotation is that you need to have 4 walls, not just 2 like X-Com does...
Yeah. In case of OXC you will have to swap walls between the map cells. That is tricky, but possible.

2d Sim City games also had map rotation, but the Sims haven't got it. Although the Sims had 2-layer buildings and some tricky occlusion code to expose buildings interiors properly. The Sims also had stairs object.

As a side note, there was a crazy Warcraft 2 clone RTS, which had building interiors (with removable roof) as a gimmick:

Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 28, 2020, 07:09:08 pm
Guess the thread is a bit difficulty to follow and it all may look a bit confusing. But what I'm trying to do is to merge a Civ-type game with XCOM. In a fantasy setting. In the current state I have finished the battlescape (on-site) engine, and the geoscape (the world) engine, complete with all mechanics. Now I'm doing unit balancing, trying to give each of the many units some unique role. After it gets done, I will do a campaign encompassing several random generated world maps, each with different goals.

Compared to XCOM, battles are expected to be completed faster, and there is no save in the battle. The only opportunity to save would be on the world map. But I will try to prevent save scumming. Still I guess people could save-scum anyway, running in the emulator. But at least I could use the PRNG to prevent reloading to achieve different result. I.e. all sites are pre-determined on the world generation, so there will be no way to reload the game until it spawns the type of monsters which can be easily defeated by the player's current army. Same with AI, which uses pre-seeded RNG, so reloading wont affect AI's behavior. IIRC, Heroes of Might & Magic IV determined when player reloaded the game to save scum some chests with random content and locked-up the PRGN, although that could have been a glitch. But I believe the error was determining the chest content on the pickup stages, instead of at its generation time.

BTW, there was a somewhat successful merge of Civ and Warhammer as part of the Total War franchise. In fact, they even remade the original Warhammer Dark Omen campaign in the Total War engine. Earlier there was even a mix between Doom and Civilization - in the Sierra's Birthright game, which had Warhammer style army battles (dumbed down of course), but also site exploration part, looking like Doom and using a rather complex raycasting (?) engine for it.

Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on May 28, 2020, 07:45:18 pm
Compared to XCOM, battles are expected to be completed faster, and there is no save in the battle. The only opportunity to save would be on the world map. But I will try to prevent save scumming. Still I guess people could save-scum anyway, running in the emulator. But at least I could use the PRNG to prevent reloading to achieve different result. I.e. all sites are pre-determined on the world generation, so there will be no way to reload the game until it spawns the type of monsters which can be easily defeated by the player's current army. Same with AI, which uses pre-seeded RNG, so reloading wont affect AI's behavior. IIRC, Heroes of Might & Magic IV determined when player reloaded the game to save scum some chests with random content and locked-up the PRGN, although that could have been a glitch. But I believe the error was determining the chest content on the pickup stages, instead of at its generation time.

But you in reality replace one save-scum with another. Now player can scout in ineffective way losing most of int units, checking what he can grain, then he reload and only do things in effective way, skipping all fights that do not give any benefits.
Another problem is "groundhog-day" where you can predict events in future.

I think maybe better system would be hybrid one, you precalculate 20 rolls ahead, and you store them in save. This mean couple of roll after reload will give same results but after som time you will have diffident outcomes.

Of corse this system could explored too, you can still reroll chest but it would need reload and doing lot of actions to exhaust all random buffer and try again.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 29, 2020, 08:01:08 pm
But you in reality replace one save-scum with another. Now player can scout in ineffective way losing most of int units, checking what he can grain, then he reload and only do things in effective way, skipping all fights that do not give any benefits.
Another problem is "groundhog-day" where you can predict events in future.

I think maybe better system would be hybrid one, you precalculate 20 rolls ahead, and you store them in save. This mean couple of roll after reload will give same results but after som time you will have diffident outcomes.

Of corse this system could explored too, you can still reroll chest but it would need reload and doing lot of actions to exhaust all random buffer and try again.

Since saving/loading obviously has in-game economic value, it would make sense to require player spending some resources to save the progress. Similarly to how Tomb Raider games used save crystals. In a fantasy strategy game setting, saving the game can be represented as a visit to Oracle, who takes money to predict future. Now usual supply/demand rules apply to the save-game economy. And suddenly you have save-system which work even in multiplayer games. In fact, both sides can agree on saving the game at some point and pay agreed price for that. Then any of the participating players could invoke the save. Obviously that would need to be somehow integrated with the diplomacy system.

Same way I plan to implement battlescape saves as a time travel spell, which would work even in multiplayer.


Currently I'm still struggling with getting the time system itself correctly. Original XCOM had only geoscape time, while battlescape was almost disconnected from the geoscape time-wise, with the only exception being night/day battles. And night missions were a special kind of nightmare, since aliens all had night vision. Now I want to connect the battlescape time with geoscape. Each Action Point squad spends on the world map this day will be subtracted from the time available on the battlescape, if squad enters the site exploration stage today. If the battlescape time runs out, then visitor will be forced to retreat unconditionally, losing any units surrounded by the enemy. Obviously battlescape time amount should be generous enough. Say 100 or 200 turns per day, but still encourage having some reserve time. Now time travel spell will not only help with the exploration, but will also unwind the time. The only catch is that the unit performing the time travel should survive.

The remaining questions is about making it possible to travel into the future from the past. That is always harder, since future is less known than the past. Or is it? Guess physicists will correct me that future is more stable and predictable than the past ( https://www.sciencealert.com/three-black-holes-orbiting-each-other-can-t-always-go-backwards-in-time ), since the future is still there, while the past has already dissipated, leaving a few fossils at best ( https://www.space.com/tunguska-meteor-impact-explained.html ).
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on May 30, 2020, 12:25:12 am
Since saving/loading obviously has in-game economic value, it would make sense to require player spending some resources to save the progress. Similarly to how Tomb Raider games used save crystals. In a fantasy strategy game setting, saving the game can be represented as a visit to Oracle, who takes money to predict future. Now usual supply/demand rules apply to the save-game economy. And suddenly you have save-system which work even in multiplayer games. In fact, both sides can agree on saving the game at some point and pay agreed price for that. Then any of the participating players could invoke the save. Obviously that would need to be somehow integrated with the diplomacy system.

Same way I plan to implement battlescape saves as a time travel spell, which would work even in multiplayer.

If save is not free thing, then my exploit will not work, but how you will handle "load"? We have save 10 turns before, one wining player do not want to go back but losing player do not want.
If we go time  travel spell way then could we lose resources in past too? Some thing like that:
You start with X+Y of some resource you need.
To save game you spend X, You left with Y.
Couple of turns pass. You grain Z resources.
You load game spending Y+Z
Save is modified and remove Y from your resources. Continue game.
Couple of turns pass. You grain Z resources.
You can't load game because you have only Z.

This mean if you have enough resources you can multiple times force "time travel" but each time you will have less power to revert bad future.


Currently I'm still struggling with getting the time system itself correctly. Original XCOM had only geoscape time, while battlescape was almost disconnected from the geoscape time-wise, with the only exception being night/day battles. And night missions were a special kind of nightmare, since aliens all had night vision. Now I want to connect the battlescape time with geoscape. Each Action Point squad spends on the world map this day will be subtracted from the time available on the battlescape, if squad enters the site exploration stage today. If the battlescape time runs out, then visitor will be forced to retreat unconditionally, losing any units surrounded by the enemy. Obviously battlescape time amount should be generous enough. Say 100 or 200 turns per day, but still encourage having some reserve time. Now time travel spell will not only help with the exploration, but will also unwind the time. The only catch is that the unit performing the time travel should survive.

The remaining questions is about making it possible to travel into the future from the past. That is always harder, since future is less known than the past. Or is it? Guess physicists will correct me that future is more stable and predictable than the past ( https://www.sciencealert.com/three-black-holes-orbiting-each-other-can-t-always-go-backwards-in-time ), since the future is still there, while the past has already dissipated, leaving a few fossils at best ( https://www.space.com/tunguska-meteor-impact-explained.html ).
I don't think, result of this 3 body problem mean that you can't know what future is exactly because you need know current state better than physic laws allow.
Aside you need consider wavefunction collapse too, where result is unpredictable, and this even is very small can have big consequences. One simple example is that someone decide to nuke moon out the sky (IF we not nuke self out of earth), and all this need only one button press than is triggered by one neuron.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 30, 2020, 03:07:32 am
If save is not free thing, then my exploit will not work, but how you will handle "load"? We have save 10 turns before, one wining player do not want to go back but losing player do not want.
If we go time  travel spell way then could we lose resources in past too? Some thing like that:
You start with X+Y of some resource you need.
To save game you spend X, You left with Y.
Couple of turns pass. You grain Z resources.
You load game spending Y+Z
Save is modified and remove Y from your resources. Continue game.
Couple of turns pass. You grain Z resources.
You can't load game because you have only Z.
Given that backstory for save/load is the Oracle's prophecy, no transfer of resources backwards in time will be possible.
I.e. player just gains the knowledge of the future.
On the battlescape the load is the actual time travel, but it moves in time only the caster, who actually spends reagents to both set the anchor, and to return back to said anchor.

Alternative is making time-travel anchors differ in power of what they can bring back from the future. That way players can be allowed to bring back items from the future, without breaking the current balance too much. I guess one can implement moving even the whole chunks of the game world between saves with such power-based anchors.

Next one can think about integrating that with some story elements, requiring to actually perform time travel. When some temporal state in the past requires an item from the future to unlock the game progress. But that is a completely different story, requiring different level of balancing to be non-boring.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on May 30, 2020, 03:29:46 am
Maybe I do not say this clearly, you do not transfer any resources, you "spend" your old resources when you go back in time, each time you return you have less of them.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 31, 2020, 10:51:43 pm
Maybe I do not say this clearly, you do not transfer any resources, you "spend" your old resources when you go back in time, each time you return you have less of them.
You mean that instead of immediately spending say a tomb raider like save crystal immediately, the save crystal gets locked, and spent on load, but player could instead unlock it and set a new check point, so save crystals would serve more like checkpointed lives in arcade games? What would happen if player exists the game? The locked crystal will be turned into actual save game?

That would be an interesting idea to allow saves in say Mario games, but requiring spending a life.

For those who don't know, a few old console games implemented save scumming prevention method, making saves a resource. Tomb Raider is the most know example https://www.wikiraider.com/index.php/Save_Crystal

Although I don't remember them being used as actual "lives", just a way to set a checkpoint.

The practice was apparently abandoned, since game designers believe it annoys players greatly.
So modern game design instead focuses on avoiding explicit saves at all.

Anyway, at PJ forums there is a person making a tactics game:
http://pixeljoint.com/forum/forum_posts.asp?TID=26879

His game has a rather uncommon projection, instead of the usual isometry. Such projection stills allows for a 3d world, but with d-pad controls, where pressing up-arrow would move cursor upward. It is also a bit easier to render, than isometry. Especially if you're doing only simple maps, like that dev. You can also get away with only a single sprite direction (at least for movement). Sprites are easier to draw too. But it has a drawback: that squashed side gets less detail. If there is say a passage inside cliff, it will be harder to notice. Here I have remade his map in my engine for comparison:
(https://i.imgur.com/y9pPzDP.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on June 01, 2020, 03:29:08 am
You mean that instead of immediately spending say a tomb raider like save crystal immediately, the save crystal gets locked, and spent on load, but player could instead unlock it and set a new check point, so save crystals would serve more like checkpointed lives in arcade games? What would happen if player exists the game? The locked crystal will be turned into actual save game?
I do not think that additional crystals should be locked in any way, you can use them for any other use, but when you reload you do not have them any more.
Image you have 4*X+Y crystals, to set check point you need have X+Y but X is spend only when you use it.
If you try 4 times get back, then 5th time will be impossible.

This system have great advantage that in multiplayer two player could try spam "go back" and game at some point will continue anyway, weaker player cannot stop game by reloading game infinite times. This could be even 3D-Chess move when you force your opponent to reload to and then you attack him using him right after return because he now have less crystals than before.


When you save game then each save point is saved too, reloading main save should not affect "in game save".


btw I think each save should have hash similar to git commits, all state is used to calculate it, and this will allow sync between multiplayer players.
Even if one player host game, everyone else know in what exactly state it should be. This will prevent cheats too, because everyone can recalculate state and see if it allowed move. Each action send to each player will look like:

NewHash: 3232323232332
Action: Move
UnitId: 42
Pos: 13, 23

And if you change state but game state is different then you miss some moves or person on other side cheat.
This could in theory allow hiding some information as if move is hidden you send only, new hash of new state.
And after finish game you need publish log of you actions, and everyone can verify if you do not cheat.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on June 01, 2020, 07:49:52 pm
I do not think that additional crystals should be locked in any way, you can use them for any other use, but when you reload you do not have them any more.
That can be useful in multiplayer, but you will still have unlimited number of saves, and it will be just the usual save scumming.
Checkpoint offers a huge advantage. In XCOM it could mean preventing your whole squad being wiped out by a single grenade.
That usually happens only once in a mission, and due to bad planning on the players side, like putting all units together without any cover.

Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on June 07, 2020, 02:31:01 pm
As of now, I'm fixing a lot of bugs and usability issues. Like when a non-humanoid, like griffin, tries to open door, player gets warned that only humanoids can open doors. Non humanoids will have to bash them out. It is unlikely I will be able to finish the game in the remaining time or that it will matter at all.

It seems I got only a few month in Ukraine, since the Kyiv court has upheld the migration service decision to deport me back to Russia. Now it is the higher appeal court, which no doubt will agree with the lower court decision. Ukraine believes that I had no right to protest against Russia and that I must speak Russian language and defend myself in the Russian court. Ukraine still has these old soviet fascist officers in there, and they openly scolded me for being a traitor, telling nonsense about "nobody likes traitors". I haven't pledged any loyalty to anyone, haven't signed any contract and Russia didn't gave me anything of value to me, therefore I'm not a traitor and have no obligation to be loyal.

If I'm lucky I can probably escape further into EU, but neo-Nazis are preparing something like a power grab in Europe (similar to Trump's one), while Russia helps them by training the terrorists. A cabal of dictators from the older elites already seized power at several EU countries. There is a even that Mussolini's granddaughter among them. Soon Europe will get concentration camps for all undesirables, and these will likely turn into death camps. States can change very quickly, if one recalls the pre-fundamentalist Iran or the Weimar Germany.

Trump's administration is already puzzled about what to do with the interned immigrants, and it is impossible to return millions of people all back to their countries of origin. If Trump wont back out, these camps will be turned into death camps. So applying today for a political asylum in US is a really bad idea, since you can get gassed together with the rest of Latinos. Of course US has these cute protests, but they are unlikely to change anything, since people are insecure, full of resentment and violence. America is not the country of freedom anymore.

I can try applying at China, but it is totalitarian and never approves any asylums, even to its own agents, like Snowden, referencing them to Russia instead.

Today there is nowhere to run. Maybe the best I can do, is trying to hop back over the Russian border and do some sabotage there? But what can I do strategically important there? At best I can only manage to blow up the gas pipeline. That will result in a few millions USD in damages to the Russian government, to the people who have many billions USD. Is there a way one can do billions in damages to Russia? Do something that will matter in the end?
Title: Re: XCOM Inspired Fantasy Game
Post by: Rubber Cannonball on June 08, 2020, 11:00:03 pm
Sorry to hear about your situation, but I don't think your last post helps you at all.  No country wants more refugees right now especially with covid 19 going around.  Also they really don't want troublemakers running around freely inside their borders.  Not saying you are, but your post gives that impression.  As for China, they want to improve their technology and become the world's technology leader.  You seem to have some skills that they might be interested in.  All things considered I doubt it matters much whether one is a traitor or not, but it matters a great deal if those around him believe he is a traitor.  Countries will take in even hated enemies if they have a use for them.  Just look at the former Nazi German V-2 rocket program people.  Both the Soviet Union and the United States grabbed as many of these people as they could to work on their ballistic missile and space rocketry programs.  Those former Germans had a big hand in putting the first satellites and people in space and even on the moon.

Even if one were a master assassin and could cut the heads off the snakes, there is no shortage of bad people just waiting for their chance to grab the reins of power.  As for mattering in the end, influence the youth as one day they will be running things.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on June 09, 2020, 11:40:39 am
You seem to have some skills that they might be interested in.  All things considered I doubt it matters much whether one is a traitor or not, but it matters a great deal if those around him believe he is a traitor.  Countries will take in even hated enemies if they have a use for them.  Just look at the former Nazi German V-2 rocket program people.  Both the Soviet Union and the United States grabbed as many of these people as they could to work on their ballistic missile and space rocketry programs.  Those former Germans had a big hand in putting the first satellites and people in space and even on the moon.

V-2 rocket gave enormous strategic advantage and combined nicely with the nuclear payload. No wonder both sides raced to recreate and improve it. In fact, both Russian and US space programs began as part of ICBM development. While I am, well, not a rockets scientist and don't really have even a BSc degree in any field. I haven't even completed the elementary school. Otherwise I would have just applied for a work visa and left Russia, and left it without much fuzz.

Back in Russia I wanted to get a degree in biology, but got expelled from the evening school after complaining that all walls there have posters with Putin, his ruling party propaganda, and that they don't teach anything beside history. The school had like 3 hours of history for 1 hour of STEM. That left me no other option but to go into conflict. That would be like America having the currently ruling president portrait in each classroom for 20 years in a row! As well as various agitation material. The government funded evening school also had a mandatory Russian Orthodox Church education, where clerics from the local temple lectured people about the government being the extension of God's will. Disregarding the kids belonging to different denominations or being non-religious.

Russian history education is not something you have to research and interpret for yourself. No. To pass the exams you must rote memorize the "facts" they tell you. If you question these facts, you will get in trouble. I.e. teacher states "WW2 started because of X", but you say "no, WW2 started because of Y." Now in response you will likely hear something like "leave the classroom now." Obviously Russian history tries to downplay the USSR role helping Hitler to raise into power and starting the war. And if you refuse to play their game, then you're a troublemaker.

Then I got fired from the job after refusing to write C++ code comments and documentation in the Russian language. I haven't seen any reason to use Russian, since all programmers know English anyway, and it would even be convenient for the company to avoid locking itself into hiring only the speakers of some single language. But the company was a Russian military contractor and they had to follow the government rules, including the conformance to the government standards, which stated even the source code comments language. While I feel that the single world's language must be the English language. But such stance obviously gets one into trouble with the local authorities. Especially since Russian elites believes that English language, as the international language, is harmful to the Russian culture, the nation and their personal security.

Common Russians are also very defensive about their language and culture. Some Russians believe the international language should be their Russian language. They feel resentment losing the cultural war to English, even if English is much simpler than Russian, and its less synthetic nature allows stating scientific and contractual details more clearly. The loss to English was inevitable. And in the end all that matters is that we have a good common language, that has a large body of information available in it. That can't be said about Esperanto or about Russian. Of course English is not perfect, but nothing is perfect - everything has trade offs. And sticking to the national language the government places itself and its citizens at a heavy disadvantage. Since today the local knowledge of English is the part of mandatory infrastructure, just like the roads and the internet cable. It has to be there if the government wants to attract or produce skilled people. The government has to process documents in English.

Anyway, currently I'm implementing various minor details, like the rotating crown overlay sprite for leader units. Dunno if that metaphor is good enough. Usually the on site activity requires to eliminate the opposing leaders, while preserving your own leaders. Losing all leaders is a game over. Losing the single leaders means the loss of gold, which is evenly divided among all leaders. That gold is not dropped to avoid giving winning player the enormous advantage. Such mechanics solves numerous problems: one being the boring "hunt that last alien part", since the player has to kill only that bandit leader, and there is absolutely no reward to waste time on grinding all the guarding mobs. As a side effect introduces the concept of "lives" - each leader is a basically a single life. A squad can have several leaders, but must have at least one. In fact, any unit can be promoted into leader with the upfront payment and the daily upkeep. Non-leader units don't have daily upkeep, but paid per battle (similarly to these old Mindscape Warhammer games). So player is incentivized to use as little units as possible, while having several leaders for a backup.

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

All that is a bit tricky, since it is not immediately obvious how to balance such a system. How much leader promotion should cost? Etc... And I will probably disable the ability to turn animals into leaders. It is a bit strange when a squad of knights is being led by a bat. But then again, a pack of wolves indeed has a leader. Then I also want allow players to start without initial cities, like in King's Bounty and Lords of Magic. That could be useful for a few less epic scenarios. So the upkeep for leaders should not be enormous, or it can even be proportional to the kingdoms income. I.e. the officer is some rich kingdom would obviously demand higher profit share, especially when life threatening risks are involved. Now a small rogue party will have smaller expectations. Same way currently the max loan temple gives to player is bound to players income. That is also the end game mechanics, since temple is one of the last structures city builds, and loans allow for exponential growth. Cities have no banks, but in the old times priests did banking, so it should be fine. Or not?
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on June 09, 2020, 09:49:27 pm
Back in Russia I wanted to get a degree in biology, but got expelled from the evening school after complaining that all walls there have posters with Putin, his ruling party propaganda, and that they don't teach anything beside history. The school had like 3 hours of history for 1 hour of STEM. That left me no other option but to go into conflict. That would be like America having the currently ruling president portrait in each classroom for 20 years in a row! As well as various agitation material. The government funded evening school also had a mandatory Russian Orthodox Church education, where clerics from the local temple lectured people about the government being the extension of God's will. Disregarding the kids belonging to different denominations or being non-religious.

Russian history education is not something you have to research and interpret for yourself. No. To pass the exams you must rote memorize the "facts" they tell you. If you question these facts, you will get in trouble. I.e. teacher states "WW2 started because of X", but you say "no, WW2 started because of Y." Now in response you will likely hear something like "leave the classroom now." Obviously Russian history tries to downplay the USSR role helping Hitler to raise into power and starting the war. And if you refuse to play their game, then you're a troublemaker.

Then I got fired from the job after refusing to write C++ code comments and documentation in the Russian language. I haven't seen any reason to use Russian, since all programmers know English anyway, and it would even be convenient for the company to avoid locking itself into hiring only the speakers of some single language. But the company was a Russian military contractor and they had to follow the government rules, including the conformance to the government standards, which stated even the source code comments language. While I feel that the single world's language must be the English language. But such stance obviously gets one into trouble with the local authorities. Especially since Russian elites believes that English language, as the international language, is harmful to the Russian culture, the nation and their personal security.
First complaining about Putin posters is bit pointless, even if they agree with you this would not change fact that Putin is President-For-Life.

Second going openly against "history propaganda officer" is again pointless, what you or other grain form this? If you want fight they propaganda then expect they will fight against you too. If you do not like results you should not do it or not do it openly and if you did that 40 years ago you would be already in gulag.
Beside what nation do not teach "facts" about is history? Even west can criminalize some historical opinions if they fall too far from main one.
And btw I think USSR is responsible for WW2 (without they "help" Poland would fight far longer that it did).

Third refusing to use Russian in comments is stupid, I understand other Poles that refuse to use Russian or German during Partitions of Poland, but this?
Someone take your books and force you to learn new language? If you are fine to work for military contractor then you should be fine to write comments in Russian. Simply if you work for someone you should follow they demands, if you do not think your employer is moral you should not work for him at all.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on June 10, 2020, 02:17:10 pm
First complaining about Putin posters is bit pointless, even if they agree with you this would not change fact that Putin is President-For-Life.

Second going openly against "history propaganda officer" is again pointless, what you or other grain form this? If you want fight they propaganda then expect they will fight against you too. If you do not like results you should not do it or not do it openly and if you did that 40 years ago you would be already in gulag.
Beside what nation do not teach "facts" about is history? Even west can criminalize some historical opinions if they fall too far from main one.
And btw I think USSR is responsible for WW2 (without they "help" Poland would fight far longer that it did).

Third refusing to use Russian in comments is stupid, I understand other Poles that refuse to use Russian or German during Partitions of Poland, but this?
Someone take your books and force you to learn new language? If you are fine to work for military contractor then you should be fine to write comments in Russian. Simply if you work for someone you should follow they demands, if you do not think your employer is moral you should not work for him at all.
There were not many other jobs in the city of Serpukhov, which traditionally produced equipment for the Soviet submarines. And the company I worked for has spun-off from the Ratep military factory. In fact all jobs in Russia are either in the military or in the gas/oil sector. I've also worked at the mass spam company, but since IT got weaponized, their services were used not for ads, but for the blatant propaganda spam.

Had I not bribed some officials to escape, I would have already got 10 or more years in jail or a nuthouse (they believe it is insanity when a citizen of Russia refuses to speak Russian out of the spite). There are several crime cases against me in Russia, which issued international arrest warrant on my head. That is how I got into Ukraine, and one of the reasons I've changed my name to distance myself from other Russians. Obviously Russians find it insulting, when somebody refuses to carry a Russian name.

WW2 started when USSR began the military buildup proceeding on their plan to conquer Europe. Additionally helping the destruction of Weimar Germany. I.e. long before the actual war. And WW2 is just a follow up to the WW1, which too began not without a Russian help. Without WW1 there would have never been Hitler, who was literally created by that war, or the USSR, too the product of WW1. So everything can be tracked back to the Tsar Nicholas, or more precisely to the slavish population of Russian serfs (крепостные крестьяне), who failed to get their freedom and were used as a cannon fodder in a nonsensical war used to entertain the elites playing "The Great Game", as they called it.

My Russian compatriots love blaming others, but they get angry when somebody points at them. It is easy to accuse say Stalin of building the Gulag system and executing millions, but we have to admit it was not Stalin who wrote all these millions of false reports (bribes and reports, usually anonymous, were used to get rid off people standing in the way), and it was not Stalin who did actual executions and guarded the concentration camps. It were the common people, these same serfs, who under the Tsar Nicholas did the WW1. In fact, Russians gained freedom of movement only in 1974. Before that they were attached to the kolhkhoz and factory as a property, and were completely okay with it. Compare to African-Americans, who did multiple revolts against the slavery and mistreatment.

So yeah. I don't want to be a part of Russia and I don't want to speak Russian. They can jail me. They can kill me. But I will still refuse to accept their BS. I refuse to live in the parody of a society they build.
Title: Re: XCOM Inspired Fantasy Game
Post by: HT on June 10, 2020, 03:42:20 pm
That's quite a hardcore yes, but why are you telling us this? It won't help you much if you're in such trouble.

I hope your game goes well, it shows promise.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on June 10, 2020, 05:48:58 pm
That's quite a hardcore yes, but why are you telling us this? It won't help you much if you're in such trouble.

I hope your game goes well, it shows promise.
Just explaining why the project will likely never gets released.
Maybe somebody could continue its development or reuse some ideas for other XCOM clones.
Since I will likely get around 10 years in prison and unlikely to get out alive.
But I guess it always happens to indie projects led by a single person.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on June 10, 2020, 08:33:37 pm
There were not many other jobs in the city of Serpukhov, which traditionally produced equipment for the Soviet submarines. And the company I worked for has spun-off from the Ratep military factory. In fact all jobs in Russia are either in the military or in the gas/oil sector. I've also worked at the mass spam company, but since IT got weaponized, their services were used not for ads, but for the blatant propaganda spam.


But you agree to work for them but still refuse to follow their standards. I do not understand this part. Writing code for them is couple of magnitude more important than language of comments. I would understand opposite, write comments but refuse to work with them.


Had I not bribed some officials to escape, I would have already got 10 or more years in jail or a nuthouse (they believe it is insanity when a citizen of Russia refuses to speak Russian out of the spite). There are several crime cases against me in Russia, which issued international arrest warrant on my head. That is how I got into Ukraine, and one of the reasons I've changed my name to distance myself from other Russians. Obviously Russians find it insulting, when somebody refuses to carry a Russian name.

My point was that in USSR you could even had chance to flee Russia. Yes Putin's Russia is Authoritarian state but not Totalitarian state (at least not in same degree as USSR or current N. Korea). And if you want find place to flee you should check Poland as current government is rabid on Putin (even if its not beneficial in long term for them). Alternate Lithuania or Latvia as they existences depend on being against Russia but still have connection that you will have lot easier to blend in.

WW2 started when USSR began the military buildup proceeding on their plan to conquer Europe. Additionally helping the destruction of Weimar Germany. I.e. long before the actual war. And WW2 is just a follow up to the WW1, which too began not without a Russian help. Without WW1 there would have never been Hitler, who was literally created by that war, or the USSR, too the product of WW1. So everything can be tracked back to the Tsar Nicholas, or more precisely to the slavish population of Russian serfs (крепостные крестьяне), who failed to get their freedom and were used as a cannon fodder in a nonsensical war used to entertain the elites playing "The Great Game", as they called it.

If we go this deep for "fault" then Germany have bigger as they fund Communists to withdraw Russia from WW1. Thank God that Poland defeat Communist in '20 other wise this contamination would spreed lot earlier.
Aside WW1 was not Russian fault as many other countries have stake to win in it.

My Russian compatriots love blaming others, but they get angry when somebody points at them. It is easy to accuse say Stalin of building the Gulag system and executing millions, but we have to admit it was not Stalin who wrote all these millions of false reports (bribes and reports, usually anonymous, were used to get rid off people standing in the way), and it was not Stalin who did actual executions and guarded the concentration camps. It were the common people, these same serfs, who under the Tsar Nicholas did the WW1. In fact, Russians gained freedom of movement only in 1974. Before that they were attached to the kolhkhoz and factory as a property, and were completely okay with it. Compare to African-Americans, who did multiple revolts against the slavery and mistreatment.

Again what country do not like blame others? For Poles this is always Russian or German fault.
An this is true that no totalitarianism can stand without people who execute orders and you can find people like this in every community.
And you should never compare USA to USSR, even when true racism reign in America, black had better than soviet citizens, example could be wen last time USA stave to death whole country? USSR did it. You cannot revolt if govermet send tanks against you.


So yeah. I don't want to be a part of Russia and I don't want to speak Russian. They can jail me. They can kill me. But I will still refuse to accept their BS. I refuse to live in the parody of a society they build.

I understand hating current government or previous one, but hating every thing? You probably hate it more than I even I could find more reason to do it.

And if you really want insult Russia you should become Polish citizen as this is only country that really occupy Moscow (if you include Napoleon then Poles did it two times as they where with him too).
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on June 10, 2020, 10:45:39 pm
But you agree to work for them but still refuse to follow their standards. I do not understand this part. Writing code for them is couple of magnitude more important than language of comments. I would understand opposite, write comments but refuse to work with them.
I had to work somewhere. And the language is actually very important in maintaining social coherence, and crystallize the nation. Without the language and the culture built on top of it, the Russian nation will melt down and evaporate like ice under the summer sun. In fact I think language is the most important factor holding the Russian nation together. It is hard for people to grasp the importance of their language, since it is always there, taken for granted. Language is not like these Gulag guards, yet it serves the same purpose - keeping Russians locked in. If we consider the theory of our Universe's structure being self-similar, then the language+culture pair would be very similar to the force of gravity. It is decentralized, having no distinct center, beside the center of mass, and yet it self-organizes the agents affected by it. And in fact the language and the culture are the functions of gravity (they are obviously shaped by the spatial locality).

So if one wants to destroy Russia or to get out of its control, that individual will have to speak a different language. And fortunately Russia is not (yet) a blackhole, so it is possible.

I understand hating current government or previous one, but hating every thing? You probably hate it more than I even I could find more reason to do it.
Government is just the function of its citizens and their culture (if we apply the above gravity metaphor). I don't hate the Russian government. I don't really have any hate anymore. Hating Russia is like hating the gravity force expressed by some space body - an exercise in futility. Without that cultural cementing force it would have been very easy to overthrow the Moscow government. To start a revolution in Russia one needs just one thing: cut off the gas and oil from Moscow. To do that you need just a few thousand troops. Then suddenly all the profits will remain in the regions, and Moscow will have no money to support any army. And in fact no way to keep people enslaved (riot police usually comes from distant regions, since people wont be beating their relatives into submission). But no, Russians will cope with everything, being dirt poor in the richest country on Earth. And if you start talking with Russians about revolution, they will only report you to security agencies. That is like a law of physics.

And if you really want insult Russia you should become Polish citizen as this is only country that really occupy Moscow (if you include Napoleon then Poles did it two times as they where with him too).
I will likely try getting into Britain or Ireland. Since I speak English and England has many opportunities in the IT sector. I doubt Poland needs any programmers. Then again, I'm completely ignorant about the economy of Poland. But I know for sure the last thing Poland and Poles want is the Russian gas pipeline being blown up by revolutionaries. Ukraine wants it even less, since the major part of the Ukrainian budget income comes from the gas transfer revenue. From the economical standpoint, Ukraine is the integral part of modern Russia (culturally it is too a Russian satellite). Yet it wants to maintain the relative independence to get that revenue. If Russians annex Ukraine, all the EU money will go to Moscow. TLDR: if I manage get a refugee status in Poland, and then write on the Internet something like "Freedom for Siberia! Now is the time to take down that motherf&&king pipe", there is a high chance Poland will extradite me to Russia the next day.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on June 11, 2020, 01:25:05 am
I had to work somewhere. And the language is actually very important in maintaining social coherence, (...)
So if one wants to destroy Russia or to get out of its control, that individual will have to speak a different language. And fortunately Russia is not (yet) a blackhole, so it is possible.


Then your goal is not finding job but to destroy Russian, then is very hard not to expect to Russia strike back. Probably no country would allow it, if it would allow it soon be case to exists, France or Sweden are on road to it.
And some way your words prove Putin right, if he want to Russia exists he need enforce with full might unity of langrage.

Government is just the function of its citizens and their culture (if we apply the above gravity metaphor). I don't hate the Russian government. I don't really have any hate anymore. Hating Russia is like hating the gravity force expressed by some space body - an exercise in futility. Without that cultural cementing force it would have been very easy to overthrow the Moscow government. To start a revolution in Russia one needs just one thing: cut off the gas and oil from Moscow. To do that you need just a few thousand troops. Then suddenly all the profits will remain in the regions, and Moscow will have no money to support any army. And in fact no way to keep people enslaved (riot police usually comes from distant regions, since people wont be beating their relatives into submission). But no, Russians will cope with everything, being dirt poor in the richest country on Earth. And if you start talking with Russians about revolution, they will only report you to security agencies. That is like a law of physics.


Government is more a feedback loop, I saw enough examples as bad government can corrode whole society and opposite can happen too. Look on current USA, this can go in any way, one person making one correct decision could define next 100 years of it. No society is unified, all have some subgroups, and depending on circumstances everything could go upside down.

And again if your target is destroying Russia then why is strange that they report you? Name any opposing fraction to Putin that would like destruction of its own country?

I will likely try getting into Britain or Ireland. Since I speak English and England has many opportunities in the IT sector. I doubt Poland needs any programmers. Then again, I'm completely ignorant about the economy of Poland. But I know for sure the last thing Poland and Poles want is the Russian gas pipeline being blown up by revolutionaries. Ukraine wants it even less, since the major part of the Ukrainian budget income comes from the gas transfer revenue. From the economical standpoint, Ukraine is the integral part of modern Russia (culturally it is too a Russian satellite). Yet it wants to maintain the relative independence to get that revenue. If Russians annex Ukraine, all the EU money will go to Moscow. TLDR: if I manage get a refugee status in Poland, and then write on the Internet something like "Freedom for Siberia! Now is the time to take down that motherf&&king pipe", there is a high chance Poland will extradite me to Russia the next day.
Why any county would allow continuation of your crusade against Russia? And even if it will be moral? How many would die in this next revolution? Revolution have bad habit of eating its own children.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on June 23, 2020, 10:27:59 pm
Government is more a feedback loop, I saw enough examples as bad government can corrode whole society and opposite can happen too. Look on current USA, this can go in any way, one person making one correct decision could define next 100 years of it. No society is unified, all have some subgroups, and depending on circumstances everything could go upside down.
But government still needs a strong and integrated nation to regenerate itself reliably over time. Russia had several revolutions, but each time it moved to the same core, surviving both the complete change of its elites in 1917 and the total economic collapse of the USSR. No matter the Tsar or Stalin, Russia will remain Russia. Just like if you turn the planet Earth into dust, that dust will accrete back to create the planet (although likely very damaged), unless it gets velocities larger enough to escape the synergistic gravitation of all other dust particles. On the contrary, Roman Empire got disintegrated, and its language went extinct. So government is more of the function of what there is under it.

If you're a single person on an uninhabited island, then you're both the king and the people there, but surprisingly not much you can do. I.e. if Bill Gates gets onto an uninhabited island, he wont create Microsoft. If he gets on an island with some uneducated aborigines, there wont be a Microsoft either. To create Microsoft, Bill Gates needs a large, healthy and educated nation with a lot of resources and developed technologies. I.e. Bill Gates is the function of the nation, which itself is a function of the environment it has, which is, well, first of all shaped by that force called gravity.

Anyway I still keep thinking about the proper way to implement leaders/officers in the game, what makes people loyal and breaks loyalty. I.e. why for example Putin's officers wont just kill him, and wont start a war between each other. What truly stops these generals? How does the loyalty arise?

In addition there is a question about how to make AI challenging. There are a few possibilities.
1. Non-cheating AI. That AI just doesn't cheat and start with the same resources as player. Hard to implement and not very exciting.
2. Rubber band AI. Cheats by having its income to be a multiple of player's income. So the more money player makes, the more money the AI makes. Such AI will always be on match with the player, no matter how quickly player acts to capture resources. The AI will be annoying, since no matter what player does, it will still come back, and will be treading on the tail. The game will likely turn into some strange meta, where player will try acting with low income to avoid turning AI into powerful opponent. Player basically plays against itself.
3. AI gets stronger with time to the point of being impossible to beat (original XCOM AI). Such AI  will pose ominous challenge for inexperience players, yet will be boring for advanced players, who can managed to get far ahead of time. And the speed with which AI gets stronger is something hard to balance. It quickly gets from easy to impossible. I.e. that is just a game with a time limit, where player can move time back with bonuses. Original Civilization also had similar AI, varying its speed with difficulty, but modern remake uses a non-cheating AI, which can still beat novice players: https://techcrunch.com/2016/12/06/aragos-ai-can-now-beat-some-human-players-at-complex-civ-strategy-games/
4. Stupid AI. Starts with a lot of resources, but doesn't care to use them, instead attacking player with small manageable forces. Typical for most video games. I.e. if all monsters on the Doom map will suddenly go after the player, there will be no chance to survive. But monsters are too stupid to cooperate, so player can kill them one by one. Sad story. Later games like Quake Team Arena tried to make non-cheating bots, which were far less exciting than bullying the clueless Doom monsters.
5. Trigger-based AI. The AI reacts to player actions with unpredictable cheating, possibly random. I.e. if player moves near AI city, the otherwise docile AI will respond with full force of dishonestly earned resources. Pioneered in Doom games, with trigger sectors, unleashing monsters.

Ideally single player AI should react to player's advances and try to disturb them. So I will likely go with a trigger based AI influenced by the difficulty level and random dice roll. Such AI can have almost unlimited resources and act unpredictable, or according to some narrative. Although I still plan to bind AI resources to the actual income, just provide with larger starting resources. I.e. no gold will be materialized out of nothing.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on June 26, 2020, 09:23:07 pm
Proceeding with implementing the city plundering. When the city has not enough mercs to defend itself, but still has some population (expressed as wealth/taxpayers), city streets will be replaced with actual civilians. These are very weak units, but would still be a nuisance. I also think implementing mechanics of punishing players for killing them. Similar to how in Vagrant Story killing civilians in some missions led to these missions being lost.

Maybe something like metropolia sending a ship with knights to end the carnage. Not children sprites, because I'm too lazy to draw them and it will create some controversies. Still in real life wars and propaganda children victims play some non small role. And children were frequently used for  service roles, cannon fodder and last resort reserve. And it is still a thing even in modern world: https://en.wikipedia.org/wiki/Child_slavery#Child_soldiers

Anyway, I already had a male sprite, and so I had to finish the female sprite. Animations are not very polished but should do for now. Proper approach would be hiring a professional artist, instead of doing animations myself, but I have no access to crowd funding or any funding at all, and I think professional animation would require more frames of animation, and that will also require implementing actual resource management.

Currently all sprites are loaded into memory and never freed after that. Some sprites are also generated dynamically, so it would require some refactoring. In addition, resource system implies special archive format for fast loading from HDD, since many people still dont have SSDs. In fact, the recent Command & Conquer remaster was criticized for not accommodating for SSDs.

(https://i.imgur.com/zrESFHQ.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on June 30, 2020, 02:46:21 pm
Had to rethink explosions. The original XCOM (which I use a starting point for everything), had some very obscure explosion mechanics. You never knew if that explosion will clear the wall or damage the UFO.

Now I want to make it simpler: all fragile items in some range will get destroyed, while fragile tiles will get cleared. In addition throwing a bomb on top of a castle wall will turn that wall into rubble, which will fall out if there is free space near it. That way cannon shots would gradually turn castle walls into rubble. In addition the explosion is sending units around it flying a few tiles back.

Now compared to XCOM I don't have squaddies with firearms determining their capabilities, but instead monster types doing that. Although there are stuff like grenade flasks and health potions, weapons humanoids have mostly determine their attack and damage. But I find these annoying to use, since player will have to manually resupply them after every battle, and that was a big part of the original XCOM - ordering enough grenades. So in my case goblin gets just 5 grenades, it can throw during the day, and such ammunition auto-resupplies each word turn, just like health.

I havent yet added the general rock-paper-scissors damage/armor system. It probably should be added, because it will help further differentiating different units and items. I.e. if a dragon uses fire as a weapon, it must have some inborn resistance to fire. As of now there are only undeads, which are resistant to non-blessed attacks. Yet they also do more damage to non-blessed units and have higher to-hit chance against them. So resistance system is not that simple, since on has to decide how and where it will apply.

Still a lot of work to do. And I haven't even decided on the story, beside that the player should start the game without a city and arrive at a neutral port city. The story is not really that important for a strategy game, as opposed to the victory condition, which can even be made random. IIRC, The Sims had such system, where victory condition was based of the randomly generated character's personality. And such approach actually nicely suits strategy games, especially multiplayer ones, where player has to guess what goals pursue other players. Same way it will fit nicely with a narrative based AI. And if you think about it, the original XCOM already had asymmetric game sides, where the player and the AI controlled aliens had different goals. On the other hand, Apocalypse didn't had a narrative AI, but instead had a rubber-band AI, where the quicker the player advances, the harder the AI hits.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 05, 2020, 04:42:00 pm
Currently I'm working on a little voxel utility which I plan use for few dynamic effects, like say tiles breaking apart in explosion. These cannot be drawn manually, especially not in a singe dev project.

(https://i.imgur.com/0hpvi9v.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 08, 2020, 08:45:22 pm
A nice video explaining that to have uniform non squares or hexes cells one will need to use hyperbolic space. Dunno if there are many tactics games in such space. But the author of that video even made a Marble Madness style game completely with 3d fractals.

Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 08, 2020, 09:36:56 pm
I still keep working on the voxel utility. Basically I'm redoing Photoshop, but with voxels. The editing functionality will be very similar and one could as well edit 2d images with, yet there will be a way to apply filters in 3d. Hope it could also be useful to OpenXCOM modders, since it is much easier to edit and paint voxel than to edit 2d sprites (if you have the editor lol). If I manage to optimize it to show 1000x1000x1000 cubes, one could even map the whole XCOM site into voxel space. And then do stuff like bullets making actual holes in objects.

There is the bare minimum functionality to make it useful for my purposes (i.e. any voxel animation makes layers mandatory), and I will have to transfer the core rendering code into C/C++, since Symta still has no unboxed floats and I need every single voxel out of it. Probably should even use GPU (but I have none :-\ ). UI will remain in Symta.

(https://i.imgur.com/xHpFHFW.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 09, 2020, 11:04:35 pm
Rewriting the code to C/C++ without any optimizations instantly allowed working with 256x256x256 cubes. Although I had to fix a nasty bug with floating points -0.0 behaving differently in edge cases due to -fast-math compiler keyword. I'm sure I can boost that to 512x512x512 cubes with basic optimizations and multithreading. Still not enough to draw a full XCOM map where every pixel corresponds to actual voxel. The target size 1024x1024x1024 will require actual GPU rendering.

Modern GPUs apparently can execute C/C++ with some limitations. A huge leap from the basic DirectX assembly shaders I remember being used in games like Morrowind. But shaders are still not very portable.

Then again, if I implement optimization structure, like octree, I can reduce Z dimension, since XCOM has just 4 height maps and each tile is 16 pixels high, only around 1280x1280x80 voxels are needed to draw full XCOM map.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 10, 2020, 08:37:39 pm
Things one learns: voxels actually do look like cubes, if you render them at resolution higher than a pixel. For some reason I believed the will look like pixels, but that is the case only when one projects them as pixels, when rendering like trinagles. And one needs to render them at higher res to precisely edit them. But triangle-style rendering for voxels has a lot of quirks:
1. One has to sort voxels by distance from camera.
2. The one draws them upscaled based of Z.
3. If several voxels project to the same screen pixel, one just blends them.
That was very inefficient but it worked for small scale models.

Alternatively one can convert voxels to triangles. And that actually works well for sparse scenes. But the conversion process is very expensive, and one cant modify the model after conversion - polygons are surprisingly hard to mutate. Although if one doesn't do large modifications, then space can be broke into parts, which are much faster to convert  to render into triangles, after being modified. I personally just raytrace them like spheres, since raytracing allows sampling very large, potentially infinite constructs. One guy even made a complete video game base of infinite fractals: https://www.youtube.com/watch?v=9U0XVdvQwAI

There fractals are mutates them with time and it acts like complex a course to navigate. Think Marble Madness + Monkey Ball on speeds.

Anyway, I have already mentioned that XCOM Apocalypse had all objects internally made out of voxels, so projectiles move with great precision
https://www.terrygreer.com/xcomapocalyse.html
Quote
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.

Obviously I plan to integrate that voxel engine with Spell of Mastery. Just because it opens so many possibility on both visual effects and gameplay sides. But it is unlikely I will use complex projectile raycasting, since I want player being easily able to guess where unit can shot. The game does use simple raycasting already and it was real pain to make remotely intuitive. Yet I need robust large scale voxel modifications to produce stuff like tiles breaking apart or just for site map transformation.

(https://i.imgur.com/F6bNkwh.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 11, 2020, 12:05:24 am
Suddenly the problem of working with real world sized voxel 1024x1024x1024 models has solved itself after a refactoring. I've just detached the render size from the object size, and rendering even very large voxel objects at low resolutions is fast enough even without any optimization structures or any space coherence. As long as one has enough memory. I can still zoom in and edit parts of the model. But better ideas would be cutting piece out into separate layers which can be edited much faster than the whole model.

Editing still takes some time. Because it is, well, a frigging 1,073,741,824 cubes processed in software on an old CPU. I store just color, but 4 gigabytes is a lot of memory to process. Literally impossible to work with on a 32-bit machine without swapping parts of the grid.

Hope soon I will be able to load in XCOM maps with voxels instead of pixels. Unfortunately people have apparently lost the upscaled XCOM graphics: https://openxcom.org/forum/index.php/topic,892.0.html I've planned to use to autogenerate voxel tiles.

The figure on the screenshot is actually made out of a billion voxels.

(https://i.imgur.com/cVg1378.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on July 11, 2020, 12:28:44 am
What exactly data structure you use for this voxels? It is a colossal vector? or something else?
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 11, 2020, 01:33:20 am
What exactly data structure you use for this voxels? It is a colossal vector? or something else?

As of now it just
Code: [Select]
typedef struct {
  uint32_t w; // width
  uint32_t h; // height
  uint32_t d; // depth
  uint32_t wh; // width*height

  uint32_t flags; //flags describing the vfx
  uint32_t data[]; //w*h*d voxels
} vfx_t;

Obviously `data` are not even sub-divided into smaller cubes, so each new Y or Z triggers a page fault.

Here is the first ever (to my knowledge) attempt to render the XCOM flowerbed tile in voxels:
(https://i.imgur.com/ssyGQgy.png)

will be some time till it gets to work that properly to render the whole map.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on July 11, 2020, 01:22:29 pm
As of now it just
Code: [Select]
typedef struct {
  uint32_t w; // width
  uint32_t h; // height
  uint32_t d; // depth
  uint32_t wh; // width*height

  uint32_t flags; //flags describing the vfx
  uint32_t data[]; //w*h*d voxels
} vfx_t;

Obviously `data` are not even sub-divided into smaller cubes, so each new Y or Z triggers a page fault.

Getting faster will be hard but not impossible, in C++20 they add some interesting tools that could allow speed increase:
https://www.youtube.com/watch?v=j9tlJAqMV7U
If you can't use new compiler then you can partially use this technique by prefetching memory two step ahead, some thing like:
Code: [Select]
for (int n = 0; n < X; ++n)
{
    _mm_prefetch(pos(n + 2));
    process(pos(n));
}
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 11, 2020, 07:36:34 pm
Getting faster will be hard but not impossible
Getting faster will involved creating proper optimization structure and transitioning it to GPU. But then it will stop being a toy prototype app and will require any effort to modify.

BTW, that rough texture in previous screenshots was actually the result of a rounding bug in shading algorithm. Voxels do produce some subtle distortion on rotation (just like rotated 2d images in Photoshop), but it is far less noticeable, especially with very fine grid, so properly working rendering code will give very smooth looking images, just like the usual triangle rasterization with lambert shading. I.e. voxels don't look like Minecraft, unless you intentionally make them to look that way. For example, the picture below is a pixel perfect tile render using the XCOM angle (which is different from Ultima Online, Baldur's Gate and Fallout angles).

I will still leave that rendering bug in the final release just for the sake of low fi retro look it gives. I have also discovered a bug which produces what pixel artists call "pillow shading". Should be preserved too.

(https://i.imgur.com/dJoNCaR.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 12, 2020, 03:52:28 pm
Surprisingly just breaking the cube into 16x16x16 (x86 page size) sized sub cubes has boosted the rendering performance by 1.2. Yet it made `for-each-voxel` operations slower, because there is no more calculations to access a voxel. Never underestimate the importance of data alignment. Unfortunately I do care more about `for-each-voxel` operations than I do care about render speed, so such micro-optimizations are useless. Octree is the only thing that can greatly speedup both editing and rendering, just because most voxels have the same color, only the fine grained texture on the outside will get a lot of octree nodes.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 13, 2020, 08:11:08 pm
Ok. Decided to optimize with octrees. I've implemented octrees before, but that was in Symta and with very limited functionality. Now doing Octrees in plain C with support for operations like booleans and projective painting will be challenge. It is easy to implement the set_voxel function in octrees, even in C, but you cant simply set voxels for large scale models, since it will quickly fragment the octrees, making far worse than the plain WxHxD array. No. One has to work directly with octree nodes to avoid fragmentation.

I'm still unsure how to optimize more complex operations, but painting can indeed be done very efficiently on octrees, since you don't need to check every voxel for painting now. Additionally octrees allow exproting the model as textured triangles for previewing in polygonal editor, like 3ds max. But the proper way convert voxel models into polygonal ones appear to be cube marching.

So yeah, even a toy 3d editor requires a lot of expertise.

Apparently the latest state of art development is 3d modelling with just a bare point cloud (i.e. not even voxels). But point clouds are processed by KD-trees (a structure isomorphic with neural nets), not octress. Point clouds can also be converted to voxels using the 3d version of Dirichlet tessellation, which is apparently a rather complex subject, but one can probably just run an expanding sphere hull, filling in the voxel grid (like I did with 2d tesselation). I don't really need anything of that for my game art production, unless I want to import scans of real world objects.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 14, 2020, 12:18:53 am
Ok. Octree did the trick. I was able to paint a cube of the size 3000x3000x3000 - 27,000,000,000 voxels (XCOM maps are just 6400 voxels). In a plain array it would have taken far more memory that I have installed on the system. Larger sizes are likely possible but it crashes due to some bug. Good news is that I can paint any model of that size. Bad news is that it requires handling a lot of special cases. You can't simply memcpy a part of octree to cut out the stuff into a new layer. So I think I should have stayed with plain grid since code becomes very complicated. Side views are garbled because they used special sampling routines not working with the octree.

(https://i.imgur.com/3HXlNup.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 15, 2020, 06:12:45 pm
Optimized the raytracer to work directly with Octree structure. Since solving the ray cube hit equations are now mandatory, there is now the precise place where ray hits voxel, so the remainder of graphics glitches are gone, voxels are perfect cubes now and it properly renders even singe voxel sized models. That is important for graphics editor, since as an artist I want to set up some voxels just perfectly, instead of painting wildly with brush.

Still older games like C&C have apparently just registered all hits as voxel center hits, which made voxels more like cubic spheres.

Octrees can also be used to export simpler model as a set of polygons for editing in other software, since large cube faces can be easily unwrapped and textured. Still cube marching will likely be a must do anything practical with result model.

As the additiona bonus rays now fly much faster since octree usually has large solid spaces, which unfortunately have to maintained, similar to how one does binary tree balancing.

Next step is implementing layers, so I can load say the classic Command & Conquer models, which are broken into multiple parts.
 
(https://i.imgur.com/QjnPnNS.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 15, 2020, 10:31:32 pm
Given that properly rendering voxels is resources intensive even on modern machines, I kept wondering how Westwood did that for Balder Runner. Apparently they did not.
https://news.ycombinator.com/item?id=17171287
Quote
Blade Runner didn't actually use voxels, they used a rather unique technique that they called "slice animations".

The 3D models were sliced from bottom to top into a couple of hundred slices (depending on desired quality) by intersecting the model with a horizontal plane and storing the resulting polygons.

The engine can only rotate the models around the vertical axis.

Here is the reverse engineered rendering code
https://github.com/scummvm/scummvm/blob/master/engines/bladerunner/slice_renderer.cpp

basically just 2d sprites with z-buffer for compositing.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on July 16, 2020, 01:04:18 am
In back of my head I was thinking about adding octatrees or similar structure to speed up OXCE trajectory calculations. What exactly performance you get in your editor? How many pixels you can render before you see slowdowns?
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 16, 2020, 09:44:25 am
In back of my head I was thinking about adding octatrees or similar structure to speed up OXCE trajectory calculations. What exactly performance you get in your editor? How many pixels you can render before you see slowdowns?
I got orders of magnitude increase from the brute force grid tracing with 0.5 step. Yet it applies only to larger models (128x128x128, etc), since octree by itself incurs housekeeping. Operations like boolean ones also get speedup, but again for large scale models. Booleans obviously include explosion radius and other selection stuff. I doubt simpler game engine like XCOM will win anything. I suggest you not bothering with it, unless you want to practice your octrees skills or developing the next AAA XCOM, where bullets fly through the truly continuous space and everything must be just perfect, but AAA games likely already have octrees as part of collision system in the physics engine. Voxels are nice when you have say a wall with weak parts, which will get destroyed by bullets or small explosions, or say when you want to model actual vital organs in aliens, like that huge alien having two hearts and two brains, each of which must be hit to kill it.

Voxels as a technology is nearly useless, since it is the hardest way to render graphics, even point clouds are easier, and there are actual full featured game engines working with point clouds (google Euclideon), but voxels are still a thing of the future, despite the real-time raytracing is long the practice now. For one thing: to mocap animate a model, you need to stretch it, and you cant stretch voxels easily, especially not the octree - you have to stretch the space itself. That is tensor algebra - the subject they don't teach you at school, or even a college, unless you are physics major or doing material science. I.e. there are 2d animation editors (like DragonBones) mapping raster images to bones, but these just deform the triangle grid making body parts. With voxels one will have to at least deform the boxes. That means ray entering the box at different angle will travel at different speed, based of the tensors deforming the voxel box.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 16, 2020, 05:24:18 pm
Ok. The developer of Cortext Command (i.e. that worms inspired game) said he has joined forces with Slovakian voxel graphics expert to make the first real full blown voxel engine (the next Worms game?). Dunno if they use the term "voxels" correctly, because a lot of people apparently call point clouds "voxels", which they are not. Point clouds are the different concept with its own trade offs, application areas, algorithms and data structures to process them. Voxels are basically the 3d raster images, and you work them like with raster images - i.e. using functions like blit_voxel(x,y,z,sprite,blit_options), just like you blit XCOM sprites, but without nasty stuff like depth sorting or breaking your sprites into cubes, like XCOM does. That is their main power as of the voxel representation - you cant do that with polygons or point clouds. You can also do 3d pixelart with voxels, since it is possible to precisely match the pixels on screen in a perfect way, compared to wobbly polygons or point clouds. Voxels also allow gas, fluid (flame, water) and other cellular automate simulation. Point clouds don't allow that since they are non-uniform (for cell automata you need a nice regular grid). Most people for some reason miss that basic idea.

Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on July 16, 2020, 06:58:50 pm
For voxel engines there is already one that was close to use in AAA title (EverQuest Next):

http://procworld.blogspot.com/

One difference is that it feed polygons to U4 or Unity for display.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 17, 2020, 12:03:15 pm
For voxel engines there is already one that was close to use in AAA title (EverQuest Next):

http://procworld.blogspot.com/

One difference is that it feed polygons to U4 or Unity for display.
I.e. it was not actual voxel engine, but the usual polygon engine with some internal "voxel" heightmap. Voxel engine actually raytraces voxels, without polygons ever popping in in the pipeline. Although you can probably combine voxels with polygon graphics using zbuffer, but it will break all transparency. And voxels major use are the effects involving transparency, like volumetric fog. Therefore it makes sense to go all voxels. One can ray march the mesh out of voxels to use for the same volumetric fog, but it wont be the same: uniform density and color everywhere wont allow for very exciting effects.

Volumetric fog in Unreal:
(https://i.imgur.com/kwKFP8j.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 17, 2020, 01:30:31 pm
Ok. Here is something that looks like a real voxel game - basically glorified Command & Conquer:
https://www.mobygames.com/game/windows/hexplore/screenshots/gameShotId,621013/

Although I guess they used something similar to Westwood animation slices technology to stream compressed 3d animations at single angle. When you know the exact camera parameters it becomes order of magnitude easier compared to the general problem. And the buildings in Hexplore are placed at exact right angles on a grid. That points to some heavy limitation of the technology, since for RPGs you don't need the exact grid, like for XCOM.

Then there is that Invictus game:
https://www.mobygames.com/game/windows/invictus-in-the-shadow-of-olympus/screenshots/gameShotId,41307/

Compared to clean looking Hexplore, Invictus characters look very dirty and low res, so it is hard to tell if they are voxels or just a large number of pre-rendered animation frames with good streaming technology. All I can they they failed with their shading and gamma routines, whatever input it shaded, and there were no artists to tell them that. But the landscape and buildings looks like they are made out of polygons. Everything looks covered in puke. The gameplay looks even worse - two units fighting will literally hit each other for half an hour.

Has anyone reverse engineered these games?

(https://i.imgur.com/ozVGeF2.png)
(https://i.imgur.com/HlS2E9b.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 17, 2020, 02:41:52 pm
Ok. Some people did a bit of reversing:
https://www.reddit.com/r/REGames/comments/b0y9v8/trying_to_extract_the_voxel_data_from_hexplore/
https://github.com/tyranteon/openhexplore/

But they apparently haven't got any further than dumping the palette :(
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on July 17, 2020, 11:34:46 pm
I.e. it was not actual voxel engine, but the usual polygon engine with some internal "voxel" heightmap. Voxel engine actually raytraces voxels, without polygons ever popping in in the pipeline. Although you can probably combine voxels with polygon graphics using zbuffer, but it will break all transparency. And voxels major use are the effects involving transparency, like volumetric fog. Therefore it makes sense to go all voxels. One can ray march the mesh out of voxels to use for the same volumetric fog, but it wont be the same: uniform density and color everywhere wont allow for very exciting effects.
He create full voxel terrain but without any voxel renderer. I think we can separate them, because he show on many videos that he can alter terrain on run time.
And it allow all typical voxel operations (like intersection).
Some example of functionality:
https://www.youtube.com/watch?v=Y5arfh0kJTo
or
https://www.youtube.com/watch?v=Z0upnXTM_kk


For rendering he covert voxel to triangles and display them in UE4 or Unity. For me this is still voxel engine even if use different graphic mode.

[ps]
new link
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 18, 2020, 01:17:46 pm
Asked a professional graphics artist what they use, and he pointed me to the VDB format:
https://www.openvdb.org/documentation/doxygen/faq.html#sGeneralizedOctree
Quote
Is OpenVDB merely a generalized octree or N-tree?

No! While OpenVDB can conceptually be configured as a (height-balanced) octree, it is much more than an octree or N-tree. Whereas octrees and N-trees have fixed branching factors of respectively two and N in each coordinate direction, OpenVDB’s branching factors typically vary between tree levels and are only limited to be powers of two. To understand why and also learn about other unique features of OpenVDB, refer to the paper in ACM Transactions on Graphics.


Is OpenVDB an adaptive grid?

Let’s first stress that the term "adaptive grid" is somewhat ambiguous. Some use it to mean a grid that can store data sampled at adaptive voxel sizes typically derived from a so-called "refinement oracle", whereas others mean multiple grids with different fixed voxel sizes all sampling the same data. An example of the former is an octree and of the latter is a mipmap. Since OpenVDB stores both data values and child nodes at each level of the tree, it is adaptive only in the first sense, not the second. The level of adaptivity or refinement between the tree levels is defined by the branching factors of the nodes, which are fixed at compile time.

OpenVDB stores voxel data in a tree with a fixed maximum height (chosen at compile time), with a root node that has a dynamic branching factor, with internal nodes that have fixed branching factors, and with leaf nodes of fixed dimensions. Values can be stored in nodes at all levels of the tree. Values stored in leaf nodes correspond to individual voxels; all other values correspond to "tiles" (see below).

But apparently VDB can't be modified in real time, and is useful only rendering precomputed scenes, since you have to recompile whole structure for each frame.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 18, 2020, 01:51:11 pm
An image from their page showing non-regular grid. As I understand one can use this higher level grid for very fast lookup, like a hash table, and then load subgrids from disk. That can be much more efficient than octrees. Especially with CSG boolean operations, since one doesn't need to create that many additional octants. Although implement it is much harder than octrees.
(https://i.imgur.com/1EpUWqc.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 19, 2020, 11:48:16 am
People pointed me that there is an old voxlap engine, which was able to draw rather large voxel models in early 2000ies
https://stackoverflow.com/questions/3794306/can-someone-describe-the-algorithm-used-by-ken-silvermans-voxlap-engine

Instead of octree Ken uses the usual grid, but with RLE compression for each column:
Quote
The world map is basically a 2D array of pointers (1024x1024), which point to lists of surface voxels on each column. This column is a list of colors and is compressed using an RLE-style algorithm. I wrote my own memory management system to handle fast allocation/deallocation of 1048576 blocks of memory.

I.e. it is a generalization of the algorithm Novalogic used in Comanche.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 19, 2020, 05:26:42 pm
Implemented layers. At first I was afraid that layers would be too expensive, but that is not the case. Each layer has personal rotation and offset, so theoretically one can make animated voxel models. Therefore the next goal is Photoshop style animations, using layer groups and layer instancing. What is actually complicated is soft body deformation. I don't see any way of doing it without using the second order octree. But it is like a professional feature and not really required for the purposes of my toy 3d editor.

(https://i.imgur.com/nQ5AasX.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 22, 2020, 05:34:15 pm
With voxels one can't rotate the model's vertices, since there are no vertices. The only way to rotate something is by rotating the camera around it, pretending it is the objects which rotates. That gets a bit involved when you rotate both the world and the objects inside the world, like i.e. wheels on a car, and the camera also moves inside the world, and you must also paint stuff with a brush, and the layer must be turned on and off without any slowdown, since that is a 3d photoshop after all. Usually one does rotation and translation with matrices, but I've found that they obscure raw details. As of now rotations is the hardest part of the project. The harder would only be doing soft body animation. Now when I thin about it, one can probably break voxel grid into subparts, and then duplicate, increase them in size or shrink to simulate the softbody stretching, but that has rather limited application, and still needs some guiding algorithm.

Of course one can rotate the same easy way we rotate 2d bitmaps, but that will be very inefficient, especially for larger models. Still have to do that when merging layers with different rotations.

(https://i.imgur.com/MvPWf9a.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 23, 2020, 12:34:15 pm
Here a graphics scientist, Dennis Bautembach, explains how one works with voxels in a real world software. Basically you do raytrace voxels, but only to produce a draw list, similar to the triangles draw list at given LOD. After that you have to pass that drawlist into the traditional vertex shader, which applies stuff like distortion from bones stretching the body tissues. Very clever compared to my idea of subdividing the octree into octants directly during the raytrace process. But that stretching by cube size increase, while avoids holes, still doesn't allow wide scale single direction stretching, since it stretches in all directions.

Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 25, 2020, 09:24:50 pm
Implemented variable sized voxel layers.

Only now I can probably implement the importing of Command & Conquer models.

Gives a good idea how much effort and thought were put even into some older 2d games, the apparently simple early Westwood RTS games.

And my code is horribly inefficient, despite being rewritten into C and optimized with octrees.

Would be interesting to see the original voxel editors Westwood and Hexplore devs used. There is a fan made Voxel Section Editor https://www.ppmsite.com/vxlseinfo/ but it is really heavy weight and draws with actual OpenGL cubes.

Anyway, beside creating the actual assets for the game, I also plan to use this editor to produce 3d intro and outro movies. Although it will require implementing perspective projection. Since the orthogonal one would be too artsy, then again, there can be multipoint projections, which are apparently easy to implement in a raytracer :D

(https://i.imgur.com/eM5S8HP.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on July 26, 2020, 02:47:31 am
And my code is horribly inefficient, despite being rewritten into C and optimized with octrees.

C? Did you drop C++ or from beginning it was written in it? If you did it, I would suggest keep C++ compiler because it had more restriction that allow 1% speed increase in same code base:
https://www.youtube.com/watch?v=Nand3PEV1p4
Doom written in C converted to C++ give you small speedup, bit ironic compare to what usually people say ablaut C/C++ differences.
Of corse if you try use naive OO you will loose speed, but great thing in C++ is that you do not have to.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 26, 2020, 03:08:55 pm
C? Did you drop C++ or from beginning it was written in it? If you did it, I would suggest keep C++ compiler because it had more restriction that allow 1% speed increase in same code base:
https://www.youtube.com/watch?v=Nand3PEV1p4
Doom written in C converted to C++ give you small speedup, bit ironic compare to what usually people say ablaut C/C++ differences.
Of corse if you try use naive OO you will loose speed, but great thing in C++ is that you do not have to.
From the beginning it was written in my own language - Symta, which is inspired by Common Lisp, but without GC. I use Symta for everything, beside resource intensive parts, which I rewrite into C. I have strong aversion towards C++, due to multiple reasons.
1. For low level language C++ hides too much stuff, and for a high level language it is too clunky and segfaulty, while templates produce real mess, and other devs on a team will always harass you if you use a macro instead of a template, because Bjarne said something somewhere about macros being the tool of the devil.  I.e. C++ is more of a strict religious cult, one has to better stay away from.
2. C++ indulges what Joel Spolsky called "architecture astronautics", akin to building a grocery store at Alpha Centauri, so clients will fly a rocket there to buy an apple. I.e. C++ offers a lot of tools that impede and complicate thinking. That is job security for sure, but not when you're working on a personal project, which you want to just get finished in as quickly as possible, so you can use it to say create art for you game.
3. Finally, C++ has no proper ABI, it is a thing in itself.  Major C's fault is unrestricted pointers which can reference the same memory, so compiler can't make any assumptions. But that is actually a boon, since you can always explicitly restrict pointers, when you're sure about it. It is funny since I learned C++ before C, but then gradually downshifted to the plain C.

The real speedup would come from transferring to GPU or at least implementing multithreading, but I have integrated GPU, and my CPU has just two cores, so I don't bother. Furthermore, transferring to GPU is the last stage of development, since need the design to be rock solid. As of now I'm just learning 3d graphics, since that is my first ever 3d project, so I didn't know for example, so I was unsure if one can combine world model/world scale/rotation/translation into a single operation, and then reverse it just as efficiently, solely by applying transformations to the camera. As I learned it is possible both with zbuffer composition and with the second order octree. Apparently space bending and compression are possible too, so perfect soft body voxel animation can be achieved. In fact, there is a guy who implemented exactly that using voxel grid as base:

Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on July 26, 2020, 05:47:11 pm

1. For low level language C++ hides too much stuff, and for a high level language it is too clunky and segfaulty, while templates produce real mess, and other devs on a team will always harass you if you use a macro instead of a template, because Bjarne said something somewhere about macros being the tool of the devil.  I.e. C++ is more of a strict religious cult, one has to better stay away from.
You are not representing Bjarne stance correctly, macros had couple big flaws that make hard to work with them, like
Code: [Select]
FOO(a + b) <===> 5 * a + b
BAR(++i) <===> foo(++i, ++i)
std::max(i, j) <===> std:: (i < j ? j : i)
This is why Bjarne SUGGEST to do not use them, in most cases templates are superior replacement for macors, but in cases where you effective generate code they should be still used, I did exactly this in OXCE, I made big meta-template library but at some point I was forced to use lot of macros for class generation.

Bjarne want that in long run macros will be removed from language but this will need new functionality that do not exist yet in C++, unit then there is still cases where you need use them, but most typical C use cases are not correct for C++.

I even make macro names more ugly with prefix `MACRO_`:
https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Engine/Script.cpp#L46


My favorite example of superiority of tempates over macros is my:
https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Engine/ShaderDraw.h#L39
A lot of C++ code that finally is converted to sse instructions


2. C++ indulges what Joel Spolsky called "architecture astronautics", akin to building a grocery store at Alpha Centauri, so clients will fly a rocket there to buy an apple. I.e. C++ offers a lot of tools that impede and complicate thinking. That is job security for sure, but not when you're working on a personal project, which you want to just get finished in as quickly as possible, so you can use it to say create art for you game.
You can impede and complicate thinking in any language you want, if it have enough tools this is doable, and C++ is not exception.
Another thing is you use correct tools then make opposite, see `std::unique_ptr` and `std::shared_ptr`. With this two helpers you can nearly remove all memory problems because every function will be statically analyzed for correctness. And if every function is correct then whole program is correct. You can't do something like this with normal pointers.
I can verify this in OXCE script code, I had only once memory problem in my code base and this was because I do not initialize one structure correctly (and this was during developing new feature).
And my code is complex as hell and allocate a lot of memory (and hard part is it do this only when its really needed).

3. Finally, C++ has no proper ABI, it is a thing in itself.  Major C's fault is unrestricted pointers which can reference the same memory, so compiler can't make any assumptions. But that is actually a boon, since you can always explicitly restrict pointers, when you're sure about it. It is funny since I learned C++ before C, but then gradually downshifted to the plain C.
This is true, you can't easy link with C++ code but you already have escape hatch in `extern "C"` that create plain C functions that can link.
For pointers, but how many times you miss this addnotation and because of this optimization opportunity?
In some computation kernel you can easy manually adjust this to have best performance, but what about 99% of rest of code base that have millions of lines?
In C++ you have this by default. Of corse in some context is not easy to disable them (especially if you want to be fully conforming with standard).


I very like C++ (especially new version C++17) but I do not negate it have flaws but if you write your code correctly you will never have problems with them
but if you have wrong approach then you will have only pain when working with it (including missing limbs).
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 26, 2020, 08:06:56 pm
Another thing is you use correct tools then make opposite, see `std::unique_ptr` and `std::shared_ptr`.
Using shared_ptr is called "reference counting garbage collection," which is a very inefficient way to manage memory. Now when user clicks quit on a typical C++ app (or the next level begins loading in your game), it freezes for a few seconds, because the code goes into destructors, freeing millions of these pointers, instead of just returning to OS. Even worse, it hides all that underneath. I.e. it is the tool which will lead you astray, while in C you just malloc all the memory required for your program at the startup, then partition it trying to avoid fragmentation, instead of doing millions of malloc calls for each tiny object. That would also allow you to easily dump the data structure onto disk, to either load it in future or debug the problems with it. Not something you can do with classes, having rt-info and links to the methods table.

But I wont be arguing further of that. It is a matter of taste what use for the high level language. But I personally use C only for the most performance critical parts, while C++ is used when people write the whole project in it.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on July 26, 2020, 09:12:15 pm
Using shared_ptr is called "reference counting garbage collection," which is a very inefficient way to manage memory. Now when user clicks quit on a typical C++ app (or the next level begins loading in your game), it freezes for a few seconds, because the code goes into destructors, freeing millions of these pointers, instead of just returning to OS. Even worse, it hides all that underneath. I.e. it is the tool which will lead you astray, while in C you just malloc all the memory required for your program at the startup, then partition it trying to avoid fragmentation, instead of doing millions of malloc calls for each tiny object.
This is comparing apples to oranges, if you can replace hundreds of mallocs by one then you should do same in C++, both smart poiners are needed when you have:
A) shared ownership where and undetermined lifetime, pure hell in C
B) unique ownership and undetermined lifetime, easy to make wrong if you forget one `free` in C



That would also allow you to easily dump the data structure onto disk, to either load it in future or debug the problems with it. Not something you can do with classes, having rt-info and links to the methods table.
If class is POD you can do it too, and if you can put it in array then is not likely you will need any rt-info.
One of my TODO list for OXCE is remove virtual table from surface what in 90% use cases is completely pointless.

But I wont be arguing further of that. It is a matter of taste what use for the high level language. But I personally use C only for the most performance critical parts, while C++ is used when people write the whole project in it.
And I could not agree more with this, high performance code look similar in C and C++, to have 100% you need drop lot of abstraction to make it work.
If you look on my `ShaderDraw` code you would be see "C" code that was written in C++ with all benefits of tools from it.
But in other parts of code where performance is not critical I can use high abstraction technics even if they have overhead it make code easier to write.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 26, 2020, 10:21:55 pm
This is comparing apples to oranges, if you can replace hundreds of mallocs by one then you should do same in C++, both smart poiners are needed when you have:
A) shared ownership where and undetermined lifetime, pure hell in C
B) unique ownership and undetermined lifetime, easy to make wrong if you forget one `free` in C
That is why you don't use C for larger projects, only for building blocks. C was an okay language to build Unix, when it was broken into many small commands. It is still an okay language when you break your app into modules with well defined APIs, debugged separately, so bugs (especially memory bugs) don't become global. Yet memory bugs, use-after-free, use-before-init, and especially the unbound array indices, are the most persistent bugs, which are absent in higher level languages - you just cant corrupt the memory there, resulting in further data corruption in unrelated places, expressing itself in strange ways (the so called heisenbugs).

But generally resource management problem cannot be solved by C++'s RAII. It solves only a subset of the problem, meantime adding a subset of how it can fail. That is true for all statically typed program correctness checks. And, due to the halting problem, it is generally impossible to verify that a program performs correctly. In fact, it will take you more time to write all the verification boilerplate than to debug even some more sneaky heisenbugs. But never the less it can help in some limited cases, like when you are trying to verify some very safety critical software, where failure leads to the loss of many human lives. Even then verification is done for very small subset of the code. I.e. that the data will always be in some range or in some metric, so untyped/mistyped values wont sneak in by accident. It is not worth doing that for a video game, even if failure could mean some server downtime (the server can be just restarted by a watchdog code, or have a degree of redundancy).

Anyway, working with compressed and uncompressed (i.e. non-euclidean spaces) the first thing one will notice, is that zbuffer cant be trusted anymore, because distances lose meaning in the common sense. One has to somehow uncompress distances. For simpler case of linear comression one can simply multiply zbuffer value by the compression factor and add the displacement, but in more complicated cases something else will be required. Guess I should stop here now, since I don't ever plan becoming a professional graphics programmer. Soft body voxel animation is not required for my game, and the produced art will be retouched manually anyway.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 29, 2020, 02:57:38 am
Final voxel operation is the boolean composition, like the cut by a layer or merging two layers into one. Booleans are a bit tricky, since to be of any use, they must allow for rotated layers. Then again, doing booleans in polygonal graphics is order of magnitude harder - even Tom Hudson (the developer of the original 3ds max prototype - cyber studio) had to put some effort into it:
https://doudoroff.com/atari/cad3d.html
Quote
The biggest coding challenge in the project was writing the 3D Boolean algorithm. This is one of the most complex tasks in 3D work and the Atari’s floating-point routines really weren't up to the task. It took weeks of work to get the Boolean code stable enough to work in most cases, and I swore I’d never write another 3D Boolean algorithm!

Usually these are the first operations one will implement in any voxel engine, but I was since the beginning more interested in projections, since I already have 2d isometric assets which I need to convert into voxel form. Compared to Photoshop, the order of layers is not really important since their drawing is resolved by zbuffer and/or raytracing (which resolves even transparency!), but it is still useful to determine what will be merged into what.

Additionally the voxel brush placing and erasing single voxels needs a preview of what will be added and removed, otherwise it is very easy to misplace stuff. Guess I can seamlessly implement preview with z-buffer compositing. Large scale painting is not required to be of any accuracy and can be used to paint say islands.

So yeah, next step is layer groups and animation.

(https://i.imgur.com/GMXTaMr.png)
(https://i.imgur.com/e8pj4KO.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 31, 2020, 08:01:19 pm
Ok. Since the boolean operations code was very buggy (I worked with the naked basis vectors), I had to transition everything to use matrices. Now it is much simpler, works correctly and I have also found a bug that the world was reversed this whole time, and the models were standing on their heads (but they were okay on screen due to reversed Y), and X-axis rotation code was incorrect (which led to several subtle bugs). But since matrices enforce more rigorous thinking, that became obvious. With matrices one can also compute the matrix inverse, but it is not really necessary for most cases, when you know how the original matrix was produced and can do all the steps in reverse. In that way matrices are very similar to stack - you have to backtrack your steps precisely. I have always though that matrices are reserved for intricate math stuff like neural networks, higher dimensional spaces and group theory, while computer graphics uses them only for gimmicky purposes, but it is not so - they reduce the number of bugs even in simpler programs. Lesson learned: use matrices, even for 2d - they reduce the margin for error.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on August 05, 2020, 01:04:45 am
Trying to implement the voxel interpolation with a few advanced raytracing techniques. I've also learned that the tensor space deformation is not really required to implement the proper soft body animation with voxels. One can do it in the plain euclidean space in a much more simple and elegant, albeit related, way, employing the same algorithm used to render fractals. But it apparently works only with octree, since it needs fractal structure to be efficient. I.e. you can't apply it to the plain grid.
(https://i.imgur.com/juPZmxa.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on August 12, 2020, 06:28:11 pm
Still working on the voxel engine. After converting it to use SIMD, it can run relatively fast even on a single CPU PC. Along the way I've also invented the algorithm to properly raytrace octrees (likely invented long before me), which mapped nicely onto the SIMD vectors. My math and programming knowledge was barely enough for that. Now with a proper BVH implementation, I can probably start converting The Spell of Mastery to use the voxel engine. I will leave the 2d character sprites, but all the tiles will have to be converted to facilitate camera rotation and illumination. It will also need some new algorithm to remove the occluding items between the camera and the cursor. No idea how to properly draw 2d sprites in a 3d engine. Likely it will require to stay with the orthogonal camera (i.e. final fantasy tactics style), so no full motion cutscenes. Although I remember Diablo 2 having this "perspective mode". BTW, people are working to decompile Diablo 2: https://github.com/OpenDiablo2/OpenDiablo2 (they have already managed to de-compile Diablo 1 completely).

Anyway, voxel objects can actually be scaled along x,y,z axis in a non-destructive way. Say you can extrude a very long column from a tiny voxel circle, and it wont take that much memory, but one will have to find some other way to texture it into something other than a single color.

(https://i.imgur.com/gPam7Js.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on August 28, 2020, 12:29:55 pm
A bit more progress. Now it takes a few minutes to paint the scenes like below. Which makes me believe than one can indeed have Minecraft with with more continuous voxel worlds, without making it look like a professional 3d package. Then again, it all comes down to good metaphors. Computers were once controlled with switch boards, completely obscure to the untrained people. And voxels are probably the easiest way to create any graphics. I have also got rid of the 4-projections layout, since it is the artifact of polygonal graphics and is not really required for voxel editing.

Anyway, now I have a few ideas for a minimap for The Spell of Mastery, since the current minimap shows only the top level. With a properly optimized voxel structure one can have a 3d minimap. In addition, I can reuse the faster raytracing code, instead of marching the ray to test visibility. That is currently a huge bottleneck, especially I would want to allow realtime-with-pause mode like in the XCOM Apocalypse.

(https://i.imgur.com/OpnCYM7.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on September 02, 2020, 01:19:16 am
Implemented the classic Command & Conquer style voxel shading. Instead of drawing actual cubes, it draws solid color, shaded by a normal. C&C had very efficient code to draw them: first normals were precomputed, second normals quantized as 8-bit indices, similar to paletted bitmap images. Such indices can apparently by efficiently mapped into screen space, without matrix multiplication. Generally such method gives much softer look, than if actual cubes are rendered.
(https://i.ibb.co/9Whxm3n/Screen-Shot-2020-09-02-at-01-10-45.png)
(https://i.ibb.co/55B6P7x/123.gif)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on September 08, 2020, 10:33:42 pm
Still working on the voxel editor/engine. I've adapted much faster voxel raycasting algorithm from the Nvidia's paper ( https://www.nvidia.com/docs/IO/88889/laine2010i3d_paper.pdf ) it is lightning fast, so raycasts can be used without any hesitation now.

Also, Ukraine has X-COM internet provider. They have appropriated even the X-COM logo :D

(https://i.imgur.com/HcdIg9D.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on September 09, 2020, 01:40:27 pm
We have a computer chain with that name in Poland, but appropriating the logo is a whole new level. :D
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on November 25, 2020, 09:17:34 pm
Hi ya, folks! I'm in Netherlands now. Refugees here are forbidden to work, so I don't have much to do, beside learning the Dutch language and programming. Hope making some progress on the game soon. My GF got covid19, she was hospitalized and has +40C for several days. So it is not a joke and not overhyped. Stay safe and wear that damn mask in shops - that is where she got the covid.
Title: Re: XCOM Inspired Fantasy Game
Post by: davide on November 25, 2020, 10:52:36 pm
Good luck to you and your girlfriend!
 
The covid does not scare, I do not know your age, but it does not only affect old people, I directly know two sportsmen of less than 50 years of age who have been hospitalized with oxygen, helmet and pronated twice a day for two or three weeks and now with a long rehabilitation time ahead
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on November 26, 2020, 12:12:18 am
Good to see you again.

btw "Refugees here are forbidden to work", how its this work in long term?
Title: Re: XCOM Inspired Fantasy Game
Post by: Stoddard on November 26, 2020, 10:57:54 am
Also, Ukraine has X-COM internet provider.


There is https://www.xcom-shop.ru/ (https://www.xcom-shop.ru/) and has been since 1994. A coincidence? I do not think so.

 
Title: Re: XCOM Inspired Fantasy Game
Post by: Solarius Scorch on November 26, 2020, 11:25:48 am
Hey, we have them in Poland too...
https://www.x-kom.pl/
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on November 26, 2020, 07:48:48 pm
Good to see you again.

btw "Refugees here are forbidden to work", how its this work in long term?
In a year or so they either approve the residency permit or decline the application, and tell to leave the country. Unfortunately during this time you can't work even online and outside of Netherlands (i.e. having clients in America or Russia). At least that is what the immigration people told me. Some refugees here do work unofficially (i.e. ladies work as babysitters), but if they get caught at this, they will get into troubles. NL is not Ukraine, where they don't care what you're doing, but a Germanic country, so here is Ordung.

Most refugees from Russia here are LGBT people, and I'm unsure if NL accepts political refugees from Russia. NL still buys Russian gas, and by accepting some anti-Putin refugee you basically spit into Putin's face. Now Putin can say "no cheap gas and oil for you", and NL will have to become the first country to use exclusively electric cars. Or Putin can setup a few provocations on your territory, and you will get some unrest. Then again, NL is also the first country to suffer from the effects of global warming, given that NL is below the sea level, and Russian hydrocarbons increase the sea level, especially since Putin sells them like no tomorrow, angering even Saudis. So it is all a bit complicated.


Good luck to you and your girlfriend!
 
Thanks!

The covid does not scare, I do not know your age, but it does not only affect old people, I directly know two sportsmen of less than 50 years of age who have been hospitalized with oxygen, helmet and pronated twice a day for two or three weeks and now with a long rehabilitation time ahead
Yeah. She is less than 30, but it hits young people pretty hard too. In addition she was greatly exhausted by her supermarket job: in Russia and Ukraine they don't have any worker rights or unions (USSR destroted everything), so employers compete at scamming and forcing people to overwork, sometimes doing night shifts, since supermarkets work 24/7. Guess I should add mandatory holidays for the squaddies into the game.

There is https://www.xcom-shop.ru/ (https://www.xcom-shop.ru/) and has been since 1994. A coincidence? I do not think so.
Definitely not a coincidence, given how popular the game was in Russia.

Hey, we have them in Poland too...
https://www.x-kom.pl/
At least they use a different X, and K instead of C.
Title: Re: XCOM Inspired Fantasy Game
Post by: tarkalak on November 27, 2020, 12:11:01 pm
Hey, even Elon Mush stole it in x.com.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on November 27, 2020, 12:54:30 pm
Did X-mens stolen it too? :D
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on December 31, 2020, 08:07:05 pm
Hi, folks!

I'm back in action. But still working on the voxel editor part. In fact, I had devise an entire new programming language based of C, but adding features from C++, because C is just unsuitable for the linear algebra stuff and refactoring, yet I don't want to use C++. I also have my own ideas on how to implement inheritance, so it will be more useful. In future I will rewrite the Symta runtime in this C extension. For now, I need to maintain several versions of the same SVO structure, which is best done with classes. It also supports `auto` and `typeof`, even for non GCC compilers, so now I can be sure these non-standard features are always available, since I control them. In fact one use of such meta-compilers is to maintain compatibility across the different compilers and the different versions of the same compiler. For example, GCC is well known to break compatibility on major version changes.

Anyway, parsing GCC-compatible C code and then patching it back was some experience. It is not a CFront-style compiler, but actually a patcher, since it doesn't generate code, but patches the expressions inside the existing C-code. I had doubts it will ever work with the recursive structures, but it worked rather smoothly, although with some hacks. Hope I will finish the voxel editor soon, or at least implement enough functionality to create some cheesy intro movie for the game :D

Here is for example the AST walker extracting declaration:
Code: [Select]
sym_t *pg_declof2(cnode_t *n) {
  if (!n) return 0;
  if (n->id == N_BLOCK) { //for GCC block expressions
    return 0;
  } else if (n->id == (IDENTIFIER|N_TERM)) {
    sym_t *s = lookup(n->text);
    if (s) {
      return s;
    } else {
      return 0;
    }
  } else if (n->id == N_EXPR) {
    return 0;
  } else if (n->id == N_BEXPR) {
    for (; n && n->id==N_BEXPR ; n = n->tail) {
      sym_t *decl = pg_declof2(n->head);
      if (decl) return decl;
    }
    if (n) {
      return pg_declof2(n);
    }
    return 0;
  } else if (n->id == N_DECL) {
    return 0;
  } else if (n->id == N_UNARY) {
    char c = n->head->text[0];
    if (c == '*') pg_declof_ptr_lv--;
    else if (c == '&') pg_declof_ptr_lv++;
    return pg_declof2(n->tail);
  } else if (n->id == N_INDEX) {
    pg_declof_ptr_lv--;
    return pg_declof2(n->head);
  } else if (n->id & N_TERM) {
    return 0;
  } else if (n->id == N_SIZEOF) {
    return lookup("_cext__int");
  } else if (n->id == N_CAST) {
    cnode_t *type = n->head->tail;
    cnode_t *decl = n->head->head;
    yyltype_t loc;
    memset(&loc, 0, sizeof(loc));
    cnode_t *ident = cnode(IDENTIFIER|N_TERM, 0, 0, &loc);
    ident->text = strdup("_cext__tmp");
    cnode_t *d = cnode(N_DECLARATOR ,ident, decl->tail, &loc);
    return push_decl(type, d);
  } else if (n->id == N_LIT) {
    if (n->head->id == (I_CONSTANT|N_TERM)) {
      return lookup("_cext__int");
    } else if (n->head->id == (F_CONSTANT|N_TERM)) {
      if (n->head->text[strlen(n->head->text)-1] == 'f') {
        return lookup("_cext__float");
      } else {
        return lookup("_cext__double");
      }
    } else if (n->head->id == (STRING_LITERAL|N_TERM)) {
      return lookup("_cext__char_ptr");
    } else if (n->head->id == N_SIZEOF) {
      return lookup("_cext__int");
    }
    return 0;
  } else if (n->id == N_DOT || n->id == N_ARROW) {
    sym_t *s = 0;
    int sptr = pg_declof_ptr_lv;
    pg_declof_ptr_lv = 0;
    sym_t *l = pg_declof2(n->head);
    int expr_plv = pg_declof_ptr_lv;
    pg_declof_ptr_lv = sptr;
    if (!l) goto dot_end;
    char *name = n->tail->text;
    char *tname = pg_typename(l->type);
    if (!tname) goto dot_end;
    char *mname;
    int plv = ptr_level(l->decl) + expr_plv;
    if ((n->id == N_DOT && plv != 1) || (n->id == N_ARROW && plv == 1)) {
      mname = sjoin3(tname, "_mf_", name); //field accessor
      s = lookup(mname);
      free(mname);
      goto dot_end;
    }
    mname = sjoin3(tname, "_m_", name);
    s = lookup(mname);
    free(mname);
dot_end:
    return s;
  } else if (n->id == N_CALL) {
    if (n->head->id != N_DOT) return pg_declof2(n->head);
    n = n->head;
    sym_t *l = pg_declof2(n->head);
    if (!l) return 0;
    pg_declof_ptr_lv += ptr_level(l->decl);
    char *name = n->tail->text;
    char *tname = pg_typename(l->type);
    if (!tname) return 0;
    char *mname;
    sym_t *s;
    mname = sjoin3(tname, "_m_", name);
    s = lookup(mname);
    free(mname);
    if (s) return s;
    return 0;
  }
  return 0;
}
Title: Re: XCOM Inspired Fantasy Game
Post by: Thermite on January 10, 2021, 11:37:42 pm
I have been away since forever!
Your work seems to be going amazingly!
Congrats Nash!
Title: Re: XCOM Inspired Fantasy Game
Post by: Galdred on February 01, 2021, 06:20:21 pm
Hey!
That's a pretty impressive game project! I really like the Amiga/Atari aesthetics, and the flooding is impressive!


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)



I am working on another pretty different XCOM inspired fantasy game, and I decided to go with hexes for the same reasons you recommended them, more or less.
What triggered me the most with squares was that formations don't work if both sides are not facing each other from the main directions, which should happen a lot in a game with large maps and fog of war (because you cannot have proper Zones of controls with squares).

However, it has been a huge pain to make walls and buildings, so I am still really torn about the issue. It really makes the wall tiles hard to read in term of blocking movement and LoS.


(https://i.imgur.com/VVwIQhW.png)
The NW->SE walls don't follow the hexagonal lines which causes all sort of issues.
I should have gone with natural caves instead of constructed walls.

So I am not sure you really were wrong about picking squares.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on March 22, 2021, 07:48:26 pm
Hey!
That's a pretty impressive game project! I really like the Amiga/Atari aesthetics, and the flooding is impressive!



I am working on another pretty different XCOM inspired fantasy game, and I decided to go with hexes for the same reasons you recommended them, more or less.
What triggered me the most with squares was that formations don't work if both sides are not facing each other from the main directions, which should happen a lot in a game with large maps and fog of war (because you cannot have proper Zones of controls with squares).

However, it has been a huge pain to make walls and buildings, so I am still really torn about the issue. It really makes the wall tiles hard to read in term of blocking movement and LoS.


(https://i.imgur.com/VVwIQhW.png)
The NW->SE walls don't follow the hexagonal lines which causes all sort of issues.
I should have gone with natural caves instead of constructed walls.

So I am not sure you really were wrong about picking squares.

Astonishingly good looking project! As for implementing the hex tiling, check Age of Wonders games. Especially the first AoW, which had walls for castles and dungeons.

I myself currently got dragged away with all the refugee life issues and the camp management now threatening me for filming a fight (they believe that all happening in the camp must stay in the camp). Although I have finished my own C-like language (called NewC), featuring an extended macro processor, which fixes all the issues impeding me from using the old CPP. Had to do that, since I really dislike C++, but still for the voxel editor I need custom types, like vec3 and bounded checked arrays with O(1) push. I can't do the voxel editor in Symta, since performance is really so critical. The NewC is not so much a compiler, than a very tricky rewriter (I'm not that crazy to implement my own optimizing compiler), replacing `vector.x` with `vec3_get_x(vector)` and `auto` with proper types. Obviously it is totally incompatible with C++, doing the right thing in the wrong way, breaking every single C++ textbook good practice, and encouraging the use of macroprocessor instead of templates. In fact, that is one of the reasons I had to re-implement the macroprocessor, because the C's one, while turing complete, is just too clunky to use for anything beyond basic `#define PI`

Anyway, I have rewrote the core voxel format several times, implemented the OBJ importer/exporter, developed a few voxel editing techniques, and got some insight into deforming the voxel models without SDF. Which I could use maybe for Spell of Mastery 2, since it really requires GPU.

TLDR: parsing C using C is much easier than writing a voxel editor, which is much easier than implementing a video game. Like an order of magnitude easier.

(https://i.imgur.com/CPdI7El.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on March 25, 2021, 01:34:20 am
Ok. Refactored the macroprocessor into standalone library around 2000 sloc. Now it can be used to preprocess say Lua code. Dunno if anybody will buy it at itch.io and I have no idea where one can sell C/C++ code, or what price to set for it. Usually people just give it free of charge for no reason or attach some crazy copyleft license like GPL. Still it is in C99, so could be used with any project, even to generate HTML pages from templates. I personally will use it to preprocess the game code and config files. Sometimes it is just so much easier to do a lexical macro, than a syntatic one - and generally they solve orthogonal problems than happen to have similar subsets.

Code: [Select]
New C macroprocessor improvements over the original C preprocessor.
- Succinct declarations: instead of `#define PI 3.14`, we now have `#PI 3.14`
  `#if #SYMBOL` instead of `#ifdef SYMBOL`
  #once, instead of `#pragma once`
- Calculate arbitrary functions!
    #fac(n,x) #if n>0 fac(#[n-1],#[x*n]) #else x #endif
    fac(10,1) //factorial of 10
- Ability to redefine punctuation, like `+` and `-`, and to do it only in the
  specific context of another macro.
- Nested macros with different scopes, just like normal C variables.
    #x 123
    x //expands into 123
    #{
      #x 456 //shadow the x defined above
      #<x=#[x+1]> //increment x by 1
      x //expands into 457
    } //interior x gets out of scope
    x //expands int 123
- No need to escape newlines with `\`:
    #foo {
      printf("hello");
      printf("world");
    }
- Much easier to use variadic args. For example:
    #last([xs],x) x
  picks the last element of the arglist.
- Macros can be defined anywhere, not just at the start of line.
  For example:
    #x 123
    #y #z{456} x z
    y
  will expand into `123 456`
- Macros can be expanded inside of strings.
- Macros arguments can be inserted into strings:
   #foo( x, y ) "#x+123+#y"
- Allows calling an external program with arguments. For example:
    #+ -
    #(echo "a+b")
  will expand into `a-b`: first external `echo` command is called with "a+b"
  Then then its stdout is being macroexpanded.
- Special builtin command #(say ...) printing to stdout. Useful for debugging.
- Nested / * * / comments.
- When a function-like macro invokation has no () arglist,
  NCM takes as the arguments everything up to the newline or the //-comment
  That would allow user the create elegant looking DSLs.
  Or use NCM to preprocess assembly files:
    #myopcode(a,b) {...}
    xor ax, ax
    myopcode bx, ax
- Available as a single header library and can be used to preprocess
  other languages, like GLSL.
- Escapable comas in arg list.
- A way to change `#` to another character, if you use the macroprocessor to
  preprocess a language where `#` is used for, say, comments.
- Auto adding extension ".h" to files without one.
- And much more!
Title: Re: XCOM Inspired Fantasy Game
Post by: Galdred on March 25, 2021, 12:41:10 pm
Astonishingly good looking project! As for implementing the hex tiling, check Age of Wonders games. Especially the first AoW, which had walls for castles and dungeons.

I myself currently got dragged away with all the refugee life issues and the camp management now threatening me for filming a fight (they believe that all happening in the camp must stay in the camp). Although I have finished my own C-like language (called NewC), featuring an extended macro processor, which fixes all the issues impeding me from using the old CPP. Had to do that, since I really dislike C++, but still for the voxel editor I need custom types, like vec3 and bounded checked arrays with O(1) push. I can't do the voxel editor in Symta, since performance is really so critical. The NewC is not so much a compiler, than a very tricky rewriter (I'm not that crazy to implement my own optimizing compiler), replacing `vector.x` with `vec3_get_x(vector)` and `auto` with proper types. Obviously it is totally incompatible with C++, doing the right thing in the wrong way, breaking every single C++ textbook good practice, and encouraging the use of macroprocessor instead of templates. In fact, that is one of the reasons I had to re-implement the macroprocessor, because the C's one, while turing complete, is just too clunky to use for anything beyond basic `#define PI`

Anyway, I have rewrote the core voxel format several times, implemented the OBJ importer/exporter, developed a few voxel editing techniques, and got some insight into deforming the voxel models without SDF. Which I could use maybe for Spell of Mastery 2, since it really requires GPU.

TLDR: parsing C using C is much easier than writing a voxel editor, which is much easier than implementing a video game. Like an order of magnitude easier.

(https://i.imgur.com/CPdI7El.png)
Thanks! I did play all the AoW (except 3) a lot actually. I am sorry about your refugee camp issues. It is a real disgrace that we in the West created so many, then handled the problem in such an inhuman way. I hope your situation will get sorted soon enough. In which country are you now? The Netherlands?
Regarding selling your code, you can just call it an engine, and you should be able to do so, but with everyone using Gamemaker, Unity or Unreal Engine, it is harde to compete (the one I use, Moai, got completely destroyed by the competition of Unity, because it lacked tutorials, documentation, and things like the asset store, which come with a large user base).
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on March 25, 2021, 05:44:05 pm
Thanks! I did play all the AoW (except 3) a lot actually. I am sorry about your refugee camp issues. It is a real disgrace that we in the West created so many, then handled the problem in such an inhuman way. I hope your situation will get sorted soon enough. In which country are you now? The Netherlands?
Yeah. I'm in NL for now. I believe Age of Wonders developers are Dutch, and Dijkstra too! :D
Fallout 1 and 2 also had hexes and rectangular walls.

Regarding selling your code, you can just call it an engine, and you should be able to do so, but with everyone using Gamemaker, Unity or Unreal Engine, it is harde to compete (the one I use, Moai, got completely destroyed by the competition of Unity, because it lacked tutorials, documentation, and things like the asset store, which come with a large user base).
Well I doubt you can use C/C++ with Unity (it is C# only) and a macroprocessor is not really a video game engine, but a general text processing utility (like a regex library), which you can use for all sorts of things.
For example, if you want unique numeric ids in your config file, you can write
Code: [Select]
    #count 0  //a variable like macro
    #next() {#<count> #<count=#[count+1]>} // define a function like macro
    next() //expands into 0
    next() //expands into 1
That can also be used to implement gensyms in C/C++

Then plain C/C++ doesn't support optional and keywords arguments, yet one can still have them using macros:
Code: [Select]
    void foo(int x, int y, int z) {...}
    #foo(x,y=123,z=abc) foo(x,y,z)
now foo macro will supply the default values for y and z,
and user can also call
Code: [Select]
foo(456,z=789) too supply argument only for z

it is a single header library, so it can be piggybacked to any text input.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on March 25, 2021, 11:34:42 pm
Well I doubt you can use C/C++ with Unity (it is C# only) and a macroprocessor is not really a video game engine, but a general text processing utility (like a regex library), which you can use for all sorts of things.
MS created C++/CX or C++/WinRT that allow to interact with C# types (exactly with CLI). In theory this could work for Unity too.
At leasy you run pure C# code that simply call C++ dll using p/invoke.

Then plain C/C++ doesn't support optional and keywords arguments, yet one can still have them using macros:
In recent C++20 standers you could write something like this:
Code: [Select]
foo({.x = 5, .y = 6});
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on March 26, 2021, 03:36:19 pm
MS created C++/CX or C++/WinRT that allow to interact with C# types (exactly with CLI). In theory this could work for Unity too.
At leasy you run pure C# code that simply call C++ dll using p/invoke.
In recent C++20 standers you could write something like this:
Code: [Select]
foo({.x = 5, .y = 6});

I believe Unity uses its own implementation of C#, and I'm not even sure if there is any proper FFI interface. Unity is like a walled garden, and its users expect everything to be in Unity format. Unreal Engine appears to be a much better alternative, since one can use any language with it. I think there is a need for a more general source code marketplace, like stock photo sites. No idea why none have appeared in all these years.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on April 13, 2021, 03:51:42 pm
The progress is slow, but steady. Most of the work is on the New C language, which now includes most of the C++ features and few of its own, yet in a way that makes them useful for my programming style. I.e. I want to do IntVar[bit] to test if a bit is set in particular variable, without introducing a standalone bitfield struct, and New C allows me defining [] for builtin types. I also prefer composition over inheritance and macros over templates, but C++ isn't really about it.

Anyway, I have implemented loaders for the Ken Silverman's Duke Nukem engine voxel files. His format, instead of octrees, uses RLE and has visibility mask for each voxel column, allowing to render voxels really fast on 90ies hardware, with the limitation being that voxels are axis aligned (most older games had hacks for rendering axis aligned stuff). Still very impressive. Would be cool to see a Duke Nukem mod for OXC.

Next target is refactoring the Symta lisp implementation to support JIT, and then continuing to work on the game. Without JIT, it the complexity gets out of control (I can't reuse the interpreter core for ingame data) and I can't debug the game while it is still running, having to rely on stack traces.

(https://i.imgur.com/90XOCMJ.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on April 13, 2021, 10:43:35 pm
For some reason I believed that the original 1995 Command & Conquer had voxel sprites, because these tanks rotated rather smoothly and had voxel looking shading. It didn't. Instead it used RLE compressed sprites with a lot of angles, and in case of tanks, turrets were drawn separately. Only Tiberian Sun had voxels, and just for a few larger units and aircrafts.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on April 14, 2021, 04:51:47 pm
Westwood Tiberian Sun models are hollow inside and have holes in the bottom. That makes it non-trivial to properly calculate normals for them (without patching the holes manually). Yet the normals are stored inside these VXL files (in the form of indices into one of the normal tables). All that makes me believe that, that Westwood people haven't used any voxel editor to create these models, but instead rendered them from the usual 3d mesh, created with the old boring polygonal editor. There is also no existing footage of the Westwood voxel editing tool.

On the opposite side, Koen van de Sande created actual voxel editor for C&C ( https://www.tibed.net/voxel ), which modders used to draw a ton of new voxel models for the game. It is a rather tedious process, since the editor has no real 3d view, instead showing sections of the model, so modders have to set voxel individually. As I understand, that project was part of his BSc diploma: http://voxelcoloring.sourceforge.net/

Apparently that was one of the first true voxel editors in existence.

(https://i.imgur.com/5a45Cr9.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on September 03, 2021, 07:46:25 pm
Goed avond, folkje!

Recently I did a total overhaul of the Symta language, fixing most of the issues which were discovered during the game development.
In addition I've added support for the bytecode interpreter, so now I can execute Symta code during runtime as a script.
That allows to introspect and modify the game engine while it is running. I can't stress enough how useful it is for debugging.
The code itself is being lexically macroprocessed using https://nashgold.itch.io/new-c-macroprocessor
The same macro-processor I use to preprocess my C code.

The Symta code now looks more like Haskell.
Here is an example of the function parsing `if/then/else`
There are several version of `if` syntax - one normal if A: B else C` and `if:`, which is more like Lisp's `cond`
In addition during the transition phase I have to support the older `if A then B else C` form, till I clean the code out of it.
Code: [Select]
parse_if Sym =
  OCol Sym.src.1
  if is_next `:`:
    T expect `:` Sym
    X parse_offside 0 0 Sym.value Sym.src.0 OCol
    ret  :: Sym X.0
  Cnd Then No
  Head parse_xs 1
  if is_next `then`:
    Cnd = Head
    T expect `then` Sym
    Then = parse_offside 0 0 T.value T.src.0 OCol
  else
    if Head.end or not Head.0^token_is(`:`) then
      parser_error "missing `:` for" Sym
    Cnd = Head.1
    case Cnd [H [K [@L] [@R]]]: when K^token_is(`or`) or K^token_is(`and`):
      Cnd =: K [H @L] R //huge kludge
    Then = Head.2
  Else:
  if is_next `elif`:
    T expect `elif` Sym
    GInput =: T.retok(`else`) T.retok(`if`) @GInput
  if is_next `else`:
    T expect `else` Sym
    Else = parse_offside 0 0 T.value T.src.0 OCol
  :Sym Cnd Then Else


So I hope to continue working on the game.
I have already made it work with Windows in rather botched way.
Shadows are really buggy, since on Windows I compile with GCC and it doesn't have the proper SSE code for alpha blending.
Main menu is also slowed down to 1 frame per second. And I have no idea what causes it.
I had to disable pthreads, since the Windows version is just agonizingly slow, taking 1 second to perform the stuff that should be microsecond.
That is due to very slow switching, even when usleep gets explicitly invoked.
Moreover, I don't have access to a real Windows machine, so Virtual Box add its of quirks.
TLDR: a ton of issues to solve.

(https://i.imgur.com/JQ7Jm1L.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on September 03, 2021, 09:51:57 pm
Code: [Select]
Shadows are really buggy, since on Windows I compile with GCC and it doesn't have the proper SSE code for alpha blending.What version of GCC you used? I couple of times play with SSE and windows version support it.
One solution used by OXC and OXCE is https://mxe.cc/
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on September 04, 2021, 12:20:49 am
Code: [Select]
Shadows are really buggy, since on Windows I compile with GCC and it doesn't have the proper SSE code for alpha blending.What version of GCC you used? I couple of times play with SSE and windows version support it.
One solution used by OXC and OXCE is https://mxe.cc/
Some old version, I have stashed on the virtual machine image.
It doesn't have all the Xintrin headers.
Code: [Select]
#include <emmintrin.h>
#include <smmintrin.h>
#include <xmmintrin.h>
#include <immintrin.h>

And the mouse sampling frequency problem is related to SDL working improperly with the Virtual Box driver, which intergrates mouse and clipboard with OSX, so one can use mouse without the mouse cappture.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on October 27, 2021, 12:57:20 pm
My voxel editor, VoxPie, finally sees the first public release
https://nancygold.itch.io/voxpie

I have also learned a bit about video editing by creating a trailer for it.
And now I better understand the requirements for making the animation easier.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on February 15, 2022, 07:28:50 pm
Cheers! Breaking with my bf really affected my sanity, but Im still alive :P
Most of the changes went to the Symta - the Lisp programming language dialect behind the game.
But I'm working on the game itself now, which required refactoring the entire codebase, due to the language changes.
I've completely settled with the background story, blending all the elements I had in mind, so that they will drive the gameplay nicely.
The demon invasion is still there but it gets proper development now.
Think about XCOM organization existing as a contractor for some time, before the actual alien invasion, but then gets redirected to fight it.
And the stuff XCOM does during that time affects how the alien invasion will proceed.
Obviously my game has mercenary organization, instead of XCOM, but otherwise it is the same.
Yeah I'm using the extra-planar demons instead of aliens, because fantasy and stuff, but Might & Magic had space demon aliens too in a fantasy setting.
Almost connected all the points to make the game completable from start to finish.
Even after that it will require a ton of polish. The ideas.txt list is like 100kb, while the todo.txt is 50kb.
And TODO has the stuff I really need in game for it to play right.

Currently working on the basic intro movie. I thought about adding a simple storyboard for now, but syncing it with music and voice acting will be huge pain. I can put it together as a standalone movie, but it will require some decoding library, which will need some syncing too. The final goal is to do that movie in my voxel editor for the moderately cheesy effect.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on February 18, 2022, 11:32:51 pm
In XCOM player gets funding of the world governments.
I decided to overhaul it a bit, and instead make the player fund the oppressor.

As of now it is a % of the player's income and it will grow with time up to taking most of all player's money.
But it can be reduced by completing the king's quest (inspired by King's Bounty  :P)
But I consider also adding a flat tax for the low income scenarios.
In case player does crafting or a lot of freelance questing, hiding the money from the crown.
And it would also launch other systems, like forcing player to take debt to pay the tribute.

Now I was thinking about a more refined extortion hierarchy, and when player becomes the king there will suddenly be a need to pay tribute to the gods.
Or I can start the player as a serf, or a free person without any land. But for the v1.0 it will be that simple, because scope creep is already enormous for a single person indie game, which I need to finish before I either gain asylum in NL or will have to suicide to avoid deportation. In case I will have to kill myself, I will release everything into the public domain before taking the pills. But the project is so huge and already too so many years, I doubt anyone would be able to continue it or rewrite from 0.

(https://i.imgur.com/93FkjAf.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on March 05, 2022, 01:39:13 pm
Amazing! There is now fighting at places, like Obolon, I walked a year ago in Kyiv :(
The Borispol airport I took flight from got bombed  :'(
A Kyiv trans girl who supplied me hormones is missing, while the friends family hides in the country.
Putin doesn't play tactics games, but Z-erg rushes like it is Starcraft. Or is it a Z-ombie Rush?!!
For Ukraine it looks like a tower defense game with huge columns of mobs going to kyiv ignoring everything.
And Zelensky armed every single Kyiv hispter. Even girls now have AK-47.
I really should have stayed and re-applied, instead of running away. Today Ukraine needs any support it can get.
So I have decided: my next game will be fully voxel, revolving around a self-defense squad in Kyiv.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on May 31, 2022, 07:45:38 pm
Still alive.
Implemented something I previously thought impossible:
Large scale objects inside a cubic lattice based isometric engine.
It allows 3 levels of exposure: interior, exterior and floor only views.
Separate case is when mice cursor is on top of object roof.

I have also implemented tileset based large objects.

Guess it is the most baroque isometric engine ever.

(https://i.imgur.com/a930iaW.gif)
(https://i.imgur.com/vRvSl8p.jpg)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on June 09, 2022, 12:48:59 am
Finally finished importing all the tower parts.
These stack on top of each other, plus additional occluding sprites.
Occluders are required, because compared to the original XCOM, my engine cells dont have walls.
I.e. if one wants a wall, it has to be a separate cell, like in Magic & Mayhem, on which I based my design.
Now for art and compactness purposes I need to hide sprites beside say this tower top's rail, so I draw this rail as separate sprite with different draw order.
Calculating collision with such occluders will be additional challenge, but I don't need it for a fantasy game.

Obviously the tower will require retouch, because originally artist drawn it smaller, since back then I was unsure about the sprite size.

(https://i.imgur.com/QYL4GdV.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on July 09, 2022, 11:52:20 pm
Have to overhaul the magic system again. Initially it was based of reagents, with the idea being "reagent = ammunition", since the game began as a fantasy XCOM. Yet I always found ammunition management to be the most inconvenient thing in XCOM. In my case more complex spells require several reagents (think your soldier has 10 guns, each uses a combination of ammunition - insane!). Now I have also introduced the gods system, and these gods are heavily interlinking with magic system. For example, severing god's influence in the realm will affect spellcasting of that god's dependent spells. There is in fact a way to block all other players from spellcasting, while retaining that power. Of course I can enable/disable spells per player, but the most robust way to implement is by switching spellcasting from reagents to to global mana pool Master of Magic style. But I have colored mana, there are several mana pools. And these mana pools are refilled based of player relationship with gods (player controls god's temple, player gets that god's mana). Finally there is the good old alchemy - converting gold to mana, and the other way around. I like that idea more, since it develops on top of Master of Magic design. But yeah, it further deviates from XCOM. And previously I have already abandoned the idea with ammunition like arrows and cannon powder. Maybe I'm just less autistic on HRT to appreciate the ammunition concept being explicit in game design and now try to streamline everything. Because I'm also looking on making all encounters faster and maps as small as possible. But I never liked the "hunt that last alien" concept. But yeah, there are already fantasy mods for OpenXCOM, so guess people can get exactly that. I'm better of trying alternative designs.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on August 14, 2022, 10:47:35 pm
The project is not dead... yet.

I have redesigned the mana system. Now there is single mana color, but it is capped by the number of crystals players has.
Crystals are a rare resource and a way I bind multiple systems now.
Player uses them to hire more powerful units, construct advanced buildings and just advance the game.

Currently I'm working on making the chapter 1 completable.
Basically the game is broken into loosely connected chapters.
Where the agency player represents gets hired to solve different problems.
Since I think single "demon invasion" thing would be really boring.
And I don't feel well just copying the original XCOM, without re-imagining everything.

The first chapter is about player rescuing a princess, so I needed a princess sprite and had to draw one.

This time I decided to finally create a human character base, so it will be easier to produce different human sprites.
Just draw the clothes and weapon over the existing animation. But these make for really boring copy-cat characters.
So will be used mostly for NPCs, like city civilians, which player can capture for different purposes, like sacrifices and magic experiments.
Yeah there is this reverse-XCOM mechanics, where player plunders cities. Actually inspired by Hammer of the Gods (and old DOS game).

(https://i.imgur.com/GToU0bK.png)
(https://i.imgur.com/IYDeQOr.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on September 03, 2022, 11:17:57 pm
Finally the princess got into the game. The paperdoll system still needs some refinement.

(https://i.imgur.com/YDTF0zw.png)(https://i.imgur.com/KGSszhB.png)
(https://i.imgur.com/M8vJ311.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on September 10, 2022, 01:03:29 am
Base system works surprisingly well, but the project scale is getting even more out of hand.
(https://i.imgur.com/Kits6zl.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on September 11, 2022, 03:39:13 pm
It is kinda tricky to combine male and female bases with the same set of clothes and equipment, but I kinda did that, due to the art style being half-way chibi. I think I can also dynamically generate dwarf versions too, which is kinda mandatory, since the short characters can pass through passage that are unavailable to tall ones. Generally making a good pixelart base is an alchemy. But it is kinda mandatory for a dynamically generated game, where characters and encounters have to unique. I have 24 frames of animation, which have to be duplicated among all clothes, but weapons can be added dynamically.
(https://i.imgur.com/NEfN0Lc.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on September 23, 2022, 01:56:02 am
Still working on the base system.

Had to implement the animation script level XY frame positions for all directions, so I can reuse the same frame at different positions
Code: [Select]
                aware
                xy -4 -2  xyr 4 -2 point
                xy 0 -10  xyr -2 -10 atk1
                xy 8 4    xyr -8 -4 atk2
                xy 8 4    xyr -8 -4 atk3
But I think the right thing would have been calculating these in the world space, not the screen space, so this xyr duplicate wont be required for the 180 degree version of the anim.

Now some big layers can't be easily composed into a base, which is limited to 96x96 frames, for numerous development reasons. Therefore I have to render say winged characters using some hacks, just because the wings are so big.

(https://i.imgur.com/MtSzv7c.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on September 27, 2022, 04:50:13 pm
Given the introduction of paperdoll/base system, I decided to rethink the entire character/tech tree.
Before I just had some creatures attracted by buildings, akin to Dungeon Keeper.
These creatures came with predetermined equipment and abilities.
There was an inventory system and equip-able items since the beginning.
The equip-able items were a minor gimmicky thing, which gave small bonuses like +1 to defense.
Creatures had no progression, outside of the polymorph spells, which changed the creatures.
It was okayish, but offered no uniquiness to different creatures of the same type.
So now I decided to overhaul it and move closer to XCOM and Final Fantasy Tactics.
Equipment will be a huge thing now, and having a hook will be required for humanoids to scale walls.
There will be further creature progression, like humanoids will be able to grow wings.
Example is that flying zombie from the previous post. Think of it as flying armor from XCOM.
Before there was a ring of flying artifact giving flight to any no-flying character.
But it was really bolted on, without any character development and tech level.
I'm fixing it now. No, not with character jobs, but with a novel system, which fits nicely with city building.
Also I still wont be introducing experience or job/class experience, since I'm not making an RPG game.

In fact, no RPG elements is the 1st of the 3 design guidelines I use
1. No experience/character-classes or other D&D nonsense.
2. No randomness for action result. Even if the result appears to be random, it still depends on the world state (i.e. phases of the moon). Basically when I want something to be random, I make it depend on many factors, some of which are non-obvious or unseen to the player. Then I introduce abilities to access these factors.
3. A gameplay feature, which forces player to plan in advance, is a good one. So in my game design book, requiring spellcasting to take some time is a good idea. Yet more powerful spellcasters should have lower casting time. That alone gives player so many options: pick a weak spellcaster, who will do the job but take it long and will require you to plan further, or waste money on the expert one. And this 3rd rule indirectly helps implementing the 2nd one, because player choices introduce randomness, which is not as annoying as dice roll, because if player fails, that is the player's fault.

Anyway, now I have to draw a ton of pixelart myself, for the basic stuff like outfits. I don't hire artists anymore, since cheap artists produce too low quality art, so even I can already do a better job, while professional artists require fulltime employment and really huge salary. Then a lot of effort is wasted communicating what is required, and even I myself don't completely understand how it all should. This entire thread demonstrates doing new stuff, instead of just cloning Final Fantasy Tactics or XCOM, requires a lot of R&D, and sometimes taking breaks so I can return with a clean head and news ideas.

(https://i.imgur.com/O6aXCMU.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on October 02, 2022, 09:21:57 pm
After a bit of further R&D I decided to scrap all the humanoid artwork and move to a new base:
(https://i.imgur.com/F9yRxh4.png)
The old base was too chibi, not flowy/edgy enough and had practical issues.
If the old base was heavily FFT inspired, then the new base is basically a complete HoMM2 copycat.
I don't want to copy XCOM style bases, because with all due respect, XCOM pixelart was far from being perfect.
I think I can do better even with my programmer art skills.
And I really love the HoMM2 graphics, over HoMM3 and HoMM4, despite HoMM4 being my fav game design wise.

In fact I borrowed several ideas from HoMM4, as that game had nice adventure feel, similar to the Rings of Power on Sega Genesis. And I liked the bottom-up approach to character classes, where the heroes gained classes based on their skills. For Spell of Mastery I came up with a 4 primary attribute system: ador, craft, faith and bond (BAFC - bond-ador-faith-craft). These variables (which I call talents) control how passionate the character is (risky vs careful), if the character prefers clever way to solve problems, if the character is faithful into the chosen god and the own action and if the character has good skills on forming bonds (basically D&D charisma with a huge twist). Then there is also chaos, order, life and death system (which I call COLD), which combines with the attribute system. Together they control what the character can ultimately do. And it is not possible to create a universal do-it-all character by setting all attribs to max, because say high ardor character will have numerous development branches closed, especially on the path of order, yet at the same time have development branches open on the path of chaos. And then all characters begin as commoners, your usual human beings, and moving to the path of order or chaos will require special rituals, which are not always possible (that is being controlled by the COLD attributes). The humans are jacks of all trades, and yet even a high-tier human mage can't compete at order magic with the one on that path, especially if such mage has aptitude towards order. For humans BAFC+COLD together produce the "cosmos" determinant, which basically says how cosmopolitan and generalistic the character is and if it can succeed as a human being, and characters with high cosmos can't succeed on the non-human paths.

But that all is mostly for the background, since the characters player will hire, although can develop further, will come with all the skills necessary for the game. So it is not required to understand this system or do through character to play the game. It is more for my own convenience to add depth to the game, so characters wont feel static and will have unique personalities. Give that I have 5 sates per each attribute, and there are 8 attribs BAFC + COLD, and I have 5**8 = 390625 different possible psychological profiles for characters. That is not much, but beside these static talent profiles, characters have dynamic skills, which although determined by the talent profile, can changed through training. The training state of these skills actually determines the character class. To generate the mercenaries for player to hire, the engine actually does the backtracking from the class requirements to skill, to talents. Basically it isolates a subset of all profiles matching that class, and then picks one at random. Similarly to how Prolog does it. Again, that happens behind the scenes and player doesn't really need to understand it. But it is impossible to implement with pen and paper, so I hope I drifted far enough away from D&D by turning the core idea behind it inside out.

I know for people accustomed with D&D such name will sound crazy, but I believe character systems should be more about psychological side, and appears to transition nicely into actual game mechanics code. Moreover, this system runs on top of the existing gene and gene-expression system, which is more about the physical fitness and status ailment (like the character being poisoned, losing limbs or eyes). That COLD system was actually featured in several prior games, among them Lords of Magic and HoMM4, which completely abandoned the previous Might & Magic games elemental approach for this math styled based axiom system, which then expands into the elemental things, as a side effect. Lords of Magic still had water/earth/air/water elements on the same level as the chaos/order/life/death, but the designers there, despite being really smart and innovative, had cloudy understanding of what they are trying to achieve. Recently a new game, Songs of Conquest, stole a lot of ideas from Lords of Magic, including its city development approach and the unit stack size limitations (as  a fix to the single-hero issue of the original). Another HoMM clone, Hero’s Hour, took real time aspect of it, plus the army composition display on the world map, instead of just that single boring hero sprite. Hopefully in 25 years or so, somebody will finally make an ideal HoMM style game, with all the design issues fixed.

That all seems so insanely complicated, but my game began as basically a Warcraft II engine implementation ( https://www.youtube.com/watch?v=-k8jkeFfnl0 ), back then in pure Common Lisp (SBCL compiler), which I then ported to my own Symta language. And it was actually a full blown Warcraft II implementation, copying 1-to-1 the AI behavior and I even had all the spells were implemented. Compared to Spell of Mastery, the WC2 project was really simple and took me just two month to implement in Common Lisp. Then I decided to turn into my own thing, and I planned to make a puzzle game akin to DKPuzzle.pud map for WC2 and CoreWars, because WC2 engine is basically a cellular automata, and therefore inherently puzzle friendly. So there was idea on combining all kinds of puzzles into a Rube Goldberg device, with a bit of strategy elements. But then I decided that 2d is too boring, and the game really needs 3rd dimension. WC2 tile engine was unsuitable for that, so I turned it into an isometric engine, very simple at the time (the one I currently have uses dependency graph to implement the painter algorithm). But then I found that solving sokoban puzzle in real time, while enemy attacks you, as a bit annoying. So I added pause. That haven't improved the gameplay too much. So I moved the game completely into turn-based mode. Initially it had a final fantasy style / heroes of might and magic scheduling, where units moved in accordance with the speed, which is basically an extension of the Chess scheduling of player moving 1 piece a time. In fact you can add this scheduling to Chess, and at one point I actually tried giving units actual chess like movement patterns. That worked but was kinda gimmicky and the scheduling proven to be too annoying, since turns were too short and player was interrupted by AI moving its piece. So I moved to the XCOM style whole team turns. And then it was like... fsck it! I'm making an XCOM clone, but with everything different from XCOM.

As a former Warcraft II engine my game had no accommodation for character development, but it had a system of dynamic status ailments for spell effects like haste and bloodlust. That system was also used for unit upgrades and the units inside of buildings. And everything dynamic, including inventory, was built around it. It allowed somewhat complicated stuff, like the WC2 flame shield spell, of flame sprites rotating around character or the blizzard spell projectiles falling down. In fact, I abstracted it into gene and gene expression concepts. Yet the problem I encountered now is that genes are hardcoded into unit type, which was shared across different units. And when you move to unique characters, there is just no type and every character has to carry all necessary genes. So now I'm struggling with getting rid of the static class system. But I still have to maintain it for static objects, like tiles and trees and rocks. Then again, maybe all trees and rocks should be unique too? Modern PCs have resources for that, but I was always into premature optimization, unnecessary limiting myself by making everything static by default, even inside a dynamic language. Anyway, it is still an RTS engine, and at one point I had a bug, of several units moving at once, out of their allocated action points, since the engine can schedule such movement.

Anyway, dunno what to do with the old art. Guess I can sell it for a few bucks. Still a shame I lost so much work due to bad planning.

(https://i.imgur.com/hyuYuzT.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on October 05, 2022, 01:35:27 am
As part of the style review, I decided to lower the overall brightness a bit. Especially the one of that grass. Because high brightness sets a bit different tone from what I decided on now.
(https://i.imgur.com/9cobRob.png)

Also there is a yet another tactics game, Inkulinati. But this one is special. Usually tactics games are played on a 2d map, and preferably 3d (XCOM, Final Fantasy Tactics, Fallout Tactics, etc...), but this one is 1d. Not even a variation of height are present. Basically tactics game dumbed down to its absolute essence. There was also an 1d RTS, called Kingdom, also played on a line, without platform jumping or height variations. In addition to thembed down controls to just 3 buttons (left, right and action). Not super exciting to play, but really interesting game design wise, since it had everything an RTS expected to have.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on October 18, 2022, 10:17:09 pm

(https://i.imgur.com/1dpV4mm.png)

As you already know the main challenged I took is avoiding the dice roll.
The foremost reason is that I want to deviate from the classic D&D-style gameplay and come with my own thing.

More math/physics-inclined people know that "randomness" is basically an abstraction, and immediately see that by discarding it one basically plays God (who doesn't play dice, as Einstein noted). In physics randomness arise when we don't fully understand the system and can only comprehend about it using statistics. That doesn't mean the system is random. That means we are ignorant.
Basically its workings are in the "fog of war" So if you remove randomness, you have to be explicit about the underlying process.

In my case I need more advanced character interactions. Say a character can lose when parrying a powerful attack blow. In D&D you just throw a dice and 5% of times the character will lose weapon. But how can one implement that in a deterministic way? I have solved that by introducing a horoscope system, where each character has future, which can be discovered by paying oracle and even changed. Basically it is a log of predetermined future events, based of the character's birth date plus current date. It looks like your classic pseudo random number generator, but it is not, cuz the rules it uses are much simpler and can peeked at by the player. This system is really tricky to implement, but it greatly changes the gameplay, exposing the process behind randomness to the player, at sufficiently high "tech level" Suddenly you have future prediction and manipulation magic school, which actually works!

So in the end the limitation was a boon. I actually created something different from the casual D&D, without losing anything. So yes, characters can still miss and fail, but in a completely deterministic way, where player can accommodate for that. Obviously such system can be back-ported to the original XCOM, but with a species of time manipulating aliens. But for D&D that will require a lot of time to setup the game, since dungeon master will have to determine in advanced, what will happen to the characters, instead of using the dice.

Basically what I came up with would better called "controlled determinism", because I add only as much determinism as required for the game rules, but without fully determining everything in advance and allowing for player input.
Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on October 18, 2022, 11:15:12 pm
More math/physics-inclined people know that "randomness" is basically an abstraction, and immediately see that by discarding it one basically plays God (who doesn't play dice, as Einstein noted). In physics randomness arise when we don't fully understand the system and can only comprehend about it using statistics. That doesn't mean the system is random. That means we are ignorant.
Except when we have wave function collapse that effect is random, and there no way to have "hidden variables". Classic physic is indeed predictable but this is only abstraction over random system :>
Title: Re: XCOM Inspired Fantasy Game
Post by: kevL on October 19, 2022, 06:37:02 am
pilot wave theory!

(ok ill shutup now -- i heard it has problems)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on October 20, 2022, 09:23:55 pm
Except when we have wave function collapse that effect is random, and there no way to have "hidden variables". Classic physic is indeed predictable but this is only abstraction over random system :>

As I understand it is random only for the observer, because the observers' measurement abilities are limited. And since observers can't observe the full state, they can't predict the next state. Say there are two cinemas in a town, they show different movies from each other. These theaters reside on two different islands on a lake, now there is just a single boat which can take visitors only to one theater, and the movies in the other remain unseen and the theater may as well go out of the business, but in the end it is the consensus of the viewers which decides what movies will be seen, therefore people see only what they want to see and the future becomes a self fulfilling prophecy. Now what if there are two boats or three theaters, or some islands share a combination of theaters or sub-lakes with sub-boats and sub-theaters on these sub-islands inside the islands on the original lake, ad-infinitum? Is that the kind of multiverse/wave-function sampling we are talking about? In a fantasy game we can have say an "oracle" character, who sees the future. And in a sci-fi game there will have to be an oracle device, operating beyond the bounds of known physics, which allows it to predict the future, that way there could be a way to sample the entire state or just short circuit the time dimension (like H.G.Wells's Time Machine), about which science isn't fully sure what it is, since different events happen at different time for different observers. In other words neither time or space are simple linear euclidean dimensions, although they look like that to us. And it makes no sense to treat them as linear in a fantasy video game with gods and magic directly deciding the fates of mortals. Say a character got cursed by a god? What will that imply? How to describe such curse in game world? Character's "luck" stat got reduced by 5? How should somebody's luck affect the game world? By a dice roll? What about collective luck? Should inanimate objects be "lucky"? I.e. that wall was unlucky when alien plasma shot melted it. If so, given two "unlucky" individuals (XCOM operative and the common house wall), which one will catch the alien plasma shot? I think that is just really intangibly and generic, so introducing a forward log of events sounds like a way to embody it into something both game engine and players can reason about and manipulate (aliens can affect the unlucky house wall's luck, so their shot will hit the XCOM operative). Nobody likes it when their character misses 10 times in a row, and there is a way to solve it - by being explicit about determinism and luck.

Anyway, stumbled XCOM RL dev's presentation. Rogue-likes are a nice a way to get into recreation-type gamedev, without doing it super seriously and learning GPU shaders or doing pixelart / 3d-rigging.

Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on October 20, 2022, 10:10:55 pm

As I understand it is random only for the observer, because the observers' measurement abilities are limited. And since observers can't observe the full state, they can't predict the next state.
No, your measurement do not have any technical limitations, physic limits what we can measure, we have Uncertainty principle, Bell's theorem, and example of Double-slit experiment where measure change effect of experiment. And whole "no hidden variables" means exactly that there is no "full state" that we do not see, and only thing is wave function and its collapse that is govern by density of probability.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on October 20, 2022, 11:43:02 pm
No, your measurement do not have any technical limitations, physic limits what we can measure, we have Uncertainty principle, Bell's theorem, and example of Double-slit experiment where measure change effect of experiment. And whole "no hidden variables" means exactly that there is no "full state" that we do not see, and only thing is wave function and its collapse that is govern by density of probability.
The point is that it is just theory, which is based of the local observation. There are no hidden variables, because we never seen them. Like the movie in the theater we never visited, because the boat went to another place today. If one day aliens abduct you and you find yourself on a flying saucer, thousand light years from Earth, you wont have a slightest idea where you are and what is going on on Earth, especially if the saucer has no window (i.e. no proof that the sun is still shining). Basically you are as good as in a different universe. So distance coupled with the light speed limit creates a separate universe. Recently they launched a new telescope and it changed the existing theory, which had holes in it, because the observation became less local. But still there is an optical limit to what we can theoretically see from here. Blackholes too have structure unknown to us, and could as well have their own plank distance, which could end up varying over the space, instead of being constant. But well, they are "black" to us, because we can't observe them directly. Same with the Schrodinger's Cat. We are not yet sure even about our own Sun's structure, because the processes happening inside of it are rather complex. IIRC, there was a paper proving they are turing complete. In other words, there is a life possible inside of the star itself. TLDR: it makes sense to remain open minded, without making any hard predictions and unchangeable plans, so there will be no disappointment when the predictions fail, because we were ignorant about something.

Anyway, here a rogue-like author contemplates on the nature of randomness and determinism in the time travel based games:

Title: Re: XCOM Inspired Fantasy Game
Post by: Yankes on October 21, 2022, 03:09:34 pm
How this even related to for example Double-slit experiment (especially when single photon interfere with itself)?
Every thing is local and can be closed in finite box and separated from rest of universe, and you still have random quantum effects. Or simply checking position of one electron, if you check it repeatably it will always give SAME answer, but if you one time check its speed then next check for position will be have random result, but second check for its position after it will return same value as previous check.

Another fun experiment is light polarization filters that if you put two that are rotated by 90 degree then it will block 100% light but if you put third between and its angled by 45% then whole stack of filters will pass some light. If you add multiple filters angled only by 1 degree to next one then whole stack will block araund 10% light. And more importantly this will work even if you send ONE photon.

And all this is not "theory" this is simple observation that you can do yourself in some cases in your home. Current physic could be wrong about Black holes or beginnings of universe but how this affect observing one electron/photons before you or other closed systems?

And more importantly if even some theory is proven wrong, next one better will include most of old one.
Like Ptolemy solar system was replaced by Copernicus, then by Kepler, Newton and finally Einstein. Predictions of oldest model one are included in newest.
Example could be "Mars do not cross Earth orbit in next 100000y", this is true in every of this theories and will be true in next one too.

Same with current physic theories that have lot common with Ptolemy solar system that in most cases fit model to data, but any theory that is simply and supersede old one will preserve nearly ALL results of old theory, like Newton physic is effective special case of more general Einstein physic.

btw do not try understand Quantum Mechanic using your own examples that do not match any experiment because you will only confuse yourself.
Take real experiment and analyze it precisely and try build mental model that will fit all observable behaviors. Like in your "example" what is "boat" exactly? what is "theater" or "viewer"? How it relate to experiment results? This is only empty words in this case, unrelated to sub atomic reality.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on October 21, 2022, 05:38:20 pm
How this even related to for example Double-slit experiment (especially when single photon interfere with itself)?
Every thing is local and can be closed in finite box and separated from rest of universe, and you still have random quantum effects. Or simply checking position of one electron, if you check it repeatably it will always give SAME answer, but if you one time check its speed then next check for position will be have random result, but second check for its position after it will return same value as previous check.
The problem is that you checking the electron state affects it.
I.e. you as an observer reside inside the system you observe.
Think of an XCOM operative, armed with a blaster launcher, in a complete darkness.
Now the only way to see anything is by firing the blaster launcher
That lights up the environment, but at the same time destroys part of it.
And what parts you will see, and what parts get destroyed depend on where you target.
In other words, electrons are so basic, we can't see them without changing them.

Returning to the game. I decided to completely scrap the square lattice and introduce hexagons to the battlescape, in addition to employing my voxel engine. As I mentioned before, square grid wasn't my conscious choice, just a legacy from the time the engine was a Warcraft 2 clone, running on top of Common Lisp. And finally it became so unmaintainable, I need a huge refactor plus redesign.

Back when I began I was really naive and had no idea what I'm doing and why it will be klunky. But as any writer I scrap earlier works and build upon them.

At first I thought hexes will make it hard to have rectangular structures, but there is a really nice solution to that: just allow diagonal walls. And voila! We have all kinds of shapes combining nicely together, without any hacks!! Hexes will really simplify the code, making maintenance easier, since I will use the same rendering code both for world map and for site map. Hexes by their sole nature make game world look more organic without any effort. And the new cell format will be closer to the XCOM one: walls plus core. That will save screen space, and allow to easily represent stuff like secret caves behind a waterfall.

I want to also scrap the entity system, since now it has separate entities for world map and for site map. That is really hard to develop, really bug prone and restricts what i can do with the game. Instead I will introduce to have a separate entity list, with an ECS system, where components will be activated when the entity will be given a context. I also want to accommodate for complex stuff, like controlled determinism and time travel. And existing system was proven to be inadequate for that.

Voxels are fast enough even in software on 2GHz CPU, and 3d further simplifies both the code and the graphical asset production. Fully destructible environment is nice too I.e. a magic blast could evaporate parts of the wall, without me drawing the destroyed sprite for each asset. Then I can also easily burn the grass, or tree folliage. Voxel will give player ability to easily zoom in and out, rotate, and a ton of other cooler effects. It is also possible to have pixel perfect voxel sprites, for the chosen angles. The only tricky part about voxels it is removing the occluding terrain. But it is also the trickiest part about 2d isometry. And in 3d there are many more ways to solve it.

I will have to adapt large portion of existing 2d terrain tiles and that will require improvements to my voxel editor. That is really tricky too. I.e. I will need normal mapping with the normals actually displacing the voxels. But other tiles, like soil and grass can be generates automagically.

It is really a shame I have such a horrible planning, but I can either make a just an okay game, or a good game. And to make something good, I have to scrap the stuff making it not good enough. Whne I just began, I knew nothing about voxels and how they can improve everything. My voxel editor initially was just a helper tool to produce 2d sprites. Now I'm fairly experienced with voxels. I wont be able to make more than one game in my life, so why not make a good one? Especially since I got a lot of skills with voxels and hexagons. I have already scrapped the old humanoids, because they were okay, but not good, and limited what I could implement and show, while my pixelart skills improved enough I could draw better ones (which are also dynamically assembled, so allow more animation states). Same way the current engine and lattice limits what I can do. And I really hope I can do something that will be worthy of the classic games I took inspiration from.



(https://i.imgur.com/yedSfgD.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on October 22, 2022, 07:08:09 pm
Picking the grid format, and it is the trickiest part.
Usually one goes from isometry to hexagonal isometry by first extruding the iso diamond into cube.
That cube is reinterpreted as a hexagon.
Then one squashes the hexagon by 2 to get more RPGish view, where character faces can be seen.
This hexagon is guaranteed to tile pixel perfectly.
But for my assets the hexagon is too big and it makes hard to adapt the existing cubic tiles to hexes.
Now it is not really required to squash that, and since lattice form has nothing to do with the art perspective,
For example the original Fallout used square tilemap and just piled in hexes on top.
Heroes of Might & Magic games did the same. There hexes are really tall, so characters wont obscure each other.

But in my case resulting hexagon is either too big or doesn't allow adapting existing tiles.
So I'm entertaining  the idea of allowing several characters onto a tile.
Think Ogre Battle like squads.
That opens for number of gameplay possibilities as well as increasing the game speed.
I.e. player will be incentivized to move 3 characters at once, instead of disjoint characters.
But it will make such grouped characters more vulnerable to area of effect spells.
The idea is really crazy, but I really want to try it, since I'm redoing the game engine anyway.
I.e. a cell with all 3 characters will be immune to attack from behind, while the magic user in it will be able to
cast contact spells without becoming vulnerable to attacks.
Super tricky to implement properly, but I'm looking for an interesting challenge, especially if it is something nobody did before.
Especially since I have a problem where top tier units, like dragon, can kill low tier ones before they will be able to do any damage.
And in square lattice a dragon couldn't really be ganged on, because just 4 melee attack vectors, where 2 are frequently inaccessible
Hexes have 6, and but I really want a good solution of low tier cannon fodder characters, whose names player wont bother even to read, killing a dragon.
HoMM games solved it by limitless stacks, but that is not suitable for a tactics game with unique named characters, no two of which are the same.

(https://i.imgur.com/Vl9erZL.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on October 23, 2022, 02:42:55 pm
Rectangular lattice makes it really impossible to represent organic looking structures, likes caves and nature, in a good enough rating.

With hexagonal lattice organic scenes look order of magnitude nicer, but rectangular structures are tricky to implement.
But not impossible. With a bit of effort, one can pass walls though hexes.
Making the organic logic structures with rectangle is a real challenge. XCOM solved it with diagonal walls.
Yet these walls ended up being very thin.
Hexes 3 types of square grids, two isometric looking, and the RPG-maker style.
Hex cities can have buildings at 3 angles, all with standardized tileset.
So hexes are absolutely superior to the rectangular lattice.
They look visually nice and triple the combat possibilities.

Anyway, with 64x32 hexes I still have too much screen space wasted.
I do have XYZ offsetting and placing several objects on a single tile.
I introduced it to break the nasty square lattice look, while placing trees.
But it really clunky and non-uniform.
So hard to use with the procedural map generator placing objects.

32x16 will be too small and I really dislike the idea of having non-uniform hexes.
I can see how it can go wrong everywhere and make pixel art creation harder.
So I will group the objects inside single hex by breaking the hex into 3 diamonds.
So logically it will be diamond tiling, not hex tiling.
Although larger objects will still take entire tile.

I see how this system will allow to implement more nuanced melee combat mechanic.
Even for simple one-on-one duels.
In any case, it will open a space of possibilities, tripling the potential scene complexity and saving screen space.
As I already mentioned, I see how can entire group be moved at once.
Then I also has an issues with cannon plus the gremlin operating it.
As of now I treat them as a single sprite.
But why the cannon can't be operated by any other unit?
Why can't the gremlin be killed and its cannon seized?
Finally 3 smaller trees sharing a hex make for both nice visual look and obstacle for larger monsters.
So there will be a scenario where one can hide from a horse riders in the woods, because horse requires 2 diamonds to pass.
In the end lattice choice is really about interesting state spaces and their presentation to the player.
Of course with voxels one can go without any lattice at all, but at that point it stops being a game and become a simulation.
Requiring the generic and expensive 3d calculation physics and pathfinding.
For voxel I still think raytracing as a monolithic layer, but it will be guided by the tile metadata.
But for that to happen I will really need to optimize the cutting routine to show the inside of dungeons
It is kinda expensive for large size voxel chunks, unless one runs it in parallel on GPU, and I dont have a GPU.
Then again, I'm doing everything slightly differently. Why not implement a non-uniform tiling?
Yet architecturally it will be the hardest challenge I ever faced.
So I need to really perfect the lattice code, or it will be an unmaintainable mess.


(https://i.imgur.com/ENmacQi.png)
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on October 25, 2022, 12:00:41 am
In addition I'm transitioning everything to use ECS, because a simple class based system is just not suitable for what I want to accomplish. I.e. I have a ton of static objects, but they all use the unit class, wasting a lot of memory and computation resources. I somewhat solved by introducing "active" field, which is non-nil only for objects that need to be updated regularly. But that doesn't help discerning between jut animated objects, but ultimately scenery objects and player controllable units and projectiles. Then I also want to represent the site cells as entities too. So in the end there could interplay between all entities. Like a living person could be turned to stone, and the result will be just another site cell but with an attached history, and therefore be turned back alive with another spell. And it goes very deep, like the ability to assign tooltip to different ingame objects. So simply discarding the OOP is really the way. I haven't went with ECS initially, because it began as a simple RTS engine, which I decided to turn into something more complex, and original Symta had really slow and subpart hashtables, so it was kind of an optimization. So when I began implementing the controlled determinism and time travel stuff, I found it near impossible with the current engine. So it is easier to rewrite everything into ECS, piling up spaghetti of more classes and inter-dependencies. I already had that gene system, which  was a way of emulating ECS, and I actually implemented characters inventory through it, yet it was disjoint from the game world. Usually people built XYZ coords into the base entity, but in my case I need just a raw integer UID, because the entities could be split across different worlds, each having different XYZ. Of course one can have WXYZ, but that will imply that every entity has to be multiworld, but some entities are purely local or have no world at all (i.e. a background process). So I just can't make any assumptions, other than assuming that anything is possible. Unfortunately my brain got poisoned by years of using the OOP hammer, so everything still looks like nail, but in reality OOP has very limited use, concerned solely with providing interface to low-level system objects like images or CPU threads, yet it totally fails at assembling these objects in a compete system, since there are cases where you want to treat both images and threads the same: say you need unload part of the program, together with its threads and images, or when you want to have each thread to have unique icon, or when you want each thread to render unique image, so the thread could be treated as an image. OOP will just lead you astray here.

One can also try implement game engine logic using a prototype based OOP, where objects are just hashes, but it has potential of creating more problems that it solves, since the systems and data will be heavy coupled, instead for being a combination of separate processes, activated on demand. Think each entity being an operating system, with different daemons running concurrently. One can built in everything into the kernel,but the result will be buggy unmaintainable and inflexible mess, since all the daemons have to be in the memory, running all the time. And in game engine we have millions such OS entities, all wasting resources. So ECS appears to be the only correct way to implement any moderately complex video game. But then again, even Tetris today is expected to have nice UI and particle effects, and once you have particle effects, ECS is a must. Absence of ECS was one of the reason I never came to implementing particle effect - adding yet another projectile class was really a chore.
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on October 26, 2022, 06:55:22 pm

Overwatch GDC talk, where the dev explicitly states that ECS is mandatory for properly implementing time.
And it works even with a low latency online FPS, so should good for turn-based games.
Although they also use special scripting language, whose execution can be rewinded.
Can't imagine doing something like their "short replay" easily in a non-pure system, while the game keeps running
I also decided to move from the mutable graph based UI to immediate mode UI.
It is a functional programming approach to UI, where you turn widgets into functions., instead of maintaining an OOP graph.
As a result it greatly simplifies code, especially if you're doing UI in plain C99.
But for high level languages reduction in code size and complexity is astonishing too.
Both technologies are kinda expensive, but I remember hearing that ECS was used already in Thief game.
Then had to discover ECS due to the complexity of the game game logic, compared to simpler games like Quake
Title: Re: XCOM Inspired Fantasy Game
Post by: NancyGold on August 13, 2023, 12:19:00 am
The project is still alive. I have indeed rewrote the entire UI system to ECS, and now slowly refactoe the engine to be flexible enough. UI really needs to be perfect, since there are a lot of menus and I want them to scale to arbitrary screen resolution, not just 4:3 or 16:9, and to allow users to arrange stuff like minimap anywhere they want. And I want to do that with a very few lines of code. The UI on the screenshot was made with just 30 lines. Would be challenging to do the same even in HTML+CSS. That is very important for prototyping because large portions of the UI gets rewritten continuously, during the game development.

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

I have also tried immediate mode UI, but found it to be inconvenient as an abstraction, but I do recalc widget rects every few cycles, so buttons and windows could expand to match new textual content.

One huge discovery was that the classic C++ style OOP can be completely replaced with entities (at the cost of performance). One just creates a series of classes which instead of holding the data inside themselves, fetch it from the database. That way an object could have multiple faces, playing NPC in a game world, while being a widget inside UI. I have yet to use the very advanced ECS features inside UI itself.

Another discovery was that hexagon compatible tiles can be implemented without redrawing any assets or even moving to hexes as main tile unit. But one has to implement non-uniform tiling by breaking basic square 4 pieces, and each of these 4 pieces into triangles. Now, I can use the same drawing routine, just assembling the original tiles out of triangles (if they support organic view), and 4x4 units will be allowed to take slight diagonal move. Now I can seamlessly map the world map hexes to the site map gird, while also allowing more organic looking tilesets where needed.

The time scheduling system is also being rewritten to be more robust. I found XCOM style entire party turn system is too rough and rigid. It is unable to capture a lot of stuff I want in my game. Only the Final Fantasy Tactics/rogue-like style scheduling could allow for:
1. Split of a second actions. For example, a unit has flying on a griffin steed got kicked out of the griffin by a tornado spell. In single part turn that unit will fall to the ground and die. Yet if griffin can react quickly, it could catch the rider back, or some unit on the ground could cast a feather fall spell. Same one could have a chance to save a drowning unit.
2. Seamless movement, when we control just a single unit, while other units follow us in some formation or got order to move on their own to some far corner of the map.
3. Ability for several players to move their units at once with little slow down (as long as players keep moving their characters)
4. Ability to quicker react to enemy movement.
5. Ability to avoid waiting for all the boring AI movement stuff. Think huge cities living on their own while you move your squad.
6. Ability for time magic to control time precisely.
7. Ability to turn on real-time mode with optional pause, when you just wait for your units to finish their tasks, or want to allow fast paced multiplayer. Age of Wonders tried to solve that with simultaneous turn mode, but that led to a total mess worse, where luck and fast clicking decided who win the game.
8. Much easier to implement AI. Although one would still want to have some rough long-term planning and goals for each unit.

One can still implement XCom style scheduling on top of the rogue-like one. In fact one can implement anything on top of it. That is how they turned initially turn-based Diablo into a real-time game, without rewriting the entire engine. Yet it is very hard to convert initially real-time or non-granular turn-based scheduling to support the granular mode.

I really enjoy how rogue-like scheduling works out in the games like Monstania or KeeperRL: one can be very tactical at some point, while at other points one can use the same scheduling mode while exploring a city with NPCs walking around. The total opposite would be Paradise Cracked - a Russian made XCOM clone, which had city explorations using entire-squad-at-once style scheduling. Each turn player was forced to watch each single NPC and vehicle to move across a huge map. That was the thing killing otherwise fun game. The only downside is that roguelilke scheduling (especially with large world) can be resource intensive to maintain illusion of fast response. So say Dwarf Fortress has really high CPU requirement.

I now believe that time-scheduling the is the most important thing about the game mechanics.

BTW, I now LP various obscure mostly turn-based games and XCOM mods are on my TODO list. Message if you want your fav game to be lets played. Just note that I wont LP popular, action-heavy or very uninspiring stuff (think football managers or standard JRPGs), since my goal is to discover more unusual games.