Cogwheel Chronicles – Engine Updates

Masses amount of progress has been made with Cogwheel over the last few months, some of the engine changes to support the game are illustrated below by associated new lua commands:

SetSkyOptions(mode,skytime,rotateandlight)
–mode = 0/no change, 1/off, 2/sky as local time, 3/sky as skytime(input)
–skytime = decimal hours (e.g. 14.5 is 2.30pm), only used when mode = 3
–rotateandlight = 0/no rotate or light calcs, 1/rotate only, 2/light calcs only, 3/rotate and light
–so SetSkyOptions(2,0,3) sets sky dome/boxes to local time and rotates sky as local time progresses and also adjusts sun factor lighting

SetAllMeshLightsOnOff(1)
— allows all mesh lights to be turned on or off together, saves performance, lights only used at night or indoors

ChangeTerrainAndPosition(OffsetX,OffsetY,OffsetZ,”example.fpm”)
— allows in game change of full terrain, can be positioned anywhere, created to allow terrain islands to load without new level shenanigans being needed. Huge amount of change for this one to allow shadows to work properly and player to move anywhere in open world

CreateExplosion(explosionX,explosionY,explosionZ,explosionSpriteSheet,smokeSpriteSheet,lightFlag,smokeSize,sparksCount,sparksSize,explosionSize,explosionDamage,explosionRadius,soundID,sourceEntity,spriteRows,spriteCols)
— allows any type (row,column) sprite sheet to be used for explosions, created anywhere required – needed this for dramatic air battle scenes.

TakeInGameScreenShot(“test picture.jpg”)
— creates a screen shot and stores in bespoke mydocuments folder. Used for automated capture of killer views and quest achievements.

RaiseAndLowerTerrain(0,X,Z,Radius,Height)
— allows in game modification of terrain height (like editor controls). Also repairs terrain collision and water mask after update.

Setup.ini – terrainsizefactor = 2
— changing this value affects the linear size of the terrain – so set to 2 and get 4 times stock size, 3, gives 9 etc. Tested up to 10 (100 times) but get terrain tearing at very high values. Still amazing how large can go with this value. Also needed shader changes to allow the terrain textures to tile properly and watermask to work, and lots of engine change to allow the editor to address and update the larger terrain. I’ve settled on a factor of 2 for Cogwheel. This creates nice large islands to visit (that are loaded in game).

AddAnotherExistingEntity(e of entity to clone,X,Y,Z,AngX,AngY,AngZ)
— creates duplicate entities on the fly in game. Used to populate trees and grass on the islands loaded in and also to generate money, food, collectables etc when needed.

DeleteExistingEntity(e)
— counter part to AddAnotherExistingEntity, so can manage memory usage.

HighlightObject(e, type) 
–Allows in game highlighting of any object where the e value is known
–type –101(red),102(pink),103(green),104(blue/green),105(gold)
— this is coercing the editor capability for game play purposes (where hover over an entity and it changes color).
— Used to highlight items for player to examine etc

GetFPS ()
— used to retrieve FPS in game so that settings can be dynamically modified to help smooth out game play and keep FPS up, e.g. turn off light rays if FPS drops too far etc

ChangeToRealTimeOrBaked(v) 1 = pre-bake, 2= real-time
— allows in game switching of lighting method. Used to switch to baked lightmaps indoors and down the mine.
— Changed the engine light-mapper to only bake entities that have strength/health of 99. This is because I don’t want outdoor entities to be baked, nor do I want to set them to dynamic as slows engine down. This allows faster bake time and also keeps the lightmaps and lightmap entity sizes to the minimum. Also update custom shaders to allow illum textures to work with lightmapped assets and for specular reflections (PBR) – blends lightmap with PBR response to dynamic light (sun or placed lights).


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.