aliens

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

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #15 on: April 18, 2022, 04:50:44 pm »
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.  Re-design would take too long so went back to what I had, maybe I modified the lower part a bit too much, maybe not, it wasn't fully done anyway.  Now there is this mysterious bug, the line is not fully drawing, only parts of it. I don't understand why... maybe it's a rendering bug, don't know. Maybe tomorrow when I am fresh. I'll figure it out, but I fear the worst hehe... maybe bresenhamline can shed some light on it... could also be some floating point bug, don't know.
https://www.youtube.com/watch?v=4LO7P4BnnWs
« Last Edit: May 20, 2022, 01:34:32 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #16 on: April 19, 2022, 09:35:19 am »
19 april 2022: Fix the mysterious rendering bug. Draw call to VoxelMap 3D moved outside of if statement so that it renders all tiles, and not just certain walls, that was the bug.
Tested tile/voxel traversal somewhat. It seems to work fine, more testing can be done. I think it is now almost 99.9% ready to be used for light/shadow/shade casting.

I also created a little tool, to convert a grid of symbols to an ascii text, and made a posting to describe the Tile and Map Axis once and for all in a forum posting and in a text file !.
(I am going to try and get some sleep, cause this traversal issue was keeping me awake and now it should be solved mostly if not 100% so now I can have a good night sleep and don't have to think about any more new algorithm implementations, though that coukld still be tried to make maybe better/faster/more optimal versions... but now I will start concentring on the actualy shading/light casting code and such, most likely, cause now it's in a good usuable state and ofcourse curiosity and gaining some more experience with it which might even influence further designs. I should also investigate the sun direction and see what can be done there with tiles only later on, or maybe also a voxel based approach.)  I also provided some visual studio 2019 feedback for kicks and improvements.
Debugging video: https://www.youtube.com/watch?v=FDksRrEBksM

Link to branch/commit:
https://github.com/SkybuckFlying/OpenXcom/tree/LightNShadowCasting
https://github.com/SkybuckFlying/OpenXcom/commit/20924002652769f9b023d703a8931d7ab95e69a0
« Last Edit: May 20, 2022, 01:34:56 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #17 on: April 22, 2022, 07:51:30 pm »
(forum was down, updating):

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.
Tried to implement sun direction via delegates and functions but became to complex in figuring out call order, so simply made it a global.
This is much easier to work with.
Also openxcom.org and forum seem down time ! LOL :) So will post this later ! =D
https://www.youtube.com/watch?v=t2COQcJF6BM
https://www.youtube.com/watch?v=uh1DRJG7sQE

22 april 2022: 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.

For now I will probably pursuit, "perspective" like shadows, though it might not fight the game well, so maybe I will pursuit isometric after all, but it's kinda harder to do and it kinda looks a bit weird for now hehe, but it was only doing a few rays from only one axis direction, so maybe a multi-axis direction might look better lol. It was funny to see isometric lighting in action though ! ;)

Part 1 less usefull I think, not sure, audio crash though:
https://www.youtube.com/watch?v=X9l0Z3myMzI

Part 2 much more usefull, one very interesting lighting solution, however it's a bit slow, hoping that the frame version/computed version can work tomorrow.
https://www.youtube.com/watch?v=X9l0Z3myMzI

(Spent almost 10 hours on this). (Before those 10 hours also had some fun with civ1 and even tried to debug it... cause it hang... made a civfanatics forum posting about that, maybe reverse engineering civ1 will be my next project to debug that game =D)

Also, I am starting to doubt if it will ever look any good, cause there is so many voxels missing here and there... then again... maybe if it's subtle, maybe blurred/filtered in... or worked on a bit more, maybe it will start to look better.

For now the most urgent improvements are correct depth/sprite/layer sorting and still the shading formula needs to be better, probably something simple like distance of light source will do if it's "lit", otherwise probably just ambient/dark color, though I forgot how to maybe do it a bit better... hmmm... maybe draw more rays like the light is a square or something.. I may have to check my original light casting code... or I can just proceed with c/c++ and try some things out. It shouldn't be too hard to get something that looks somewhat decent going ;)

Also units and other things still need to be incorporated into the voxel maps and such... and eventually voxel frames if that technology is ever going to work correctly, otherwise render directly from voxel 3d maps is also possible, but slower... maybe in future a gpu version could also speed some things up... but for now focus should be on trying to get the voxel frame version working, speed up through smart data structures... I still don't understand why it's not working the way I envision it, everything seems to be right, except when it's suppose to cast/shoot these rays hehe.

