January 16 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.

This build is one of the largest ever put out, and has the completed multi-building feature, which is now ready to be used in scripts. This build also has a lot of bugfixes and even some crash fixes.

The new multi-building feature (the result of the Engine Contexts work) supports placing buildings in a map layout, specifying building positions, rotations, and per-building engine boundaries, used for walking between engines, and this essentially turns Skyscraper into a city simulator. The first building (instance 0) is the primary building and doesn't have boundaries, and buildings are loaded in a parent/child relationship, in order to support parent buildings having their landscapes cut for child buildings. Support for this is the introduction of the "<Buildings>" section in scripts. This section also supports recursion, which means that buildings loaded in this section can have their own Buildings section, and load other buildings from that. Each building can have their own default position, rotation and bounds, specified in their Globals section, and when the building is loaded as part of another building, the other building's Buildings section can optionally override those default values. When a "Bounds" value is set for a child engine, by default their Landscapes and Buildings meshes will be cut outside the boundaries (these defaults can be changed), and also their parent will be cut in the same way for the child building. Also, while the user camera is able to move between engines, models can't currently move between them, but might in the future. When a building that has a "Buildings" section is reloaded (Ctrl-R), the "Buildings" section is skipped, to prevent duplicate child buildings from loading. The new demo buildings for this feature are: City Demo.bld (demonstration of how to make a small city) Simple - Multiple Buildings.bld (multiple Simple buildings) Simple - Concurrent.bld (same as the Multiple Buildings one, but loads buildings in parallel)
For a better understanding of how it works, look over the code in those buildings, which is relatively simple, and also the Script Guide's "Buildings" section info.

Since the multi-buildings feature is new, Skyscraper hasn't really been optimized much for it, so don't be suprised if you experience some slowdowns when using lots of buildings. Currently it hasn't appeared to be much of an issue, but I've been evaluating options to improve it. You can press the F2 key to have it show the rendering stats, and the "Batches" count is what you need to be aware of - if it gets to be over a few thousand, you might start noticing performance issues, since "Batches" are done by Ogre on the CPU (processor), not the GPU (graphics card). Polygons (which are sets of triangles) are done on the GPU, and so you can have hundreds of thousands or millions without any real performance issues.

Skyscraper also now supports custom models, and there's a new "Simple - Custom Models" building to demonstrate this. They work the same as regular loaded models, but use most of the standard script commands to make them, such as CreateWallBox and AddCustomWall. The "DestObject" parameter in the global commands has been extended mostly for this, so that you can specify your custom model by name, and also now supports other things such as ColumnFrame, Shafts, Stairwells, etc (see the script guide in the "Global Commands" section for more info). If used in a floor or elevator section, the model specified is one that was created on that floor or elevator, not a global one. Also, global models can now be transported in elevators.

A number of elevator problems have been fixed (including the ones plaguing the previous build), so see the changelog below for more info on those.

A building called "Simple - Manual Switch" has been added, to demonstrate the new manual elevator movement switches feature. The new feature uses manual buttons to work like inspection mode, but for manual movement.

To deal with the precision issues that EG881 pointed out, I originally had the system reposition the buildings so that the "active" building was moved to the center, which worked really well, but caused too many lag issues when switching between buildings. So the other (and final) idea was to build Ogre in double-precision mode (especially since Bullet was already build in double-precision), which fixes the precision issues for multiple buildings, except for renderbuffer precision issues which can't currently be fixed (renderbuffer issues are the per-mesh precision issues, like too large single-building maps, such as a massive "Landscape" mesh). Buildings that are extremely tall (even 100,000 floors) no longer have interior (per-floor) precision issues, but the "External" mesh still has it, since that's a renderbuffer issue, where the single mesh itself goes from the ground all the way up to the high floor, and both Ogre and modern video cards do all render work in single-precision mode only. The reason the floors work fine now is that the render buffer's positions are relative of the mesh (floor/level), so that previously worked fine since the floor itself is positioned high up, but now the Ogre scenenodes (which handle the positioning of everything) are double-precision, so the problems are gone. There was a quote I found online that says about double-precision mode, "Well 64 bits of precision gets you to the furthest distance of Pluto from the Sun (7.4 billion km) with sub-micrometer precision" so that should be plenty for Skyscraper. The performance appears to be the same, but the only disadvantage is that Skyscraper's memory usage is a little higher (on my Linux system, the Triton Center is around 100mb larger).

