Development Blah

All other topics around Descent and D2X-XL

Moderators: Frustikus, simX, Aus-RED-5

User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

More Cartoon Rendering

Postby karx11erx » Tue May 12, 2015 7:48 pm

The last few days I improved in-texture outlining - it is now anti aliased quite well - and I worked on my sphere rendering code in an attempt to have black outlines for them, too.

It is incredible how many bugs you can put in so little code. :p :wallbash:

:rofl:

Unfortunately I couldn't do it the easy way, as rendering back facing polygons in line mode doesn't work with transparent objects. So I had to do it the hard way: Collect all sphere edges and faces, determine which are facing the viewer and which are not, and render the edges between faces that do and that do not. Well, it's working now.
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

New And Improved Effects

Postby karx11erx » Wed May 13, 2015 8:56 pm

I am just uploading D2X-XL v1.18.5, which has a couple of small, but nice improvements:

3D shield boosts now have a new texture that tiles better and looks more like fluctuating energy. When using the cartoon style renderer, 3D shield orbs now also have a black outline. If you set lightning quality to "maximum" - a new, additional setting of the lightning quality control in the effect options menu - 3D shield spheres will have a nice animated lightning effect inside of them:

Image

I have also worked a bit over the cloak effect for player ships and robots. I never liked that you could see all a cloaked object's submodels shining through, and today I figured a way to create a much nicer cloak effect using the same animated force field texture applied to 3D shield boosts and applying glow to the model render:

Image

For a comparison, see the old effect (which will still be applied if glow is turned off) here:

Image
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

3D Powerups

Postby karx11erx » Tue May 19, 2015 1:31 am

While D2X-XL could render the shield boost powerup in full 3D, it never had 3D versions of the other spherical powerups: Extra life, invulnerability, and cloaking device.

Today, this has changed.

Image

Image

Image

Image
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

Hunting Bugs

Postby karx11erx » Fri May 22, 2015 4:24 pm

