Author Topic: Skybuck's Plans for OpenXCom (youtube video)  (Read 6212 times)

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Skybuck's Plans for OpenXCom (youtube video)
« on: March 21, 2022, 12:20:48 pm »
Hello,

In this video I try and answer all of your questions and I also simply try and explain what it is that I would like to try to add/implement into OpenXCom:

Lot's of stuff is covered in this video, but it is well worth a watch, at least I hope so, and that you can understand me somewhat:

https://www.youtube.com/watch?v=ljwRXdXmhPk

Feedback is welcome, further ideas, pointers, tips, links, new questions, algorithm questions/improvements, remarks, insight, anything is welcome ! =D

Planning, Goals achieved, Time/Day spent:

* Last Update 20 may 2022 *:

1. fast voxel traversal algorithm: unlimited, must get it working
started:  Tuesday 8 march 2022
finished: Thursday 24 march 2022 (in delphi and same day c/c++)
debugged it in c/c++: Friday 25 march 2022, days spent so far: 17 days.

2. line box intersection: 5 days 
started: Tuesday 22 march 2022
mostly finished: Friday 25 march 2022, days spent so far: 3 days but from those 17 days above.
Saturday 26 march 2022: acquired new cable modem in city.
Sunday 27 march 2022:  installed new cable modem at home.
Monday 28 march 2022: slept ?
Tuesday 29 march 2022: refactored fast voxel traversal algorithm, cleaned up code, tried to seperate code into process voxel method but failed and reverted it back. + 1 day spent.
Tuesday 29 march 2022: started work on new shading engine, implemented GenericMap template and basis/constructor/destructors and maps for ShadingEngine class

*overlap*:
Tuesday 26 april 2022: started work on a new ray segment box intersection algorithm, which will be integrated into (grid) traverse algorithm/data structures for efficiency and correctness sake.
Saturday 30 april 2022: almost perfected new ray segment box intersection algorithm, with floating point exceptions off it's now perfect.
Sunday 1 may 2022: explained the ray segment vs box intersection algorithm which needs something extra vs just ray vs box intersection algorithm. Created my own theoretical version to prove the algorithm, the theory, it works.
Tuesday 10 may 2022: (5 hours and 15 mins) Documented/described the (new) line/ray segment multi-grid traversal algorithm. Multi-level distance compatible traversing also using distance parameters from the new ray segment box intersection algorithm (both to maximize efficiency/re-use calculated variables):

3. grid space partioning: 7 days

4. growing bounding boxes: 7 days

5. cut voxel data with sprites: 14 days