(I also kinda wanna have some more fun with civilization 1... so this kinda eating into my mind right now ! =D But seeing those "early" "shadows" and "lights" and such also motives me to keep going at it/openxcom that is hihi... cause I really want some better lighting before I re-play this game with fat mods and shit yeah hehe... maybe also new special blood effects hehe... the old look and feel of game kinda bores me... so I really need something better and civ1 AI is best for now... so I might play that game instead... oooohhhhh but for now it's just about the look of OpenXCOM.... can I do it ?!  can I make a revolution happen in 2d graphisc games with just cpu ! or even just a little bit of gpu! ;) =D It's a question that has been on my mind for a very very long time and it's about time that it gets answered properly, if not it will be frozen in the fridge again, to be unfrozen in the future lol. I'd rather cook it the coming days ! =D and be done with it... but maybe it will never be done with it... as new lighting algorithm become available... though this is my algorithm though... and I feel like... and know... and have some proof... that it can work.... arghh.... so let the game mold itself into a suited data representation to get it done... I might even go as far as make voxel graphics for this game... if I can get it look good, but then again... maybe too much work for 1 man... but a website... were people can coorporate and do it together.. maybe I make that... to convert the 2d sprites to 3d sprites.)
« Last Edit: May 20, 2022, 01:35:26 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #18 on: April 24, 2022, 11:56:23 am »
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. Not exactly sure what is causing this. 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. The second level ray/clipping algorithm/part seems to be flawed/was not properly tested, the line collide with box method may be bad/broken and this means a new multi-level grid or even single level grid algorithm should be implemented that works more properly with clipping or use the old code/algorithm that did seem to handle the clipping properly. The screen voxel frame idea was debugged and investigated/visualized/analyzed by setting the voxels (traversedMap) to the screen voxel frame voxel positions,x,y,z and such... and then these voxels were rendered with a method that I knew was good/accurate and this proved the screen voxel frame is working somewhat and the idea is valid and the positions were good.
https://www.youtube.com/watch?v=kK3_HDyw6mk
« Last Edit: May 20, 2022, 01:35:38 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #19 on: April 26, 2022, 12:54:48 pm »
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.) Today I learned how to turn off annoying floating point exceptions in Delphi, it's pretty cool and convenient to do that ! ;) =D Though I am sure some day, somewhere it might bit me in the ass a little bit, cause ultimately ofcourse it will do weird stuff I think ! ;) =D But for now it's pretty good. It is kinda required for these kind of algorithms and code style, with vectors and such and is kinda recommended in documents and such, sort of, they (c programmers) assume it's all masked off and they try and take adventage of it in their algorithms but if they truely catched all cases remains to be seen, I have some doubts after testing it in Delphi ! ;) =D I catched at least one corner case (horizontal ray/line on top of boundary).

The long journey, trying out stuff:
https://www.youtube.com/watch?v=nCugQZEMNng

And finally the success story, youtube cut off the above video, but finally I re-recorded the success:
https://www.youtube.com/watch?v=jMHq8c4_Q1w
« Last Edit: April 26, 2022, 01:03:47 pm by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #20 on: April 30, 2022, 08:52:26 pm »
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) (also tried some other ray/box intersection algorithms but they failed for "ray segments"  so they were flawed). 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.

Development video, with some nice music in it too, unfortunately youtube cut off the last 3 hours or so, youtube apperently still limited to 12 hours of non-stop streaming (I thought this was fixed but apperently not, maybe it's a limitation in OBS studio. I don't know, I am going to ask that on the issues on github for OBS studio...)

Link to development video:
https://www.youtube.com/watch?v=k1uh_E6x0xc

Link to reporting success video:
https://www.youtube.com/watch?v=sF3eHumeBns

(During this success video, I improve the point rendering code a little bit, and look/dive deeper into 0.0 / 0.0 producing -NAN in 32 bit mode and -1, #IND in 64 bit mode both propagating through computations/operations like a virus. This would cause the start point and stop point to become -NAN as well, and this is now fixed by setting direction x,y,z to zero in case ray length is zero.

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #21 on: May 03, 2022, 12:47:36 am »
1 may 2022: Explained the difference between the ray and ray segment vs box intersection algorithm, took a close look at it and described the theory behind it:

Important video if you want to try and understand this algorithm:
https://www.youtube.com/watch?v=5E5hPmgQ4ro&t=508s

Then I tested these ideas/theory out on my own created version,  (I also found some oddities with +-+-+), then the internet went down as ISP worked on the network.
https://www.youtube.com/watch?v=JBJVB1CqG70

and finally prove the algorithm works with some addition: "check if ray segment overlaps the intersection segment", also took a look at -NAN and 0 * infinity, nice visualizations:
(uploaded it once the internet worked again which was after 2 hours or so ;)):
https://www.youtube.com/watch?v=lAcneKBJ9zY&t=6746s

Roughly 4 hours spent, maybe 5 or so.

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 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)

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 exceptios enabled, so that means taking care of all the divide by zero problems.
« Last Edit: May 03, 2022, 12:49:18 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #22 on: May 06, 2022, 12:01:22 pm »
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 ! ;)
https://www.youtube.com/watch?v=nkoHfNEbY24