Skyscraper also now supports 32-bit GPU index buffers, on an on-demand basis, which fixes EG881's Landscapes test issue, where he hit the 16-bit limit. So now instead of having a limit of 65,536 vertex (coordinate) points, the limit is now almost 4.3 billion. Older graphics cards might not support 32-bit buffers, which is why it wasn't supported before, but since Skyscraper defaults to 16-bit buffers unless it needs larger ones, it shouldn't be an issue.

Some major performance issues were fixed, mostly in EG881's tests. On my Linux system, his Landscapes test originally took about 2 minutes 30 seconds to load due to some problematic C++ code, and after I fixed it, it loads in 12 seconds. I found another issue where script includes were loading very slowly, and the NTCC building originally took about 1 minute 34 seconds to load on my system, and afterwards takes 57 seconds.

The CreateWallObject and AddPolygon script commands have been added, which is essentially the AddCustomWall command broken out into 2 separate commands, and lets you work more directly with Skyscraper's Wall system. In Skyscraper, a "Wall" object is a referenced set of polygons (a polygon being a single rectangle, triangle, etc), that together make up a single non-movable object such as a multi-sided wall, as part of a larger movable "Mesh". This was made because if each wall was a mesh, there would be a severe performance impact, but with the wall system, there's no performance overhead. For large landscapes, it's best to have the entire ground be a single "wall" object, which is what the AddGround command automatically does, and you'll notice that in the "Landscape" mesh in Skyscraper, the ground is represented as a single wall object called "Ground". In scripts, the AddCustomWall command would normally create both a Wall object and a custom polygon inside that wall, which isn't good if you want to make thousands of polygons, since it would create a separate Wall object for each. Now, with these commands, you can make a single Wall object, and fill it with thousands of polygons, just like the AddGround command does, and it'll appear as a single wall in the Object Manager window, and no longer have the extra overhead. For EG881's "Landscapes" test, using these commands instead of AddCustomWall, decreased the memory usage on my system by 150mb.

Some other notable things:
-the CreateWallBox commands now support texture overrides
-the AddCustomWall, AddCustomFloor and AddTriangleWall commands were double-adjusting the per-texture sizing info, which has been fixed, so this could potentially cause some things to look differently, but the scope should be rare. This bug appeared after Alpha 7 (during the CS 1.8 development).
-the AddTriangleWall had an altitude defect with the 3rd Y value, which has been fixed
-new Load Building dialog windows have been made, one on the main screen when clicking "Other Building" (which fixes issues on Macs), and also an advanced one when loading a new engine.
-the AddCustomWall now has an optional "RelativeY" parameter, to allow for vertical offsets relative of the floor.

Hopefully I didn't miss anything in this - it's a lot of stuff.