6. light/shadow casting: 21 days
Saturday 2 april 2022: experimented with painter algorithm and acquiring surfaces for shading engine, not too usefull (yet? maybe in near-future though)
Sunday 3 april 2022: experimented with trying to collect data from painther algorithm via ShaderDraw method, was too complex.
Monday 4 april 2022: investigated draw terrain method. (Replaced/Reinvented blittNshade/shaderDraw method with simple draw sprite method)
Tuesday 5 april 2022: made it possible to draw 3d voxels/grid inside a sprite for draw terrain method (see DrawVoxelDataInsteadOfSprite)
Thursday 7 april 2022: good attempt at drawing lofts/voxel 3d + first attempt at light casting/shadow casting which was very slow and perhaps not so good yet, might need debugging. (In shadow/black yes/no for now, no distance or angle shading yet)
Friday 8 april 2022: Tried to implement multi-level/dual-level fast grid traversal. Attempt 2 was somewhat successfull, but now flickering/blinking of border cells is back, and also catched some division by zero corner case. I am considering to implement it differently using existing code to make sure everything works they way it should, by make code re-useable and then using it twice or so.
Saturday 9 april 2022: Investigated possibility of using Physically Based Rendering Technology engine version 3 and version 4, version 3 works but is slow to render, it could be used to render a cool single scene/picture of an xcom scene.
Sunday 10 april 2022: Build some new vcl engine to test realtime graphics in preparation for perhaps grid movement and control points on grid and line, then had too much fun implementing transformer graphics to test it and spent too much time trying to get audio stuck/asio 1.3 and 1.4 working for blaster vst but it was fun.
Saterday 11 paril 2022: Implemented SpriteVoxelFrame which accelerate the finding of a voxel behind a sprite/tile pixel. (Took 15 hours to implement: study code, create code, debug code, test code, I made an interesting discovery, apperently youtube/obs studio streaming limited to 12 hours, last 3 hours were cut off, but fortunately success was recorded ! ;))
(I was somewhat frustrated the last 2 or 3 days with the multi-level traversal algorithm but feel ok now. Decided to go straight into C/C++ and do some usefull work there. The plan is to re-use the C/C++ code to try and re-implement multi level traversal algorithm with existing code and ripping it apart twice for usage on openxcom scenes for tracing of lines/rays. Idea is to trace the rays in parallel step by step for maximum data access re-usage/locality. This is a more efficient usage of my time to make progress in trying to implement this feature as far as possible.)
I am happy and statified with the progress I made on 11 april 2022.
Wednesday 13 april 2022: implemented ScreenVoxelFrame (might need masks to not shade things which don't have voxel maps or units on top of it, for now I go with the flow ;))
started work on tile + voxel traversal code.
Friday 15 april 2022: VoxelRay.h and VoxelRay.cpp header/implementation continuation work: approx 4 hours. Later on the day 2 hours and 30 mins: added ScreenRayBlocks and first usage code and light exposure + angle + shade code/sketch/idea.
saturday 16 april 2022: rested a lot, also Described a new algorithm idea for processing/traversing multiple light sources efficiently by avoiding unnecessary light rays.
Also described initial idea for a more advanced voxel engine in the future. Also sun, earth, moon, dark/full moon idea and such, see video links down in postings below.
Sunday 17 april 2022: Debugged VoxelRay.h and VoxelRay.cpp for tile traversing, this should now work very well, spent 4 hours and 50 mins on it.
Monday 18 april 2022: Spent 14 hours trying to debug the "voxel traversal", which comes after the "tile traversal". Also tried to do a re-design of the code, experimented with c/c++ language features/templates. So far a mysterious bug remains.
Tuesday 19 april 2022: Rendering bug with voxel 3d map solved (called in wrong place). Tile/Voxel Traversal seems to be working good and should be in a usuable state for light casting/shadow casting/shading, but should still be tested a little bit more to be absolutely sure. Grid to ASCII tool created. Described the Tile and Map axis and coordinates on a forum posting and file.
Wednesday 20 april 2022: Spent 10 hours trying out light casting attempt 2 and 3 and also directional tile lighting, not much success so far.
Thought light casting attempt 2 shows some promise, light rays visible in trace, however there is something wrong with the screenvoxelframe or
something with the sprite frames, something weird going on, as if lower air tiles have walls or something.
Friday 22 april 2022: Spent 10 hours. Some significant progress has been made. For the first time something that resembles "perspective" shadows can be seen. Hold control + L to see it in action. Tested voxelray traversal for full x, y and z lines, seems to be working ok. Could be an interesting technique maybe for "isometric" shadows.
Sunday 24 april 2022: (Spent 5 hours) The screen voxel frame idea is finally working. Though some problems remain. There are gaps/lines between the sprites. Most likely the double vertical line in sprites in the center.. A possible solution could be to try and replicate this line inside the voxel 3d maps themselfes.
Tuesday 26 april 2022: Worked 8 hours on new ray segment box intersection test. (Working 99.9999% correct I think it is useable for openxcom ! ;)) (Also tried out strong type checking for different dimensions x,y,z and used delphi's record operator overloading, cool stuff. Spent 2 hours or so on that.) I also learned how to turn off annoying floating point exceptions in Delphi.

(Took some time off to recover from depression from my shitty graphics experiments lol... (the graphics experiments were worth it though, "it's all part of the game/improvement program ! =D" played some civ1 lol... hopefully the openxcom/light casting graphics will get better over time as I learrrrnnn and improve code and methods and algos ! ;) =D)

Saturday 30 april 2022: (16 hours spent) Almost perfected the ray segment box intersection algorithm. (In principle it now runs flawlessly if exception mask is set to raise no floating point errors. (integrated it also with traverse fields) The ray segment box intersection algorithm can now handle a single ray point, a ray on the left,top,right,bottom boundary and ofcourse inside too and intersecting ofcourse. So small extra work could still be done to make it run flawlessly if floating point exceptions are enabled by checking direction.x,y,z for zeros and writing custom/solution code for this situation, I may/could still look into this further.

Sunday 1 may 2022: (Spent 5 hours or so): Explained the difference between the ray and ray segment vs box intersection algorithm. Created and perfected my own theoretical version to prove that I understand the algorithm once and for all, 100% and thank god I did do that ! =D
 
             Intermezzo 1:

             Then watched "The Batman " ! possibly one of the best movies I have ever seen. The ambient/mood/visuals/vibe are stunning ! Definetly a must watch for everybody ! =D

             (Now today Monday 2 may 2022... I am probably going to watch Picard season 2 for a long time ! =D I have some catching up to do ! ;) =D)

             Further plan for Monday 2 and Tuesday 3 may 2022:
            And then if time, energy and clearity/motivation allows it I will probably work some more on the ray segment box intersection algorithm so that it can run with floating
            point exceptions enabled, so that means taking care of all the divide by zero problems.

             Tuesday 3 may 2022 took some time to recover from watching 9 episodes of Picard lol.
             Wednesday 4 may 2022 probably took some more time off.
             Thursday 5 may 2022 spent 8 hours analyzing difference between khabarovsk and zorkiy ship in world of warships.

                  My motivation to return back to this OpenXcom light casting algorithm is dwindling because I am starting to think/believe it might not look as good as I had hoped,
                  though I have not yet giving the shading formula a good chance. Plus I may have already spent the planned 50+ minimum ammount of days, plus I have to go do
                 some other things the coming days. So at least the next few days I will not be doing any coding and taking more time off to get some life things done !
                 Also still need to see the last episode of picard season 2 ! =D
                 Plus I am kinda longing back into world of warships ! for more multiplayer challenges, the AI in Civ1 is starting to bore me a little bit and the AI in OpenXcom is
                 probably not that interesting to play against.

Friday 6 may 2022: Spent 41 minutes trying out a potential fix, but it was not the core of the issue. I am open to any suggestions what might be the problem ! ;)
Here is the video: https://www.youtube.com/watch?v=nkoHfNEbY24

