February 9 2016 build

From Skyscraper
Jump to: navigation, search
This is the article of a development build of Skyscraper Simulator.
It has been confirmed a good-faith contribution to the Skyscraper wiki.

A memory corruption bug was found and fixed, along with another initialization bug. I re-uploaded the packages with the fix, so if you already downloaded this version, download the updated patch.

Changes of update:
-value initialization fix (dynamic meshes code)
-UpdateVertices function had only been set up for combined meshes, and was causing corruption when using separate meshes
-force combine the floor and elevator door containers
-have Windows crash dump show 3D renderer


This build introduces the new Dynamic Meshes system, which is a system that completely overhauls the way the simulator manages 3D graphics data, and greatly improves performance overall. The main challenge was to try to eliminate lag in the Northeast Triad Convention Center building, and with the new system, I managed to double the framerate of that building, by cutting the 3D rendering workload (batches) in half.

Currently the Dynamic Meshes system supports two features, and integrates with Skyscraper's existing mesh system, so that the mesh code continues to work the same, but there's an additional abstraction layer that manages 3D data for efficiency, while being mostly transparent to the general Skyscraper engine code. The first feature is an automatic combiner, which checks to see if combining a lot of SBS mesh objects together into a single mesh would improve performance. If they will, it combines them together, otherwise it leaves them separate (the original way). This feature is commonly called "Static Batching" in 3D graphics. The second feature is a form of virtual meshes, in order to fix the problem of having the performance drop significantly when many small objects, such as doors, are added. It'll automatically combine all of those (such as all doors together on a floor) into a single mesh, and then allow movement by modifying the 3D graphics data directly. This second feature is commonly called "Dynamic Batching", and is the feature that fixed the lag of the NTCC building. The Dynamic Meshes system is still being developed, and there's still more features I need to add, but these two features are working very well. One issue though, is that the "Render on Startup" feature is currently broken due to this.

Due to the Dynamic Meshes system, you should see improved performance in almost every area, but in certain rare circumstances, it'll make things worse on older graphics cards due to too much being combined together (this is being fixed, and the only thing I noticed it on, was a Simple building with 5000 floors, running on an old laptop). In the Triton Center, showing a full shaft with a lot of elevators and shaft doors would cause a significant performance drop, but now there's hardly any performance impact from that. In that building, the floors are still kept separate, but all of the interfloors and column frames are automatically combined together, and so it's able to display all of the interfloors and column frames without any real performance impact.

Skyscraper also has a new event-driven keyboard and mouse input system, which greatly improved framerate (FPS) on Linux. I didn't do enough testing on Windows to see if it helped, but it should have. I also fixed a performance bottleneck in the code that uses Bullet (for collision detection), which also improves performance. These fixes were done to help improve scalability when loading multiple buildings (multiple sim engines).

I made some minor changes, where the F1 key now shows the key reference, the Engine Manager has a "Move" button to move engines around, and I did major rework of the C++ headers to improve compiling speed. Switching to fullscreen with the F10 key on Windows no longer causes a performance drop.

The console is now able to disable autoscroll, if you click anywhere in the text box (except for the end). It'll hold the view at the location that you clicked on, and you can re-enable autoscroll by pressing the "Auto Scroll" button.

Here's the before and after rendering stats of the NTCC building, tested on an Amazon EC2 instance with an Nvidia GRID graphics card:

Before:
FPS: 55.5556 - Batches: 2179 - Triangles: 129117 - Vertices: 5430619

After:
FPS: 114.851 - Batches: 972 - Triangles: 138283 - Vertices: 5565595

See the changelog below for the other fixes, which include a number of reported bugs.


Changelog:
-console will turn autoscroll off if user clicks at a location to stay at in the text box, and scroll will reenable when the "Auto Scroll" button is clicked
-fixed an issue where physical models would not properly stay in elevators
-header rework, to improve compiling performance
-created new TextureManager object, for texture-related functions
-added a Move button to the Engine Manager dialog, to allow moving sim engines
-show the control reference when pressing the F1 key
-changed 'faces' to 'triangles' for F2 key function
-added new Dynamic Meshes system, which automatically combines grouped mesh objects into a single mesh, if needed, to greatly improve performance
-when elevator number is changed, properly update the door count slider
-fixed typo in SetRotation code, causing X and Z issues during Y axis rotation
-added missing F8 key to docs
-merged divide-by-zero fixes - fixes a reported issue in the elevator deceleration (jerk rate calculation) code
-control panel needs to properly unregister on exit
-(OgreBullet) add proper isInWorld check to base collision object, instead of a rigid body variable
-(OgreBullet) manually update static collider bounding boxes, to improve performance
-adjust freelook speed for frame rate
-moved mainscreen code into separate file
-added event-driven keyboard and mouse input system
-reworked code that handles persistent shaft doors, so that they only stay persistent when the camera is active in that engine
-removed extra shaft door disable code, since mesh disabling code should be run after the simulator startup, to prevent new colliders being added to disabled meshes
-simplified triangle index array in PolyMesh system, to prevent an extra vertex copy operation. This removes the TriangleMesh type and reuses TriangleIndices instead
-moved Triangle code into separate header file, and added operator functions
-renamed TriangleType to Triangle, due to SBS namespace addition
-disable elevators in shafts that have ShowFloors disabled, when leaving/resetting building
-turn off shafts and stairwells when resetting building
-make sure destobject-specified models are custom models, not loaded models
-disable Caelum sky system when switching to wireframe mode, to hide the sky triangles
-added mention of subfolders for Buildings section Load command
-when switching to fullscreen on Windows, enable double-buffering on the window to fix performance issues

Previous build's changes:
http://forum.skyscrapersim.com/index.php?topic=7057.msg74272#msg74272

See Also