Recently, I had changed some code in D2X-XL to better check accesses to invalid game data (e.g. objects like weapons, that didn't exist anymore).

The original code does such data accesses, and the reason it doesn't crash is that the memory adresses it accesses usually are valid - they just don't host data that is valid in terms of game state (e.g. killed / removed objects as mentioned above).

D2X-XL handles such data accesses much stricter, returning a NULL pointer (invalid memory address) for them. The (nasty, but transient) consequence of that is that where the original code seems to work flawlessly (despite it actually not doing so), D2X-XL may crash. The positive thing about this is that it helps me to locate such code and fix it. In the end this will lead to a more stable, better working and less buggy Descent version.

So while my measure seems to worsen the issue, it actually is the cure. :D
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

More 3D Powerups

Postby karx11erx » Sun May 24, 2015 8:38 pm

Something I never particularly liked about D2X-XL's 3D powerups was that they weren't spinning around their vertical axis at a 45 degree tilt like their 2D counterparts, but had an arbitrary orientation and rotation.

Yesterday I tried to change that, but the road to success proved to be much more rocky than I had expected. The reason for that is that the 3D powerups have been created with various different orientations, some pointing up, some pointing down, some facing the viewer, some showing their side ... it was a major pain to find out which 3D powerup model was actually facing where and find the proper rotation angles for them.

Too bad MetalBeast isn't around anymore to fix that and give all 3D models the same orientation.

Well, it works now ... but I am not sure whether I do not actually like the old, more 'chaotic' style more ... :think:
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

Bugs that make you facepalm

Postby karx11erx » Sun May 31, 2015 12:38 am

A few days ago I provided a fix for a bug causing sporadic program crashes. The technical background of this bug is as follows: D2X-XL allows up to 128 sound channels, but it never told SDL_mixer to allocate as many sound channels as chosen by the user in the music options dialog. So SDL_mixer worked with 32 channels regardless of how many D2X-XL potentially used. Since SDL_mixer does rather lackluster function argument checking, trying to make it use more than 32 channels was a hot candidate for causing a crash in SDL_mixer, because most of its sound channel handling functions simply didn't check the channel number passed to them against the number of available channels. Some functions did the check, but had it wrong ("if (channel > num_channels) return;" instead of "if (channel >= num_channels) return;" - an absolutely amateurish oversight).

This bug has been in the code for years and years, and I am asking myself why it apparently caused way less trouble than it had the potential too. Maybe I am just delusional here because people simply gave up on using D2X-XL instead of notifying me about it. :lol: D2X-XL now tells SDL_mixer to provide as many channels as required, and I fixed the broken channel argument checking and added it to the SDL_mixer version provided together with D2X-XL whereever it made sense.

Another bug that really gave me headaches was the cartoon renderer drawing segment and object edges that were occluded by geometry in front of that geometry in auxiliary cockpit windows (e.g. the missile view) when applying blur to them. I found a simple work around by prohibiting blur in auxiliary windows, but I had a really bad feeling about that because the problem looked so fundamental that I feared the implications and side effects on the entire glow renderer. So I dug into the code for most of today and did tons of tests using different approaches to get a hand on the issue, but I just couldn't nail it down until I finally decided to render to a frame buffer object when using glow.

The background of that is that I am using multiple render targets (color buffers) for blurring stuff. All color buffers are tied to the same depth buffer. The glow renderer works as following: The scene is rendered to the first color buffer, updating the depth buffer with its depth (distance) information. The stuff to be blurred is rendered to the second color buffer, which gets erased before rendering to it. Since that color buffer is tied to the depth buffer, only visible parts of the stuff to be blurred are drawn in that color buffer. The blur renderer now has a texture only containing the stuff to be blurred. The result of the blur operation is rendered on top of the scene.

When I looked into the blur code, I noticed that the auxiliary cockpit window contents wasn't rendered to the FBO I was using for rendering the frame, but to the hardware's back buffer. After pondering on this it dawned on me that rendering the auxiliary windows happened in the wrong stage of D2X-XL's render pipeline, and that was the 2D frame element rendering stage (HUD etc.). At that stage, the scene's depth buffer information wasn't available any more, resulting in flawed glow rendering.

This was a damn hard nut to crack :wallbash:, because I also had to break a wrong thinking pattern of mine here, which was "auxiliary windows are 2D". This is true in a sense, but rendering them is a 3D render, so it has to be performed in the 3D rendering stage of D2X-XL's renderer. :gotit:
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

How Buggy Is D2X-XL?

Postby karx11erx » Wed Jun 03, 2015 9:03 pm

How buggy is D2X-XL?

This question is difficult to answer. D2X-XL has a huge amount of settings, with many of them interacting with each other. This means that there are so many settings configurations that I cannot possibly test them all - I need the D2X-XL users to provide feedback (in the form of bug reports). Two examples illuminating the issue are a crash in the automap that only occured when the player had a homing weapon equipped, and a renderer flaw that only occured when drawing cockpit displays like the missile view while the cartoon renderer was active and glow was set to full. I think this is giving an impression of the huge number of variables involved in D2X-XL testing.

D2X-XL has become more crash prone since I introduced stricter data access validation. This seems like a deterioration of its quality, but actually it is not: It is revealing problematic code areas (many from the original code) that went below the radar before. A program crash is pretty easy to catch (provided it is reproducible) and way more obvious than some shady program behavior. It also replaces manual code inspection (difficult and time consuming) with code execution (which is done by the computer for me).

I know that this makes D2X-XL users suffer, and I am sorry for that; But in the long run it will give them a more enjoyable gaming experience, and I am determined to get D2X-XL there.
I am convinced that D2X-XL has gained a lot of stability already, but the proof is in the pudding of many people using it and not having problems. This is up to you, fellow Descentrs. :)
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

The Ultimate Bug Trap

Postby karx11erx » Wed Jun 03, 2015 9:03 pm

The Ultimate Bug Trap

During the last few days, I have implemented a feature that I had on my mind for a while already, and which might prove to be the ultimate means to determine the cause of otherwise hard to pin down bugs.

D2X-XL now has a feature that allows it to print the chain of function calls that lead to a program crash to the log file. Since this feature can be quite heavy on the frame rate, it has several levels with increased degree of detail.

You can enable that feature by adding the parameter "-tracelevel" to d2x.ini, followed by a number between zero and three (e.g. "-tracelevel 1"). Zero means that function call tracking will be disabled. The higher the number, the more functions are included in the tracking. Don't forget to turn on logging ("-printlog").

So if you encounter occasional or regular program crashes, turn the feature on, and once the program crashes, create a bug ticket in D2X-XL's bug tracker on Sourceforge.net and attach the log file there.
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

D2X-XL v1.18.29 Available

Postby karx11erx » Wed Jun 03, 2015 9:04 pm

D2X-XL v1.18.29 Available

A new D2X-XL version with a fix for a flaw in the original game's handling of wall collisions under pretty special and rather rare conditions is available. This fix interacts with some of the most delicate parts of wall collision handling and has been thoroughly tested; So I hope it doesn't do more harm than good. :roll:

To avoid (the very loud) force field humming sound to build up too much, force field sound fx will be controlled by the ambient sound control in sound and music options (that control was initially intended to only control the volume of sound effect object generated sounds - a D2X-XL exclusive feature).