(Now I have to go do other things, later ! ;) :))

Saturday 7 may 2022: (8 hours spent) First impression of what it could look like, moving sun added, custom shading for lit and unlit, double floor voxels removed from tile.voxelmap3d. Some floor/traversal issues seem to remain for now.

           Intermezzo 2:
           Sunday 8 may 2022: Went to the super market :)
           Monday 9 may 2022: Visitted my mother

Tuesday 10 may 2022: (5 hours and 15 mins) Documented/described the (new) line/ray segment multi-grid traversal algorithm. Multi-level distance compatible traversing also using distance parameters from the new ray segment box intersection algorithm (both to maximize efficiency/re-use calculated variables): https://www.youtube.com/watch?v=Te0nmf70WN8

Thursday 12 may 2022: (4 hours spent) 1. Fixed three floating point problems with new ray segment box intersection algorithm. 2. Started work on implementing isometric mode which may have to diagnose 3D problems and also allows testing everything in 3D ! 3. Played a little bit of OpenXCom to see how tiny OpenXCom truely is on todays monitors ! =D So far so good, very cool stuff ! =D https://www.youtube.com/watch?v=_YnWLl-3Nac

Saturday 14 may 2022: (Spent 7 hours 15 mins) Wrote a special application in Delphi to analyze/inspect OpenXcom palette and extend/grow/scale it to a more advanced palette (so that each row has more shades available) with linear and cubic interpolation. The cubic interpolation needs a little bit more work, for begin and end sections, the end section might also be slighty buggy maybe ?! ;) https://www.youtube.com/watch?v=myqxefLcoOo