-have Global AddWall/AddFloor commands use a specified mesh object directly instead of processing a string internally - this also fixes a crash if no valid mesh was found in the functions.
-have AddGround also draw underside of landscape
-when inserting another script file, script should be loaded and inserted as a single block, instead of calling insert() for each line, which causes performance problems
-preallocate memory for script file data
-Floor or Elevator script section loops should report when they're finished
-global models can now be transported in elevators, since they now properly change parents
-added "Simple - Custom Models" building
-fixed issue where AddShaftModel and AddStairsModel commands were doing a file check for the wrong parameter, causing false error messages
-added support for custom models to be specified as a "DestObject" value, in global/floor/elevator sections, and even as part of a shaft or stairwell.
-added the ability to use the floor's Interfloor and ColumnFrame meshes, and also Shaft and Stairwell meshes as a script "destobject"
-added a "RelativeY" option to the AddCustomWall command, to allow for relative Y offsets in a floor section, making it compatible with other similar commands
-SetKey state wasn't being properly reset in the script interpreter
-objects created after the simulator start should be initialized properly
-added model centering code to OnInit function, to support custom model centering
-fixed an issue where AddTriangleWall wasn't adding the floor's offset to the 3rd Y value
-added support for creating custom models
-added scaling support for SBS geometry meshes
-prevent run of geometry processor if the mesh is a loaded model, and added more error message details
-fixed menu screen button corruption with double-precision Ogre
-replaced the old file selection dialog with a simplified building list dialog, which also fixes Mac issues associated with the old dialog
-modal windows should be created on the stack instead (fix for some object memory leaks)
-added Load Building dialog for the Engine Manager
-added bounds views to Engine Manager dialog
-clean up empty engine slots at the end of the list, when deleting an engine
-GetPoint and GetWallExtents functions should iterate through all wall polygons, instead of searching by name
-fixed a matching issue with the FindPolygon function, and moved their code into the Wall object
-engines should re-cut for child engines on reload
-moved RenderOnStartup override into Engine Context, to allow the option when reloading a building
-if a user walks outside of all engine boundaries, revert their movement so they stay within the active engine
-lots of fixes to support deleting engines. The system now keeps instance slots open when an engine is deleted, which can be reused later.
-fixed a major vector preallocation bug in the ProcessSubMesh function, causing severe slowdowns with EG881's Landscapes test
-added CreateWallObject and AddPolygon script commands
-have CreateWallBox and AddDoorwayWalls functions automatically create wall objects
-fixed an issue where the AddCustomWall, AddCustomFloor and AddTriangleWall commands were double-adjusting the stored per-texture sizing info. This bug appeared during the CS 1.8 development, and so is not present in Alpha 7.
-made new AddPolygon function, and moved the AddCustomWall functionality into it
-the AddTriangleWall, CreateWallBox and CreateWallBox2 commands weren't working properly when Elevator meshes were specified, due to being disabled from a Genmesh transition in 2010.
-Prepare() function should create 32-bit index buffers if the number of vertices goes outside of the 16-bit range, and especially to prevent a short integer overflow (fix for EG881's 'Landscapes' test)
-only have the primary engine create the old skybox
-have sound system properly handle engine offsets and rotations
-added parent/child support for engines, and added the ability for a parent engine to be cut for a child engine's bounds
-Font code needs to unload the generated texture and font, if an error occurs during font load. This fixes a crash that happens if a missing font's file is added after building load, and the building is reloaded.
-switch to other engines when entering their bounds, instead of waiting to leave the active engine's bounds
-added ToGlobal and FromGlobal functions (C++)
-fixed crashes in the Object Manager and Move Object windows, which were caused by the SBS pointer not being updated properly when a building is reloaded
-HitBeam function fixes for engine offsets
-added support for rotating SBS engines
-added support for relative orientations
-skip Buildings script section when reloading building
-added Swap functions (C++)
-fixed top interior wall of CreateWallBox function, which wasn't displaying properly (this bug appeared during the Ogre transition)
-added Texture Override support to the CreateWallBox commands
-reset camera position if attaching to an engine where the engine's camera is outside of it's bounds
-report when setting an active engine
-added building resets when moving between buildings
-added support for exporting and importing the camera state, to reapply camera settings when walking between engines
-added support for walking between engines, with automatic context switching
-make sure progress dialog is deleted on shutdown
-sync camera when attaching
-added "City Demo" building.
-have SBS engine and Engine Contexts report instance numbers on console
-only pause for SBS banner for the first instance
-if concurrent loading is off, make sure buildings load in order properly
-added the "Simple - Multiple Buildings" and "Simple - Concurrent" multi-building demos.
-added Position and Bounds script global commands
-added Buildings section to the script interpreter, for loading multiple buildings
-if trigger's Y values are both 0, essentially ignore the Y factors when testing for proximity
-add double type to ToString function - now builds with Ogre in double-precision mode
-removed the shift-click call button status change
-when the sim engine is moved, the camera needs to update itself properly so that it can move along with it
-sound objects in controls, triggers, callbuttons and doors are now only created if a sound file is specified
-discard wall objects that are created outside of engine boundaries
-added position-based IsInside function to Trigger object
-added support for cutting outside engine bounds
-added bounds variables and main proximity trigger to engine
-have manual modes not allow new movement if the elevator is already moving - fixes an issue where the elevator would suddenly come to a standstill if the direction button was pressed while stopping
-removed 'k' engine shutdown key assignment
-added support for manual elevator up/down movement switches, which use the same UpOn/UpOff and DownOn/DownOff commands as Inspection Mode, along with a demo building based on the original Simple Manual
-status indicators in the Elevator Editor window should update when the mode is changed, instead of when the -values are refreshed or changed from the window
-added the IsOnFloor and OnRecallFloor functions
-some fixes for issues with elevator Peak modes causing doors to fully close and re-open when call buttons are pressed
-(Regression fix for rev 4066) - properly reset Active Elevator variable when call button is no longer active
-(Regression fix for rev 4066) - call buttons should have separate Active Elevator variables for each call direction
-fixed an issue where an elevator wouldn't stop and open on the recall floor, if on that floor but not leveled
-elevators should have a separate status flag for manual stops, to prevent a conflict with the new stop-on-dequeue feature
-added CopyTexture functions, that use new code for blitting texture data, fixing issues with flickering and darker textures when loading additional buildings


Previous build's changes:

There are a total of 85 changes, fixes, and removals between the last build and this build.

See Also