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

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #165 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.

« Last Edit: January 11, 2020, 09:12:03 am by Nikita_Sadkov »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #166 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).

« Last Edit: January 13, 2020, 03:29:45 pm by Nikita_Sadkov »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #167 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.



Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #168 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.

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #169 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.


Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3374
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #170 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.

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.

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #171 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.
« Last Edit: January 15, 2020, 05:29:21 am by Nikita_Sadkov »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3374
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #172 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
« Last Edit: January 15, 2020, 11:17:34 am by Yankes »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #173 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.



Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #174 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.

« Last Edit: January 19, 2020, 01:56:24 pm by Nikita_Sadkov »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #175 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


Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3374
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #176 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).

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #177 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.
« Last Edit: January 26, 2020, 11:57:56 pm by Yankes »

Offline Nikita_Sadkov

  • Colonel
  • ****
  • Posts: 286
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #178 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:

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11775
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: XCOM Inspired Fantasy Game
« Reply #179 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.