Sunday 15 may 2022: Tried a 24 bit version of OpenXcom. (Width is wrong) Changed OpenXcom palette analyzer to point series to illustrate the difference in palette quality.
Monday 16 may 2022: Tried yankers 32 bit support, investigated the possibilities of PBRT. Achieved/build an operational version of PBRT v4 win32. (Yaml is missing/link errors)

Tuesday 17 may 2022: (8 hours and 45 mins): Investigated the possibility of using PBRT as a static library:

Wednesday 18 may 2022: Spent the whole day messing around with trying a static library version of PBRT, failed with link errors :( Also spent time learning the PBRT file format.

Thursday 19 may 2022: (8 hours and 30 mins spent) Investigated PBRT rendering of OpenXcom map and isometric view, also write an OpenXcom exporter to PBRT format, which exports the game in real time (first draft/working version). First render of OpenXcom in PBRT ?! ;)

Friday to Saturday Night 20 to 21 may 2022: (Spent 3 hours) Cleaning up code and re-writing PBRTExport to try and generate PBRT files more efficiently, however the code has become very slow, probably because of CPU L1 cache trashing, this problem will have to be solved tomorrow/next time.

(MAYBE I AM WASTING MY TIME ON PBRT, BUT I AM GOING TO TRY IT ANYWAY, BECAUSE IT IS INTERESTING)

Yes PBRT was a big waste of time, it's a very messy project and link problems, The same can be said for other tracers, like mitsuba 2, problems with python, and intel otp probably takes forever to build and probably won't run in Win32 builds. So I am going to quite with noisy images and shitty to build and link raytracers and back to my own code !


7. light reflection/radiosity: 21 days

8. physics: 7 days.

9. export game to big voxel map: 10 days

10. loading custom voxel graphics (also for colissions): 38 days

11. dithering: 7 days

12. Transparency: 7 days.

13. Rain: 5 days.
-------------------------------------------------------------------
Minimum goals that I want to achieve (do this or die trying =D):
2. line box intersection: 5 days,   achieved.
3. grid space partioning: 7 days
4. growing bounding boxes: 7 days
5. cut voxel data with sprites: 14 days
6. light/shadow casting: 21 days
-------------------------------------------------------------------
Minimum days: 54

-------------------------------------------------------------------
Interesting extra goal:
7. light reflection/radiosity: 21 days

Easy extra goal:
8. physics: 7 days.
-------------------------------------------------------------------
Interesting+Easy days: 28 days.
-------------------------------------------------------------------


Extra/Optional goals:
9. export game to big voxel map: 10 days
10. loading custom voxel graphics (also for colissions): 38 days
11. dithering: 7 days
12. Transparency: 7 days.
13. Rain: 5 days.
--------------------------------------------------------------------
Extra days: 67
--------------------------------------------------------------------

Total days: Minimum Days(54) + Int/Easy(28) + Extra/Optional (67) = 149


(MAYBE YOU CAN HELP ME TO DECIDE WHERE TO PUT ANY NEW CODE, IN WHAT FILES ?)

(ADDITIONAL MUST HAVE FEATURE: ROTATING THE MAP TO LOOK AT IT FROM DIFFERENT
TACTIC PERSPECTIVES/ANGLES)

NEW/ADDITIONAL GOAL:

14. INVESTIGATE VOXEL COLLISION DETECTION, DETERMINE ACCURACY, PERHAPS
REPLACE AS WELL WITH FAST VOXEL TRAVERSAL ALGORITH !!!

15. Explore the possibilities of using an existing "ray tracer", especially the physically based rendering one seems interesting, especially for the hopefully easier light/multiple light implementation/support.

Bye for now,
  Skybuck.
« Last Edit: May 23, 2022, 02:11:50 am by Skybuck »

Offline mutantlord

  • Captain
  • ***
  • Posts: 90
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #1 on: March 21, 2022, 12:57:58 pm »
What is it that you are trying to achieve? If you want to contribute, just open a pull request to Meridian or Yankes for OXCE. If you are trying to create a fork for OXC and create your own new brand of OXCE, well, a lot of modders do prefer OXCE because of its already vastly available new features. So far, you have been showing off something or spamming.

