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

Offline NancyGold

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

Offline NancyGold

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

« Last Edit: August 12, 2020, 06:32:57 pm by NashGold »

Offline NancyGold

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

« Last Edit: August 28, 2020, 12:32:17 pm by NashGold »

Offline NancyGold

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

« Last Edit: September 02, 2020, 01:47:57 am by NashGold »

Offline NancyGold

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


Offline Solarius Scorch

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

Offline NancyGold

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

Offline davide

  • Commander
  • *****
  • Posts: 548
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #337 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

Offline Yankes

  • Commander
  • *****
  • Posts: 2528
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #338 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?

Offline Stoddard

  • Colonel
  • ****
  • Posts: 484
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: XCOM Inspired Fantasy Game
« Reply #339 on: November 26, 2020, 10:57:54 am »
Also, Ukraine has X-COM internet provider.


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

 

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 10230
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
    • Email
Re: XCOM Inspired Fantasy Game
« Reply #340 on: November 26, 2020, 11:25:48 am »
Hey, we have them in Poland too...
https://www.x-kom.pl/

Offline NancyGold

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

Offline tarkalak

  • Commander
  • *****
  • Posts: 1242
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #342 on: November 27, 2020, 12:11:01 pm »
Hey, even Elon Mush stole it in x.com.

Offline Yankes

  • Commander
  • *****
  • Posts: 2528
    • View Profile
Re: XCOM Inspired Fantasy Game
« Reply #343 on: November 27, 2020, 12:54:30 pm »
Did X-mens stolen it too? :D

Offline NancyGold

  • Colonel
  • ****
  • Posts: 145
    • View Profile
    • Email
Re: XCOM Inspired Fantasy Game
« Reply #344 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;
}
« Last Edit: December 31, 2020, 08:11:51 pm by NashGold »