Upgrade
A list of changes to the engine that break backward compability and a complete list of solved bugs.
I have chosen to do this because it is easier to change a few lines in the game than to have many obsolete methods in the engine and it is okay to use an old version of the engine as long as it is stable.
VERSION 1 to 2
Changes:
Explicit call for automatic detail level
void Enviroment_UpdateAutomaticDetailLevels(float X, float Y, float Z);
Instead of automatically calculating detail levels each render, you must now use this call with the camera's position as argument before rendering to get the same result.
This change had to be done to support multiple cameras, multi resolution models and dynamic shadows at the same time.
To easily make everything work as before, just implement this pseudo method to replace the old one.
Camera_RenderScene_Version1(InputCamera,OutputSurface,ShaderChannel) {
DGE.Camera_GetPosition_OutV3(InputCamera)
DGE.Enviroment_UpdateAutomaticDetailLevels(DGE.GetX1(), DGE.GetY1(), DGE.GetZ1())
DGE.Camera_RenderScene(InputCamera,OutputSurface,ShaderChannel)
}
Index for instance visibility
Instance_SetVisibility and Instance_GetVisibility have a new argument called ShaderChannel.
Instead of having one visibility for every shader channel, you can now set the visibility for a specific type of rendering.
You can for example make an instance invisible for channel 1 (depth only) so that it does not cast shadows.
To easily make everything work as before, just implement these pseudo methods to replace the old ones.
Instance_SetVisibility_Version1(Instance, Visible) {
ShaderChannel ← [0..15] {
}
}
Instance_GetVisibility_Version1(Instance, Visible) {
}
All boolean return values was replaced by integers to support more programming languages.
This will not affect how you use the engine.
Different languages have different definitions about what to do when the value is not 1 or 0.
Fixed bugs:
Minor bug in Model_CreateCopy
Bug in cutting plane
VERSION 2 to 3
Changes:
Draw surfaces can have 2 depth buffers to allow soft particles.
The constructors changed useDepthBuffer to numberOfDepthBuffers.
Change false to 0 and true to 1 when giving the number of depth buffers.
DrawSurface_HasDepthBuffer was renamed to DrawSurface_GetNumberOfDepthBuffers.
Automatically find and replace to make it work with the new method. If you used the old result as an integer for some odd reason, you must do a comparison with 0 to make it a truth variable.
DrawSurface_HasDepthBuffer_Version2(DrawSurface) {
(DGE.DrawSurface_GetNumberOfDepthBuffers(DrawSurface) > 0)
}
Post effects can read from the depth buffer to allow depth based post effects.
PostEffect_GiveInputSurface have a new argument called SubresourceType
Just set SubresourceType to 0 to read the color as before.
The argument SpecularSharpness to the HLSL light methods has been scaled to follow the phong illumination model.
Give twice as much specular sharpness to the method to have it like before.
Fixed bugs:
Rare access violation when loading models.
Access violation was caused by using the wrong macro in a method for allocating triangles.
Access violation was caused by not initializing a counter to 0.
VERSION 3 to 4
Changes:
Fixed bugs:
Instance textures in version 3 only worked when the texture channel listened to instance override channels of the same index.
A model's culling method was not duplicated.
VERSION 4 to 5
Changes:
Fixed bugs:
A system for optimizing geometry updates in version 4 was removed because it had a bug and falling back on the old method is safer than solving the bug. Version 3 does not have this bug.
A string method assumed that an input string contained at least one backslash but recieved relative filenames that broke the precondition and generated odd named precompiled shaders that can't be used.
VERSION 5 to 6
Changes:
Engine_SetAppPath_InSB was renamed to Engine_SetCurrentDirectory_InSB so that it is consistent with Engine_SetCurrentDirectoryRelativeToApplicationPath_InSB.
You should use Engine_SetCurrentDirectoryRelativeToApplicationPath_InSB when your language can't handle unicode characters in the application path and Engine_SetCurrentDirectory_InSB when the path is ansi compatible.
Engine_SetCurrentDirectoryRelativeToApplicationPath_InSB is not possible to use when simulating your application in Visual Basic 6 because the real application path will refer to Visual Studio that simulate your application.
If the application path in Visual Basic 6 (app.path) contain a questionmark then you know for sure that the path is in unicode because questionmarks are not allowed in folder names.
To upgrade for VB6, just copy ContainQuestionMark(T As String) and SetRelativeWorkingDirectory(RelativePath As String) from the code examples and call SetRelativeWorkingDirectory with your relative path.
For unicode compatible languages, just replace Engine_SetAppPath_InSB with Engine_SetCurrentDirectory_InSB with an automatic text replacement application.
Fixed bugs:
Deleting things in the wrong order gave incorrect character encoding in the error message.
Multiple string methods had bugs solved because I did a lot of automated testing and formal verification on my string module.
VERSION 6 to 7
Changes:
Fixed bugs:
If a vertice would inherit it's position from the second bone at location (0,0,0) it would give a false positive as a default value when saving the model because BD.w was compared to 1 instead of -1.
A constructor for a matrix in the Bullet engine had confusion between row major and column major because I had to use the source code as documentation when integrating bullet. This makes placing of rigid bodies transposed to the input.
The UseLocalScaling property was sometimes ignored because the used datatype had built in orthogonalization. I solved it by making the multiplication in my own datatype.
VERSION 7 to 8
Changes:
Fixed bugs:
Assigning null resources using 0 caused a counter to crash with dereferencing of a NULL pointer.
Using CPUSurface_CopyRectFromDrawSurface with a very small width caused a padding error when reading from the staging buffer.
VERSION 8 to 9
Changes:
RigidBody_GetLocalInertia was missing the name postfix _OutV3 and was therefor renamed to RigidBody_GetLocalInertia_OutV3.
I discovered that the Bullet physics engine do not allow a shape to be owned by more than one compound shape. Adding a child have that as a new precondition and deleting a compound shape will now delete all it's children that are not used by anything else.
Fixed bugs:
RigidBody_Dynamic_SetLocalInertia made the rigid body static by assigning the linear mass to a value that should have been stored when creating the rigid body.
Sound_SetmetersPerDistanceUnit caused a null pointer exception when loading of a 3D sound failed. It is not dangerous because it was null and trapped but failing to load something should only give one error message when loading failed.
Automatic interpolation of rigid bodies was not working because of a typo in one of the 2 methods.
VERSION 9 to 10
Changes:
Fixed bugs:
The test that checked if the used override channel is empty accidentally used the texture channel instead. A way to go around the bug is to map override channel N to texture channel N.
DrawSurface_SetPixelColor did not tell the engine that the draw surface contain useful data so that an optimization was triggered by accident and returning 0,0,0,0 without looking up the color. A way to go around the error is to call DrawSurface_FillWithColor after creating a draw surface.
Making a copy of all parts using Model_CopyAllParts to and from the same model caused bad behaviour. It is now a precondition that source and destination are different models.
VERSION 10 to 11
Changes:
Fixed bugs:
Grid debug viewing of the height field assumed that the height field was centered to the world.
The methods PostEffect_GiveInputSurface and Draw_GiveInputSurface would cause a crash if something else than a texture or drawsurface was given as input.