Offline Yankes

  • Commander
  • *****
  • Posts: 3206
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #2 on: March 21, 2022, 05:44:54 pm »
What is it that you are trying to achieve? If you want to contribute, just open a pull request to Meridian or Yankes for OXCE. If you are trying to create a fork for OXC and create your own new brand of OXCE, well, a lot of modders do prefer OXCE because of its already vastly available new features. So far, you have been showing off something or spamming.
Only drawback is that some PR will not be included. Main reason if not match goals of OXCE. Forks usually indicate new vision how to expand engine.
This is why we have OXC/OXCE, one goal is recreate original game, other is make modding more powerful but still faithful to original game (but not exact!).



@Skybuck near 6h video? I will probably pass on watching it all. Probably other will do same, I image that you could make shorter one (at least less than 1h), by removing less important things and focusing on main points. If you would like to have some feedback, post exactly time stamps (e.g. like time 2:12:12 in video) where you ask your question.

Btw, if you try see how my lighting work best use maps that are at night, e.g.
https://media.moddb.com/images/mods/1/50/49281/screen801.png
You can see that some rooms are dark even when other room is lit next to it.

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #3 on: March 22, 2022, 03:35:03 pm »
Tuesday 22 march 2022:

Today I spent a significant ammount of time writing code and debugging code and writing more code and testing more code.

1. The main problem is the traversal algorithm and bounding box intersection is still going outside the grid. It will be difficult to fix. I will try to render some graphics with OpenGL (debug graphics with axis, lines, rotations, grids, traversal), perhaps this will shine some more light on the problem. This will require me to first implement some OpenGL grid and camera rotation, requiring extra time.

2. For this perhaps I have developed my OpenGL code further so it can run with OpenGL 1.10 and hardware acceleration disabled. To try this out I updated my Corona Game here, which is a simple game to try out game programming and OpenGL, I also fixed some startup bug where it was trying to run before objects were created.

http://www.skybuck.org/Games/CoronaGame/CoronaGameV012.zip

In principle it should run on any windows 95 system, however the Delphi produced executable probably only runs from Windows 2000/XP and higher, not sure exactly.

Anyway...

Achieving a good, reliable, numerically stable and super accurate, fast voxel traversal algorithm is critical to achieving the goals, without it there would be no point to little point, I think it would cause access violations if it goes outside grid, and it may also become slow if additional if statements have to be used to check if voxel is in grid, preventing light calculations from being fast, however if no solution can be found, then maybe a slow light implementation could be tried, until in the future a solution is found, but I rather find a solution now the coming days :)

So I hope I will be able to achieve it the coming days. I may require some special math, or special algorithms and if that fails, perhaps cheat a bit with "episilon" small value subtractions from some variables ! ;)
« Last Edit: May 20, 2022, 01:27:14 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #4 on: March 24, 2022, 09:08:54 am »
Thursday 24 march(3) 2022: Spent another day working on fast voxel traversal algorithm.

Perfected it in Delphi, (clipping/line/box intersection working, voxel traverse working and staying within grid, stress tested):
https://www.youtube.com/watch?v=svUQMPi2B7A

Tried to port it to OpenXCom C/C++ but failed, not sure why, calculateLine correct function to edit ? Is it in tile space ? world space ? voxel space ? hmmm
https://www.youtube.com/watch?v=17Bb_A9hE1Y

uploaded code to github branch, failed implementation commented... bit messy code, screwed some things up, just uploaded it in case you want to look at it and mess with it:
https://github.com/SkybuckFlying/OpenXcom/tree/FastVoxelTraversalAttempt2

commit:
https://github.com/SkybuckFlying/OpenXcom/commit/d67fb5f3b62e1af22cfff4f056734a6613412e82
« Last Edit: May 20, 2022, 01:32:24 am by Skybuck »

Offline Yankes

  • Commander
  • *****
  • Posts: 3206
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #5 on: March 24, 2022, 08:29:20 pm »
One suggestion, you should read carefully error messages, you tried to access invalid pointers, adding checks for x and y will not fix it if you try read garbage memory.

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #6 on: March 25, 2022, 10:06:51 am »
I think you mean 'access violation', I know that means accessing invalid pointers and such. But futher than that the exceptions don't really contain that much information, but sometimes they can be nicely breakpointed, thx for the hint anyway.