As icing on the cake D2X-XL will now also play back a scraping sound when the player ship scrapes along a wall. :) I hope you will like that - if not, just delete the scrape*.wav files from your D2X-XL installation's sounds/d2x-xl subfolder.
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

Everything you always wanted to know ...

Postby karx11erx » Mon Jun 15, 2015 9:49 pm

... about D2X-XL's lightmaps, but were afraid to ask! ;)

Lightmap computation has two settings: Quality and precision.

Lightmap quality determines how many pixels a lightmap contains (basic: 16x16, standard: 32x32, high: 64x64, extreme: 128x128).

Lightmap precision determines how many rays D2X-XL tries to cast from a light emitting face to the face it is computing a lightmap for to find out whether that face is visible to the light. Ray casting works as follows: D2X-XL determines a point on the light emitting face and draws a line from that point to the point on the face it wants to compute the light for. If this line hits a wall before it reaches the target face, the light cannot directly shine at the target face.

At low quality, D2X-XL just casts one ray from the light emitting face's center to the current lightmap pixel of the target face. At standard quality, it also casts rays from the light emitting face's corners to the target face. At high quality, it additionally casts rays from the centers of the light emitter's edges to the target face. It will stop as soon as one ray hits the target face. In the best case, D2X-XL will only cast one ray, but in the worst case it will cast nine rays.

Add to that that D2X-XL has to do that separately for each light source that might potentially have a line of sight to the target face, and that D2X-XL will consider up to 32 lights per face, and you will come to a maximum of 128 * 128 * 32 * 9 = 4.718.592 (i.e. almost 5 million!) lookups per face at the highest lightmap computation settings. The average might be around 1.5 million lookups per face at that settings.

Now 128x128 is quite a high value for lightmap size, given that D2X-XL's high resolution textures are just 512x512. Casting rays from a light emitter's edge centers when the rays cast from its corners do not hit their target face is also a bit of an overkill.

Therefore, I recommend to use standard or high lightmap quality and standard lightmap precision. With these values, you will already achieve nice looking results without having lightmap computation time getting totally out of hand.
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

Precomputed Lightmaps

Postby karx11erx » Mon Jun 29, 2015 12:34 pm

Precomputed Lightmaps

After a period of frequent changes, I consider D2X-XL's lightmap calculation code stable again. Therefore, I have started to precompute lightmaps for the most popular, massive or best (as I see it) missions in high quality (lightmap quality: high, lightmap precision: standard). I will successively update the related missions on my website as I have precomputed lightmap data for them.

Right now, the following missions with up to date mesh, light, and lightmap data are available on my Descent 2 server:

  • The Enemy Within (multi author; Lead: DarkFlameWolf)
  • The Sphere (Yokelassence)
  • Dimensional Intersect (Yokelassence; Multi-level version)
  • Boiling Point (me)
  • Warp Shockwave (me)
  • Lunar Outpost Reloaded (me)
  • 12+ player maps (18 multiplayer maps for 12 and more players)

12+ player maps contains many of my multiplayer maps as well as Azure Catacombs (DarkFlameWolf), Monsterball Arena (Aus-RED-5), Scorpion's Lair XL (Sirius) and The Forest (Yokelassence).

Lightmaps for Descent 1: First Strike, Descent 2: Counterstrike and Descent 2: Vertigo have already been computed, but still need to be uploaded.

Descent: The Lost Levels and Descent Vignettes are currently being processed.

All you need to do is to download the mission files (7zip archives) and extract them to your D2X-XL installation's root folder. Make sure to set lighting to "high", lightmap quality to "high" and lightmap precision to "standard" before starting any of these missions. You can find these settings in the render options dialog.
User avatar
karx11erx
D2X-XL Master
D2X-XL Master
Posts: 8112
Joined: Mon Sep 24, 2007 8:48 pm
Location: Wilferdingen, Germany
Contact:

More Precomputed Lightmaps

Postby karx11erx » Tue Jun 30, 2015 1:45 pm

Following missions have been updated with mesh, light and high quality lightmap data:

  • Descent: Vignettes (DarkFlameWolf)
  • Descent: Lost Levels (DarkFlameWolf)
  • The Apocalyptic Factor (XL)
  • Anthology (Sirius)
  • Anthology (Sirius; Multi-level version)
  • Year of The Tiger (Sirius)
  • Kartsal Motivation Demo (Pumo)

Additionally, you can download mesh, light and high quality lightmap data for the original Descent campaigns:


Return to “General Discussions”

Who is online

Users browsing this forum: No registered users and 2 guests