(Now I have to go do other things, later ! ;) :))
« Last Edit: May 20, 2022, 01:36:00 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #23 on: May 07, 2022, 07:13:31 pm »
Saturday 7 may 2022: (8 hours spent) First impression of what Light Casting could look like in X-Com, moving sun added to, it does help to get a better understanding of what is going on.
Removed the double floor, added some custom shading for voxels in sun and voxels in shadow. Shading/pixel processing still based on whatever is on the screen. Per tile/sprite shading might look a bit better, removal of existing shading to replace light rays and such might also improve it. Unfortunately still some bugs with the floors and the rest of the traversal, still weird how the inner part of the floor is not rendered properly. Some nice progress has been made today. Tip/note: Also use integers instead of unsigned bytes to do any color shading that might go negative. When the light shines on voxels from the back, currently they will lit up. Some kind of computing will be necessary to tell if the voxel is being lit from the side of the viewer or the back side. Possibly calculating some voxel normals might help with that. A normal per side of the cube, or even better, calculate/determine which side of the voxel is being lit up and only include sides of the voxel which are visible to the viewer ! Cool idea ! ;) (Plus later integrate code into the proper painter's algorithm position, though this might get a bit tricky with screen voxel frame... hmmm... the main map loop may have to be interrupted/cut into multiple pieces, maybe.

Link to video, well worth a watch to see the light and shadows in action (pre-liminary version: still buggy version but it does give some impression)

https://youtu.be/AQSwVmPbCtA
« Last Edit: May 07, 2022, 07:17:29 pm by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #24 on: May 10, 2022, 01:39:58 pm »
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.
https://www.youtube.com/watch?v=Te0nmf70WN8

« Last Edit: May 20, 2022, 01:36:10 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #25 on: May 12, 2022, 04:47:43 pm »
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
« Last Edit: May 20, 2022, 01:36:19 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #26 on: May 15, 2022, 01:13:58 am »
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
« Last Edit: May 20, 2022, 01:36:26 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #27 on: May 20, 2022, 01:06:46 am »
Sundag 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.
https://www.youtube.com/watch?v=HmxUly_i8lk
https://www.youtube.com/watch?v=qz6rqtIGXLI

Monday 16 may 2022: Tried yankes 32 bit support, investigated the possibilities of PBRT. Achieved/build an operational version of PBRT v4 win32. (Yaml is missing/link errors)
https://www.youtube.com/watch?v=hjElvkUSVGc
https://www.youtube.com/watch?v=kj2j03TYdWs
https://www.youtube.com/watch?v=qNIoY9hq26U&t=3s

Tuesday 17 may 2022: (8 hours and 45 mins): Investigated the possibility of using PBRT as a static library:
Part 1: https://www.youtube.com/watch?v=KXI2uAuBdvE
Part 2: https://www.youtube.com/watch?v=hP4TVGs-E_o
https://www.youtube.com/watch?v=KXI2uAuBdvE

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 ?! ;)
(Part 2 has pretty good end result)
Part 1: https://www.youtube.com/watch?v=DWYdTlot1EA
Part 2 https://www.youtube.com/watch?v=d9ypSiyf6Lc
« Last Edit: May 20, 2022, 01:37:01 am by Skybuck »

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #28 on: May 21, 2022, 03:14:39 am »
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.
Video: https://youtu.be/ZCRVniK5MrU
Git branch: https://github.com/SkybuckFlying/OpenXcom/tree/ExportToPBRT

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: Skybuck's Plans for OpenXCom (youtube video)
« Reply #29 on: May 23, 2022, 02:14:59 am »
Sunday 22 may 2022 wasted 6 hours of time trying to solve log conflicts with OpenXcom and PBRT. Tried to link PBRT into OpenXcom miserably failed. DELETED PBRT I have had enough of stupid C/C++ link problems. I tried mitsuba 2 but it has python problems. And Intel's OTP needs thread blocks and wants me to compile 155 tests programs which go insanely slow and that is just the start of it. So I am giving up on these noisy image shitty slow renderers, and hard to build and link crap and going back to my own Delphi to C/C++ ported code and such.
https://www.youtube.com/watch?v=Tyd8dIb52rA

Sunday to Monday 23 may 2022: Tried Mitsuba 2 and Intel renderer but both fail miserably as far as I am concerned, maybe intel's one might work but I don't want to spent time compiling 155 test programs and it's probably not going to work anymore, and probably limited to 64 bit and I am kinda fed up with these slow builds and technical problems, so fuck em.
https://youtu.be/ZlwX5_pVqMM

« Last Edit: May 23, 2022, 02:19:17 am by Skybuck »