Friday 25 march 2022, fast voxel traversal algorithm + clipping: line/box intersection debugged and fixed !!! code could use some more refactoring. Current code is heavy tested. Only do refactoring if also some testing is done afterwards ! Always test !

(Also experimented with youtube streaming, but youtube cut the stream, during my first bug detection, later restarted stream)

Bug found was: equal comparison ported from Delpih = should have been ==. Otherwise this would cause the points x1=x2 to become the same.

Link to first debug stream: https://www.youtube.com/watch?v=l6jkPAmrTQE
Link to second debug/heavy testing/current/live stream: https://www.youtube.com/watch?v=l6jkPAmrTQE

About 15 days or so were spent on fast voxel traversal algorithm and intersection testing to get it perfected ! I hope you guys can make some good use out of it.

Currently it is only applied against tiles and uses tile coordinates. It could also be used for voxel processing, but then the code will probably need to be copied and slightly changed.

The way to use it is to divide the line coordinates by the tile coordinates, but you guys probably and should already know that, but since this code is new I just like to point that out anyway.

The code could be refactored into some more generic code so it can also be used for other things, maybe use inlining or function pointers, but then ofcourse the code will slow down a little bit. I will leave this up to you, for now the code is pretty much optimal maybe, cause no other function calling or very little, some things could be inlined, the macros should still be converted to real code.

The code that is heavily tested and perfected is on this branch in case you like to try it out:
https://github.com/SkybuckFlying/OpenXcom/tree/FastVoxelTraversalAttempt2

Current/latest commit is, "FastVoxelTraversalAlgorithm with clipping SUCCESS ":
https://github.com/SkybuckFlying/OpenXcom/commit/bd4570e9efe72264531c8d0f9e9604729ca9a7ad

« Last Edit: May 20, 2022, 01:31:54 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #7 on: March 29, 2022, 08:32:11 am »
Tuesday 29 march 2022:
(Clipping Line/Point vs Box/Grid/Map intersection for fast voxel traversal algorithm has been implemented successfully !)

Example/collision/ray detection code is implemented in TileEngine calculateLine:

Final branch for fast voxel traversal algorithm for calculateLine containing cleaned up code:
https://github.com/SkybuckFlying/OpenXcom/tree/FastVoxelTraversalAlgorithmImplementation

Pull Request for it to end up in OpenXCom master:
https://github.com/OpenXcom/OpenXcom/pull/1374

Also refactor attempt video, which failed somewhat but at least code was cleaned up:
https://www.youtube.com/watch?v=SIbsKB0ej24

Work has started on the new shading engine on this branch:
https://github.com/SkybuckFlying/OpenXcom/tree/ShadingEngine

Also a youtube video about it, New Light Engine preparations for OpenXCom:
https://www.youtube.com/watch?v=Ck3VpRq5FZs

Achieved goals update:
saturday 26 march 2022: acquired new cable modem in city.
sunday 27 march 2022:  installed new cable modem at home.
monday 28 march 2022: slept ?
tuesday 29 march 2022: refactored fast voxel traversal algorithm, cleaned up code, tried to seperate code into process voxel method but failed and reverted it back. + 1 day spent.
tuesdau 29 march 2022: started work on new shading engine, implemented GenericMap template and basis/constructor/destructors and maps for ShadingEngine class.
« Last Edit: May 20, 2022, 01:31:31 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #8 on: April 05, 2022, 11:56:53 am »
Saturday 2 april 2022: experimented with painter algorithm and acquiring surfaces for shading engine, not too usefull (yet? maybe in near-future though)
Sunday 3 april 2022: experimented with trying to collect data from painther algorithm via ShaderDraw method, was too complex.
Monday 4 april 2022: investigated draw terrain method. (Replaced/Reinvented blittNshade/shaderDraw method with simple draw sprite method)
Tuesday 5 april 2022: made it possible to draw 3d voxels/grid inside a sprite for draw terrain method (see DrawVoxelDataInsteadOfSprite)

Youtube streams:
https://www.youtube.com/watch?v=S-z0g3d97_U
https://www.youtube.com/watch?v=Pg6G7SMnv5A
https://www.youtube.com/watch?v=xjvQqbkZiDI&t=3605s
https://www.youtube.com/watch?v=o4kwQTQtbOA

Interesting too:
https://www.youtube.com/watch?v=_z9snyEuyqk

Best one/most succesfull one:
https://www.youtube.com/watch?v=6nNYHfzfFRU
« Last Edit: April 05, 2022, 12:06:26 pm by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #9 on: April 07, 2022, 02:34:59 pm »
7 april 2022:

+ Successfully rendered/drawed the lofts/voxel 3d for the terrain map. Not units yet, not smoke, not bullits.  There was some issue though with sprites having an extra vertical center line and that makes it less perfect. The lofts/voxels3d don't cover the sprites entirely, for example apple trees, or other objects, so it's not perfect, but it's somewhat usefull.

+ First attempt at applieing light casting/shadow casting, mostly shading casting, but setting surface pixel to zero if it's blocked from sunlight. Not yet sure if it's working well, may have to debug it further and analyze it and visualize it. One thing I can already tell and that is that it is very slow and the engine might need some massive changes, or at least add ons, to render the entire map in voxel data only or something, and avoid any unnecessary function calls, comparisons, branching basicaly, looking up of fields in structures, avoiding divisions like the plague. A better traversal algorithm should most likely be created where grid/tile traversing + voxel traversing is integrated into one. And then maybe later expand on that which tile-traversal savings which more advanced grid, which could be computationally expensive to compute a more advanced grid, so post poning that till later and sticking with just tile traversal and voxel traversal idea for now.

(Other possibilities include cuda/hardware/gpu acceleration, unfortunately I do not have any access to any working graphics/cuda chip, very maybe multi threading but, with 4 cores don't expect to much, very very maybe sse but for now, neh... first getting engine into a more usuable "massive tile/voxel processing without overheads" engine would be best
though some functionality loss might be expect if not all functionality can be encoded into voxels, or perhaps we can find a smart encoding which can still codify all kinds of extra information into a single field).

https://www.youtube.com/watch?v=pAw_-RbvcwM
« Last Edit: May 20, 2022, 01:31:02 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #10 on: April 08, 2022, 11:36:12 am »
Friday 8 april 2022:

Tried to implement multi-level/dual-level fast grid traversal. Attempt 2 was somewhat successfull, but now flickering/blinking of border cells is back, and also catched some division by zero corner case. I am considering to implement it differently using existing code to make sure everything works they way it should, by make code re-useable and then using it twice or so.

https://www.youtube.com/watch?v=94V3Vmqj_JI
https://www.youtube.com/watch?v=CgMGN7Oz5oI
https://www.youtube.com/watch?v=gBEkLv2Troc
« Last Edit: May 10, 2022, 01:43:51 pm by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #11 on: April 11, 2022, 09:38:02 pm »
Monday 11 april 2022 TAKE NO PRISONERS MODE =D that means I go straight into OpenXcom C/C++, anyway: Today was a very fruitfull day: Implemented "SpriteVoxelFrame" which re-computes a relation between a sprite pixel and the sprite voxel which belong to the same tile. These SpriteVoxelFrames speed up the intended processing of the closest voxel behind the on-screen sprite. Also worked out some futher ideas how to implement direct and indirect lighting as well.
(Took 15 hours to implement: study code, create code, debug code, test code, I made an interesting discovery, apperently youtube/obs studio streaming limited to 12 hours, last 3 hours were cut off, but fortunately success was recorded ! ;))
https://www.youtube.com/watch?v=-Sy9mAzL11E

Saturday 9 april 2022: Investigated the possibility of using physically based rendering engine pbrt for xcom, but this engine will most likely be way to slow. However rendering a single image of a cool "ply" capture of a screen/game situation is a very cool idea and I would definetly like to try that sometime. pbrt v3 was successfully build from sources and successfully rendered an image in win32 configuration. pbrt v4 seemed to crash in win32 configuration and may need some more work it's still in beta, very maybe win64 might work.
https://www.youtube.com/watch?v=wscOTflLHBI&t=14440s

Sunday 10 april 2022: Had some fun with Delphi and building a new rendering approach, still uses vcl, but should be better to do some more freedom of grids and such, though I will probably abadon this and work straight on c/++ coming days. Though the transformers graphics was quite cool, used it to test and make sure there are no blinking issues, it might not be entirely thread safe but so far it seems to work. Also planned to use control points on grid and lines.
https://www.youtube.com/watch?v=OnCVAZFcuA8
https://www.youtube.com/watch?v=ve2gzdtNj1E

Finally, Monday 11 april 2022 closing thoughts/remarks:
(I was somewhat frustrated the last 2 or 3 days with the multi-level traversal algorithm but feel ok now. Decided to go straight into C/C++ and do some usefull work there. The plan is to re-use the C/C++ code to try and re-implement multi level traversal algorithm with existing code and ripping it apart twice for usage on openxcom scenes for tracing of lines/rays. Idea is to trace the rays in parallel step by step for maximum data access re-usage/locality. This is a more efficient usage of my time to make progress in trying to implement this feature as far as possible.)
« Last Edit: May 20, 2022, 01:33:03 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #12 on: April 13, 2022, 03:51:37 pm »
Tuesday 12 april 2022: slept entire day or so to recover from 15 hours of streaming and day before that ;)
Wednesday 13 april 2022: implemented ScreenVoxelFrame (might need masks to not shade things which don't have voxel maps or units on top of it, for now I go with the flow ;))
started work on tile + voxel traversal code.
https://www.youtube.com/watch?v=J3mrziBKgvw
https://www.youtube.com/watch?v=QQNOGT-5IU0
« Last Edit: May 20, 2022, 01:33:14 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #13 on: April 15, 2022, 08:03:16 am »
Friday 15 april 2022: VoxelRay.h and VoxelRay.cpp header/implementation continuation work: approx 4 hours.

VoxelRay.h VoxelRay.cpp implementation 15 april 2022 video link:
https://www.youtube.com/watch?v=rzSj9PUooZg

Skybuck's OpenXcom plans may be interrupted to go demonstrate later against evil forces ! =D or at least to wake up the local goverment that a change is necessary to save the WORLD ! =D
https://www.youtube.com/watch?v=dRI_Kj3-n4A

Later on the day 2 hours and 30 mins: added ScreenRayBlocks and first usage code and light exposure + angle + shade code/sketch/idea:
https://www.youtube.com/watch?v=1516GirAkkI

Maybe I can combine both. I am not sure if I will continue debugging today, or maybe debug it another day, I am afraid of dieing though, before I get to see it in action, I want to see this in action real bad, but I also have to do and kind of want to do other things. So I am going to take a break for now to relax my mussles and then I will think about it.

I wlll probably continue later on in this day, maybe in a few minutes, because that was the plan, today last day and thus the final push ! =D and then 2 weeks break or so from this project to concentrate on other things.... hmmmm... and then I will be back like the terminator ! =D
« Last Edit: May 20, 2022, 01:29:53 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #14 on: April 17, 2022, 09:38:11 am »
Saturday 16 april 2022: took a big fat rest most of the day then later at night that day:
Saturday 16 april 2022: Described a new algorithm idea for processing/traversing multiple light sources efficiently by avoiding unnecessary light rays:
https://www.youtube.com/watch?v=DbdapfMO8bU

Also describing initial idea for a more advanced voxel engine in the future, Link to video:
https://www.youtube.com/watch?v=CdVoQKSNOGY

Also sun, earth, moon, dark/full moon idea and such, Link to video:
https://www.youtube.com/watch?v=3-F2N2lMH8Y

Sunday 17 april 2022: Debugged VoxelRay.h and VoxelRay.cpp for tile traversing, this should now work very well, spent 4 hours and 50 mins on it.
https://www.youtube.com/watch?v=lDh2TZOarV4

« Last Edit: May 20, 2022, 01:33:56 am by Skybuck »