[SOLVED] Level issue - i3670 - 11-01-2016
So, I've run into an issue with one of my maps. As I enter a part of the map the framerate begins to drop significantly until it dies completely. Does anyone know what might be the cause behind this? I've enclosed the hps file in case there's some issue in there.
.hps file
Spoiler below!
PHP Code:
#include "interfaces/Map_Interface.hps" #include "base/Inputhandler_Types.hps" #include "helpers/helper_map.hps" #include "helpers/helper_props.hps" #include "helpers/helper_effects.hps" #include "helpers/helper_audio.hps" #include "helpers/helper_imgui.hps" #include "helpers/helper_sequences.hps" #include "helpers/helper_game.hps" #include "helpers/helper_modules.hps" #include "helpers/helper_ai.hps" #include "helpers/helper_player.hps" #include "helper_custom_depth.hps" #include "helper_imgui_station.hps" #include "helper_imgui_station_apps_common.hps" #include "helper_imgui_station_app_error.hps" #include "helper_imgui_station_app_numpad.hps" #include "helper_imgui_station_app_audioplayback.hps" #include "helper_imgui_station_app_mail.hps" //-------------------------------------------------- /*Place any global values here. These must be const variables as they will not be saved*/ /*This is also the place for enums and classes, but these should be avoided whenever possible*/ //-------------------------------------------------- const tString gsDoorCodeNo = "0735" ; enum eHubRoomTerminalState { eHubRoomTerminalState_MainMenu = - 1 , eHubRoomTerminalState_Mail , eHubRoomTerminalState_Power , eHubRoomTerminalState_Staff , eHubRoomTerminalState_LogOut , eHubRoomTerminalState_LogIn_Main , eHubRoomTerminalState_LogIn_Code , } enum eHubRoomTerminalUsers { eHubRoomTerminalUsers_Amy = 2 , eHubRoomTerminalUsers_Carl = 7 , } class cScrMap : iScrMap { ///////////////////////////////////////// // ============== // VARIABLE CREATION // ============== //{/////////////////////////////////////// bool mbPlayerGotLight ; bool mbPlayerIsSitting ; bool mbPitchLimitsSaved = false ; cVector2f mvSavedPitchLimits ; tString msTrainChairName ; //} END VARIABLE CREATION //-------------------------------------------- ////////////////////////////////////////////////////////////////////////////////////////// // ============== // MAIN CALLBACKS // ============== //{/////////////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------- //////////////////////////// // Set up map environment void Setup () { } //------------------------------------------------------- //////////////////////////// // Run first time starting map void OnStart () { SetupLabCamera (); Map_AddTimer ( "TrainBounce" , 1.0 , "Timer_TrainBounce" ); Map_AddTimer ( "ComputerLoad" , 1.0 , "Timer_ComputerLoad" ); Prop_MoveLinearTo ( "01_05_transporter_passenger_1" , "train_arrived" , 10 , 12 , 4.0f , false ); Light_SetVisible ( "SamsElectrolyte" , false ); ParticleSystem_SetVisible ( "SamElecPS_*" , false ); ParticleSystem_SetVisible ( "panelPS_*" , false ); ParticleSystem_SetVisible ( "wau_panelPS_*" , false ); Light_SetVisible ( "PointLight_156" , false ); Entity_PlayAnimation ( "patchwork" , "lying" , 0.0f , true ); Prop_SetStaticPhysics ( "01_05_transporter_passenger_door*" , true ); Entity_AttachToEntity ( "player" , "01_05_transporter_passenger_1" , "" , false , true ); Sound_CreateAtEntity ( "TrainLoop" , "01_04_transport_station/Special/Train/sequence" , "player" , 0.0f , false , 1.0f ); /////Starting Sequence/////// Player_SetJumpDisabled ( true ); Effect_Fade_Out ( 0.0f ); Effect_Fade_In ( 5.0f ); Sound_FadeGlobalVolume ( 0.0f , 0.0f , eSoundEntryType_WorldAll ); Sound_FadeGlobalVolume ( 1.0f , 5.0f , eSoundEntryType_WorldAll ); /////Starting Sequence End// } //------------------------------------------------------- void Timer_TrainBounce (const tString & in asTimer ) { //////////////////////// // This timer should repeat! Map_AddTimer ( "TrainBounce" , cMath_RandRectf ( 1.0 , 3.0 ), "Timer_TrainBounce" ); /////////////////////////////////////////////// // Periodically cause a subtle shake effect for the train Effect_Shake_Start ( 0.03 , 0.1 , 0.21 , 0.21 , cVector3f ( 0 , 1 , 0 ), 3 ); } void stunrod_1_OnPlayerInteract (const tString & in asEntity ) { Sound_CreateAtEntity ( "" , "03_02_omicron_inside/gameplay/battery/battery_pickup" , "player" , 0.0f , false , 1.0f ); } bool TrainCollideFirst (const tString & in asParent , const tString & in asChild , int alState ) { Prop_MoveLinearTo ( "01_05_transporter_passenger_1" , "train_arrived" , 5 , 7 , 0.0f , false ); Sound_CreateAtEntity ( "TrainArrive" , "00_01_subway/SFX/train_arriving" , "player" , 0.0f , false , 1.0f ); return true ; } bool TrainCollideSecond (const tString & in asParent , const tString & in asChild , int alState ) { Prop_MoveLinearTo ( "01_05_transporter_passenger_1" , "train_arrived" , 5 , 15 , 0.0f , false ); Prop_MoveLinearTo ( "slidedoor_traintunnel_2" , "door_fucker" , 5 , 15 , 0.0f , false ); Entity_SetActive ( "slidedoor_traintunnel_2" , false ); Effect_Shake_Start ( 0.1f , 2.0f , 0.21f , 0.21f , cVector3f ( 0.1 , 0.1 , 0.1 ), 2 ); Map_AddTimer ( "TimerBrakes" , 1.5f , "TimerTramDoors" ); Sound_Stop ( "TrainLoop" , 4.0f ); return false ; } bool TrainCollideLast (const tString & in asParent , const tString & in asChild , int alState ) { Prop_MoveLinearTo ( "01_05_transporter_passenger_1" , "train_arrived" , 5 , 0 , 8.0f , false ); Prop_MoveLinearTo ( "slidedoor_traintunnel_2" , "door_fucker_1" , 5 , 5 , 0.0f , false ); Map_RemoveTimer ( "TrainBounce" ); Player_SetMoveSpeedMul ( 1.0f ); Player_SetJumpDisabled ( false ); Player_SetStandDisabled ( false ); Player_SetPitchLimits ( 0 , 0 ); Player_SetYawLimits ( 0 , 0 ); Sound_CreateAtEntity ( "" , "00_01_subway/ambience/inside/announcer_ping" , "01_05_transporter_passenger_1" , 0.0 , false ); mbPlayerIsSitting = false ; Map_AddTimer ( "TimerSound" , 2.0f , "TimerTramDoors" ); Map_AddTimer ( "TimerOpen" , 3.0f , "TimerTramDoors" ); return true ; } void TimerTramDoors (const tString & in asTimer ) { if ( asTimer == "TimerSound" ){ Sound_CreateAtEntity ( "" , "Entities_Station/object/train/door/open_motion" , "SlidedoorAtStation_1" , 0 , false ); Sound_CreateAtEntity ( "" , "Entities_Station/object/train/door/open_start" , "SlidedoorAtStation_1" , 0 , false ); Sound_CreateAtEntity ( "" , "Entities_Station/object/train/door/open_motion" , "SlidedoorAtStation_2" , 0 , false ); Sound_CreateAtEntity ( "" , "Entities_Station/object/train/door/open_start" , "SlidedoorAtStation_2" , 0 , false ); Entity_SetInteractionDisabled ( "Omnitool" , false ); } if( asTimer == "TimerOpen" ){ PhysicsSlideDoor_AutoMoveToState ( "SlidedoorAtStation_*" , 1 ); Entity_SetActive ( "01_05_transporter_passenger_door*" , false ); Entity_SetActive ( "SlidedoorAtStation_*" , true ); Prop_MoveLinearTo ( "slidedoor_traintunnel_2" , "door_fucker_1" , 5 , 5 , 0.0f , false ); } if( asTimer == "TimerBrakes" ){ Sound_CreateAtEntity ( "TrainArrive" , "02_06_theta_tunnels/sfx/events/elevator_sequence/motor/stop" , "player" , 0.0f , false , 0.7f ); Map_RemoveTimer ( "TimerBrakes" ); } } bool OmniTool_OnUse (const tString & in asTool , const tString & in asEntity ) { if ( asEntity == "FirstSeal" ) { CathTool_UseOnPanel ( "Omnitool" , "FirstSeal" ); return true ; } return false ; } void FirstSeal_OnConnectionStateChange (const tString & in asEntity , int alState ) { Map_AddTimer ( "DockDoorButton_Interact" , 2.0f , "DockDoorButton_Interact" ); } void DockDoorButton_Interact (const tString & in asTimer ) { SlideDoor_SetClosed ( "FirstSealedDoor" , false ); Entity_SetActive ( "ToolArea_1" , false ); } void InteractLeaveChair (const tString & in asEntity ) { Sound_CreateAtEntity ( "player_sit" , "01_04_transport_station/SFX/foley/train_stand" , msTrainChairName , 0 , false ); Entity_AttachToEntity ( "player" , "01_05_transporter_passenger_1" , "" , false , false ); } //////////////////////////// // Run when entering map void OnEnter () { ImGui_PreloadImage ( "inv_omnitool.tga" ); ImGui_PreloadImage ( "graphics/imgui/station/filetreeicons/file_icon.tga" ); ImGui_PreloadImage ( "graphics/imgui/station/thirdparty/pda/pda_background.tga" ); } //------------------------------------------------------- //////////////////////////// // Run when leaving map void OnLeave () { } //------------------------------------------------------- //////////////////////////// // The player has died. void OnPlayerKilled ( int alRecentDeaths , const tString & in asSource ) { } //------------------------------------------------------- //////////////////////////// // To get when player makes input (mostly used for debug) void OnAction ( int alAction , bool abPressed ) { if( abPressed == false ) return; if( alAction == eAction_Test1 ) { } } //------------------------------------------------------- //////////////////////////// // This only used for pure debug purposes when info needs to printed. float DrawDebugOutput ( cGuiSet @ apSet , iFontData @ apFont , float afY ) { //afY = cLux_DrawDebugText("My Debug value:"+..., afY); return afY ; } //------------------------------------------------------- void OnGui ( float afTimeStep ) { } //------------------------------------------------------- //} END MAIN CALLBACKS ////////////////////////////////////////////////////////////////////////////////////////// // ============== // MAIN FUNCTIONS // ============== //{/////////////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------- /*Put any variables that are used in more than one scene here.*/ //------------------------------------------------------- /*Put any functions that are used in more than one scene here.*/ bool CollideRadiationArea (const tString & in asParent , const tString & in asChild , int alState ) { Sound_CreateAtEntity ( "Rad" , "02_06_theta_tunnels/sfx/ark_comp/ark_comp_compile/ark_comp_compile_start" , "RadArea_3" ); return true ; } bool CollideSterilizerArea (const tString & in asParent , const tString & in asChild , int alState ) { SlideDoor_SetClosed ( "slidedoor_theta_small_windowed_1" , true , false ); Entity_SetActive ( "SterilArea" , false ); Entity_SetActive ( "warning_1" , true ); Entity_SetActive ( "warning_2" , true ); Map_AddTimer ( "Timer_Sterilize_up" , 3.0f , "Timer_Sterilize" ); Map_AddTimer ( "Timer_Sterilize_med" , 4.0f , "Timer_Sterilize" ); Map_AddTimer ( "Timer_Sterilize_down" , 5.0f , "Timer_Sterilize" ); Map_AddTimer ( "Timer_Sterilize_cloud" , 7.5f , "Timer_Sterilize" ); Map_AddTimer ( "Timer_Sterilize_end" , 12.5f , "Timer_Sterilize" ); Map_AddTimer ( "Timer_Sterilize_open" , 15.5f , "Timer_Sterilize" ); return true ; } void Timer_Sterilize (const tString & in asTimer ) { if( asTimer == "Timer_Sterilize_up" ){ for( int i = 1 ; i <= 4 ; i ++){ ParticleSystem_CreateAtEntity ( "PS_Ster_" + i + "" , "steam_airlock.ps" , "PS_Area_" + i + "" , true ); } Sound_CreateAtEntity ( "alarm" , "01_02_upsilon_inside_02/amb/spot/comm_room_alarm" , "PS_Area_13" , 0.0f , true , 3.0f ); } if( asTimer == "Timer_Sterilize_med" ){ for( int i = 5 ; i <= 8 ; i ++){ ParticleSystem_CreateAtEntity ( "PS_Ster_" + i + "" , "steam_airlock.ps" , "PS_Area_" + i + "" , true ); } } if( asTimer == "Timer_Sterilize_down" ){ for( int i = 9 ; i <= 12 ; i ++){ ParticleSystem_CreateAtEntity ( "PS_Ster_" + i + "" , "steam_airlock.ps" , "PS_Area_" + i + "" , true ); } } if( asTimer == "Timer_Sterilize_cloud" ){ ParticleSystem_CreateAtEntity ( "PS_Shower" , "steam_shower.ps" , "PS_Area_13" , true ); } if( asTimer == "Timer_Sterilize_end" ){ for( int i = 1 ; i <= 12 ; i ++){ ParticleSystem_Destroy ( "PS_Ster_" + i + "" ); ParticleSystem_Destroy ( "PS_Shower" ); } Sound_Stop ( "alarm" , 2.0f ); } if( asTimer == "Timer_Sterilize_open" ){ SlideDoor_SetClosed ( "slidedoor_theta_small_windowed_2" , false , false ); Entity_SetActive ( "warning_1" , false ); Entity_SetActive ( "warning_2" , false ); } } bool CollideSterilizerAreaOut (const tString & in asParent , const tString & in asChild , int alState ) { SlideDoor_SetClosed ( "slidedoor_theta_small_windowed_2" , true , false ); Button_SetLocked ( "panel_laboratory_9" , true , true ); Entity_SetActive ( "SterilArea_1" , false ); return true ; } bool CollideAutoDoorOpen (const tString & in asParent , const tString & in asChild , int alState ) { if ( alState == 1 ){ SlideDoor_SetClosed ( "slidedoor_lab_glass_right_2" , false , false ); SlideDoor_SetClosed ( "slidedoor_lab_glass_left_2" , false , false ); } if ( alState == - 1 ){ SlideDoor_SetClosed ( "slidedoor_lab_glass_right_2" , true , false ); SlideDoor_SetClosed ( "slidedoor_lab_glass_left_2" , true , false ); } return true ; } bool TriggerScreamFlicker (const tString & in asParent , const tString & in asChild , int alState ) { Entity_SetActive ( "AreaTriggerScreamFlicker" , false ); Entity_SetActive ( "DistortionArea_6" , true ); Map_AddTimer ( "Timer_Start" , 0.5f , "TimerFlickerStart" ); Map_AddTimer ( "Timer_Break" , 2.75f , "TimerFlickerStart" ); Map_AddTimer ( "Timer_Stop" , 3.5f , "TimerFlickerStart" ); Sound_CreateAtEntity ( "" , "NPC_Creatures/Vocalisations/InWorld/Flesher/ladder_scream" , "slidedoor_theta_small_12" , 0.0f , false , 2.0f ); return true ; } void TimerFlickerStart (const tString & in asTimer ) { if( asTimer == "Timer_Start" ){ Lamp_SetFlickerActive ( "living_quarters_fluo_*" , true ); } if( asTimer == "Timer_Break" ){ Lamp_SetFlickerActive ( "living_quarters_fluo_1" , false ); Lamp_SetLit ( "living_quarters_fluo_1" , false , false ); Lamp_SetFlickerActive ( "living_quarters_fluo_3" , false ); Lamp_SetLit ( "living_quarters_fluo_3" , false , false ); ParticleSystem_CreateAtEntity ( "" , "elec_spark_physics_few_oneshot.ps" , "Elec_Area_1" , false ); ParticleSystem_CreateAtEntity ( "" , "elec_spark_physics_few_oneshot.ps" , "Elec_Area_2" , false ); } if( asTimer == "Timer_Stop" ){ Lamp_SetFlickerActive ( "living_quarters_fluo_*" , false ); Entity_SetActive ( "DistortionArea_6" , false ); } } void SwitchedOnLights (const tString & in asEntity , int alState ) { if ( alState == 1 ){ Sound_Play ( "SoundScream" , 0.1 ); Sound_CreateAtEntity ( "Startup" , "01_02_upsilon_inside_02/sfx/carl_torture_event/electricity_start" , "ElecSoundArea" , 0.0f , false , 1.0f ); Sound_CreateAtEntity ( "Loop" , "01_02_upsilon_inside_02/sfx/carl_torture_event/electricity_loop" , "ElecSoundArea" , 2.0f , false , 1.0f ); Sound_CreateAtEntity ( "CooldownLoop" , "01_02_upsilon_inside_02/sfx/carl_torture_event/cooldown_loop" , "ElecSoundArea" , 2.0f , false , 1.0f ); ParticleSystem_CreateAtEntity ( "OldSparky" , "elec_spark_large_continuous.ps" , "SamExecutionElec_*" , false ); ParticleSystem_SetVisible ( "SamElecPS_*" , true ); Entity_SetActive ( "DistortionArea_7" , true ); Map_AddTimer ( "TimerScreamSam" , .75f , "TimerSoundLoop" ); Light_SetVisible ( "SamsElectrolyte" , true ); } if ( alState == - 1 ){ ParticleSystem_Destroy ( "OldSparky" ); Map_RemoveTimer ( "TimerScreamSam" ); Lamp_SetFlickerActive ( "living_quarters_fluo_*" , false ); ParticleSystem_SetVisible ( "SamElecPS_*" , false ); Entity_SetActive ( "DistortionArea_7" , false ); Entity_SetActive ( "ark_crew_04_1" , false ); Entity_SetActive ( "ark_crew_04_2" , true ); Sound_Stop ( "Startup" , 1.0f ); Sound_Stop ( "Loop" , 1.0f ); Light_SetVisible ( "SamsElectrolyte" , false ); Button_SetLocked ( "theta_panel_lightswitch_attachment_3" , false , true ); Sound_CreateAtEntity ( "sparkssy" , "level_amb_shared_interior/amb/spot/sparks/spark_train_crash" , "theta_panel_lightswitch_attachment_3" , 0.0f , false , 1.0f ); ParticleSystem_SetVisible ( "panelPS_*" , true ); } } void TimerSoundLoop (const tString & in asTimer ) { if( asTimer == "TimerScreamSam" ){ Lamp_SetFlickerActive ( "living_quarters_fluo_*" , true ); Sound_Play ( "SoundScream" , 0.1 ); Map_AddTimer ( "TimerScreamSam" , .75f , "TimerSoundLoop" ); } } void InteractPartialDoorButton (const tString & in asEntity ) { Light_SetVisible ( "PointLight_156" , true ); ParticleSystem_SetVisible ( "wau_panelPS_*" , false ); Button_SetLocked ( "theta_panel_26" , false , true ); Entity_SetInteractionDisabled ( "theta_panel_26" , true ); Player_GiveDamage ( 0.1f , 0.1 , eDamageType_Electricity , "" ); } //------------------------------------------------------- //} END MAIN FUNCTIONS ////////////////////////////////////////////////////////////////////////////////////////// // ============== // SCENE X *NAME OF SCENE* // ============== //{////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////// // General //{////////////////////////////////////// //------------------------------------------------------- /*Put any variables that are used by many events in Scene X here.*/ //------------------------------------------------------- /*Put any functions that are used in more than one event in Scene X here.*/ //------------------------------------------------------- //} END General ///////////////////////////////////////// // Event *Name Of Event* //{////////////////////////////////////// //------------------------------------------------------- /*Put any variables that are only used in Scene X, Event X here.*/ //------------------------------------------------------- /*Put any functionsthat are only used in Scene X, Event X here.*/ //------------------------------------------------------- //} END Event *Name Of Event* //} END SCENE X ///////////////////////////////////////// // ============== // TERMINALS // ============== //{////////////////////////////////////// //------------------------------------------------------- ///////////////////////////////////////// // Terminal *Name Of Terminal* //{////////////////////////////////////// //------------------------------------------------------- /*Put any variables that are only used Terminal here.*/ bool mbButtonPressed ; //------------------------------------------------------- /*Put any functions that are only used Terminal here.*/ bool mbSentDraft = false ; bool mbCommRoomPoweredOn = false ; void TerminalEntrance_OnGui (const tString & in asEntityName , float afTimeStep ) { // Set Translation Category ImGui_SetTransCategory ( "Arlington_Concept_01" ); ///////////////////////////////// // Backdrop StationGuiBG_Backdrop ( "background/background_logo_pathOS" , cVector2f ( 0.01 , 0.45 )); StationGuiBG_Scanlines (); StationGuiBG_Taskbar ( "upsilon" ); if ( ImGui_GetStateBool ( "DisplayLowPowerError" , false )) { return; } if ( StationGui_DrawAndCheckErrors ()) return; int lMail = - 1 ; bool bBackButtonEnabled = true ; int lBackApp = eHubRoomTerminalState_MainMenu ; int lActiveApp = StationGui_GetActiveApp (); switch ( lActiveApp ) { case eHubRoomTerminalState_LogIn_Main : break; case eHubRoomTerminalState_LogIn_Code : if ( StationGui_Numpad ( "ControlTerminalApp_LogIn" , 4 )) { StationGui_SetActiveApp ( eHubRoomTerminalState_LogIn_Main ); } bBackButtonEnabled = true ; lBackApp = eHubRoomTerminalState_LogIn_Main ; break; case eHubRoomTerminalState_Mail : if ( ImGui_GetStateInt ( "LoginUser" )== eHubRoomTerminalUsers_Amy ) { Depth_ImGui_AddMail ( "EntranceTerminal_Subject_1" , "EntranceTerminal_Body_1" , "" , "EntranceTerminal_Date_1" , eMailAppEntryType_Sent ); Depth_ImGui_AddMail ( "EntranceTerminal_Subject_1" , "EntranceTerminal_Body_1" , "" , "EntranceTerminal_Date_1" , eMailAppEntryType_Inbox ); } else { Depth_ImGui_AddMail ( "EntranceTerminal_Subject_1" , "EntranceTerminal_Body_1" , "" , "EntranceTerminal_Date_1" , eMailAppEntryType_Inbox ); Depth_ImGui_AddMail ( "EntranceTerminal_Subject_2" , "EntranceTerminal_Body_2" , "" , "EntranceTerminal_Date_2" , eMailAppEntryType_Draft ); Depth_ImGui_AddMail ( "EntranceTerminal_Subject_4" , "EntranceTerminal_Body_4" , "" , "EntranceTerminal_Date_4" , eMailAppEntryType_Inbox ); } StationGui_MailApp ( "SentMail_HubRoomTerminal" ); break; case eHubRoomTerminalState_Power : if ( StationGui_Numpad ( "ComputerNumPad_Header" , 5 )) { tString sCode = StationGui_GetNumpadInput (); if ( sCode == "27522" ) { Button_SetLocked ( "highsecurity_1" , false , true ); StationGui_SetError ( "Decontamination_Text" ); cGuiDialogBoxSettings dialogBox = StationGui_CreateDefaultDialogBox (); dialogBox . mType = eGuiDialogBoxType_OK ; eGuiDialogCode code = Depth_ImGui_DialogBox ( "Decontamination_Header" , "Decontamination_Text" , dialogBox ); Sound_CreateAtEntity ( "" , "Entities_Station/tech/terminal_beeps/terminal_computer_granted" , ImGui_GetName (), 0.0f , false , 1.0f ); if ( code == eGuiDialogCode_OK ) { StationGui_SetActiveApp ( eHubRoomTerminalState_MainMenu ); } } else { StationGui_SetError ( "DoorNumPad_WrongCode" ); Button_SetLocked ( "highsecurity_1" , true , true ); Sound_CreateAtEntity ( "" , "Entities_Station/tech/terminal_beeps/terminal_computer_denied" , ImGui_GetName (), 0.0f , false , 1.0f ); } } break; case eHubRoomTerminalState_Staff : StationGui_TextReaderSingle ( "EntranceStaff_Header" , "EntranceStaff_Text" ); break; case eHubRoomTerminalState_LogOut : StationGui_TextReaderSingle ( "SuperSecretProject_Header" , "SuperSecretProject_Text" ); break; case eHubRoomTerminalState_MainMenu : StationGui_AddApp ( "EntranceTerminalApp_Mail" ); StationGui_AddApp ( "EntranceTerminalApp_Power" ); StationGui_AddApp ( "EntranceTerminalApp_Staff" ); StationGui_AddApp ( "EntranceTerminalApp_LogOut" ); StationGui_MainMenu (); bBackButtonEnabled = false ; break; } if ( StationGui_BackButton ( bBackButtonEnabled , lBackApp )) { if ( lActiveApp == eHubRoomTerminalState_LogIn_Code ) StationGui_SetNumpadInput ( "" ); } } bool SentMail_HubRoomTerminal (const tString & in asTitle ) { if (! mbCommRoomPoweredOn ) { StationGui_SetError ( "NetworkError_1" ); } else { mbSentDraft = true ; } return mbCommRoomPoweredOn ; } void Timer_ComputerLoad (const tString & in asTimer ) { //////////////////////// // This timer should repeat! Map_AddTimer ( "ComputerLoadStop" , cMath_RandRectf ( 3.0 , 6.0 ), "Timer_ComputerLoad" ); Sound_CreateAtEntity ( "CLoad" , "level_amb_shared_machines/tech/HDD/underload_loop" , "ComputerEntrance" , 0.5f , true , 0.8f ); if( asTimer == "ComputerLoadStop" ){ Sound_Stop ( "CLoad" , 0.2f ); Map_AddTimer ( "ComputerLoad" , cMath_RandRectf ( 10.0 , 18.0 ), "Timer_ComputerLoad" ); } } void TerminalEntrance_EnterGui (const tString & in asEntityName ) { } void TerminalEntrance_LeaveGui (const tString & in asEntityName ) { } void SetupLabCamera () { Gui_CreateCameraTexture ( "LabCamera" , cVector2l ( 768 , 613 ), 30 , 90.0f , 0.1 , 60 ); Gui_AttachCameraTextureToEntity ( "LabCamera" , "CameraLabArea" ); } /////////ResearchTerminals Begin\\\\\\\\\\\\ void ResearchTerminalOneOnGui (const tString & in asEntityName , float afTimeStep ) { cImGuiGfx gfx ( "LabCamera" , eImGuiGfx_Special ); ImGui_DrawGfx ( gfx , cVector3f ( 0 , 0 , 5.0f ), ImGui_GetSize (), cColor ( 1 , 1 )); } void ResearchTerminalTwoOnGui (const tString & in asEntityName , float afTimeStep ) { } void ResearchTerminalThreeOnGui (const tString & in asEntityName , float afTimeStep ) { } void ResearchTerminalFourOnGui (const tString & in asEntityName , float afTimeStep ) { } /////////ResearchTerminals End\\\\\\\\\\\\ void DoorNumPad_OnGui (const tString & in asEntityName , float afTimeStep ) { StationGuiBG_Backdrop (); StationGuiBG_Scanlines (); if ( StationGui_Numpad ( "DoorNumPad_Header" , 4 )) { tString sCode = StationGui_GetNumpadInput (); if ( sCode == "7491" ) { Button_SetLocked ( "panel_laboratory_11" , false , true ); Sound_CreateAtEntity ( "" , "Entities_Station/tech/terminal_beeps/terminal_computer_granted" , ImGui_GetName (), 0.0f , false , 1.0f ); } else { StationGui_SetError ( "DoorNumPad_WrongCode" ); Sound_CreateAtEntity ( "" , "Entities_Station/tech/terminal_beeps/terminal_computer_denied" , ImGui_GetName (), 0.0f , false , 1.0f ); } } } void SamDatapad_OnGui (const tString & in asEntityName , float afTimeStep ) { ImGui_SetTransCategory ( "Arlington_Concept_01" ); StationGuiBG_Backdrop (); StationGuiBG_Scanlines (); cStationGui_TextReaderSettings settings ; settings . mbFullScreen = true ; StationGui_TextReaderSingle ( "SamData_Title" , "SamData_Body" , settings , cVector3f ( 0.05 , 0.02 , 1 ), cVector2f ( 0.9 , 0.95 )); } //------------------------------------------------------- //} END Terminal *Name Of Terminal* //} END TERMINALS }
RE: Level issue - Mudbill - 11-01-2016
That's quite a big script to scan which could be made much simpler with a little extra info. In what part does it happen? Can you try to narrow down as much script as possible to the issue? Could it perhaps be something placed in the level and not the script file?
I'm no SOMA expert, but this info would definitely help whoever decides to look into it.
RE: Level issue - Abion47 - 11-01-2016
What Mudbill said is true - without some indication as to where in the script or your map the problem might be, digging through your entire script file to find the problem is pretty difficult. One thing that I noticed, however, is that you are using a camera texture on one of your terminals. If the camera in question can see the terminal screen, that can cause serious performance issues and potentially even crashes. If that is the case, move the camera or angle the terminal screen so the camera can't see it.
RE: Level issue - i3670 - 11-01-2016
Alright I've trimmed the .hps file for you and no the camera screen and the camera are not duplicated. These are the newest parts of the script a part from the "#include"s.
I'll check if removing the terminals that I've placed but not yet scripted will affect the issue. Edit: didn't work.
Spoiler below!
PHP Code:
#include "interfaces/Map_Interface.hps" #include "base/Inputhandler_Types.hps" #include "helpers/helper_map.hps" #include "helpers/helper_props.hps" #include "helpers/helper_effects.hps" #include "helpers/helper_audio.hps" #include "helpers/helper_imgui.hps" #include "helpers/helper_sequences.hps" #include "helpers/helper_game.hps" #include "helpers/helper_modules.hps" #include "helpers/helper_ai.hps" #include "helpers/helper_player.hps" #include "helper_custom_depth.hps" #include "helper_imgui_station.hps" #include "helper_imgui_station_apps_common.hps" #include "helper_imgui_station_app_error.hps" #include "helper_imgui_station_app_numpad.hps" #include "helper_imgui_station_app_audioplayback.hps" #include "helper_imgui_station_app_mail.hps" //-------------------------------------------------- /*Place any global values here. These must be const variables as they will not be saved*/ /*This is also the place for enums and classes, but these should be avoided whenever possible*/ //-------------------------------------------------- const tString gsDoorCodeNo = "0735" ; enum eHubRoomTerminalState { eHubRoomTerminalState_MainMenu = - 1 , eHubRoomTerminalState_Mail , eHubRoomTerminalState_Power , eHubRoomTerminalState_Staff , eHubRoomTerminalState_LogOut , eHubRoomTerminalState_LogIn_Main , eHubRoomTerminalState_LogIn_Code , } class cScrMap : iScrMap { ///////////////////////////////////////// // ============== // VARIABLE CREATION // ============== //{/////////////////////////////////////// //} END VARIABLE CREATION //-------------------------------------------- ////////////////////////////////////////////////////////////////////////////////////////// // ============== // MAIN CALLBACKS // ============== //{/////////////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------- //////////////////////////// // Set up map environment void Setup () { } //------------------------------------------------------- //////////////////////////// // Run first time starting map void OnStart () { SetupLabCamera (); Map_AddTimer ( "TrainBounce" , 1.0 , "Timer_TrainBounce" ); Map_AddTimer ( "ComputerLoad" , 1.0 , "Timer_ComputerLoad" ); Prop_MoveLinearTo ( "01_05_transporter_passenger_1" , "train_arrived" , 10 , 12 , 4.0f , false ); Light_SetVisible ( "SamsElectrolyte" , false ); ParticleSystem_SetVisible ( "SamElecPS_*" , false ); ParticleSystem_SetVisible ( "panelPS_*" , false ); ParticleSystem_SetVisible ( "wau_panelPS_*" , false ); Light_SetVisible ( "PointLight_156" , false ); Entity_PlayAnimation ( "patchwork" , "lying" , 0.0f , true ); Prop_SetStaticPhysics ( "01_05_transporter_passenger_door*" , true ); Entity_AttachToEntity ( "player" , "01_05_transporter_passenger_1" , "" , false , true ); Sound_CreateAtEntity ( "TrainLoop" , "01_04_transport_station/Special/Train/sequence" , "player" , 0.0f , false , 1.0f ); /////Starting Sequence/////// Player_SetJumpDisabled ( true ); Effect_Fade_Out ( 0.0f ); Effect_Fade_In ( 5.0f ); Sound_FadeGlobalVolume ( 0.0f , 0.0f , eSoundEntryType_WorldAll ); Sound_FadeGlobalVolume ( 1.0f , 5.0f , eSoundEntryType_WorldAll ); /////Starting Sequence End// } //------------------------------------------------------- void stunrod_1_OnPlayerInteract (const tString & in asEntity ) { Sound_CreateAtEntity ( "" , "03_02_omicron_inside/gameplay/battery/battery_pickup" , "player" , 0.0f , false , 1.0f ); } bool OmniTool_OnUse (const tString & in asTool , const tString & in asEntity ) { if ( asEntity == "FirstSeal" ) { CathTool_UseOnPanel ( "Omnitool" , "FirstSeal" ); return true ; } return false ; } void FirstSeal_OnConnectionStateChange (const tString & in asEntity , int alState ) { Map_AddTimer ( "DockDoorButton_Interact" , 2.0f , "DockDoorButton_Interact" ); } void DockDoorButton_Interact (const tString & in asTimer ) { SlideDoor_SetClosed ( "FirstSealedDoor" , false ); Entity_SetActive ( "ToolArea_1" , false ); } //////////////////////////// // Run when entering map void OnEnter () { ImGui_PreloadImage ( "inv_omnitool.tga" ); ImGui_PreloadImage ( "graphics/imgui/station/filetreeicons/file_icon.tga" ); ImGui_PreloadImage ( "graphics/imgui/station/thirdparty/pda/pda_background.tga" ); } //------------------------------------------------------- //////////////////////////// // Run when leaving map void OnLeave () { } //------------------------------------------------------- //////////////////////////// // The player has died. void OnPlayerKilled ( int alRecentDeaths , const tString & in asSource ) { } //------------------------------------------------------- //////////////////////////// // To get when player makes input (mostly used for debug) void OnAction ( int alAction , bool abPressed ) { if( abPressed == false ) return; if( alAction == eAction_Test1 ) { } } //------------------------------------------------------- //////////////////////////// // This only used for pure debug purposes when info needs to printed. float DrawDebugOutput ( cGuiSet @ apSet , iFontData @ apFont , float afY ) { //afY = cLux_DrawDebugText("My Debug value:"+..., afY); return afY ; } //------------------------------------------------------- void OnGui ( float afTimeStep ) { } //------------------------------------------------------- //} END MAIN CALLBACKS ////////////////////////////////////////////////////////////////////////////////////////// // ============== // MAIN FUNCTIONS // ============== //{/////////////////////////////////////////////////////////////////////////////////////// //------------------------------------------------------- /*Put any variables that are used in more than one scene here.*/ //------------------------------------------------------- /*Put any functions that are used in more than one scene here.*/ bool CollideAutoDoorOpen (const tString & in asParent , const tString & in asChild , int alState ) { if ( alState == 1 ){ SlideDoor_SetClosed ( "slidedoor_lab_glass_right_2" , false , false ); SlideDoor_SetClosed ( "slidedoor_lab_glass_left_2" , false , false ); } if ( alState == - 1 ){ SlideDoor_SetClosed ( "slidedoor_lab_glass_right_2" , true , false ); SlideDoor_SetClosed ( "slidedoor_lab_glass_left_2" , true , false ); } return true ; } bool TriggerScreamFlicker (const tString & in asParent , const tString & in asChild , int alState ) { Entity_SetActive ( "AreaTriggerScreamFlicker" , false ); Entity_SetActive ( "DistortionArea_6" , true ); Map_AddTimer ( "Timer_Start" , 0.5f , "TimerFlickerStart" ); Map_AddTimer ( "Timer_Break" , 2.75f , "TimerFlickerStart" ); Map_AddTimer ( "Timer_Stop" , 3.5f , "TimerFlickerStart" ); Sound_CreateAtEntity ( "" , "NPC_Creatures/Vocalisations/InWorld/Flesher/ladder_scream" , "slidedoor_theta_small_12" , 0.0f , false , 2.0f ); return true ; } void TimerFlickerStart (const tString & in asTimer ) { if( asTimer == "Timer_Start" ){ Lamp_SetFlickerActive ( "living_quarters_fluo_*" , true ); } if( asTimer == "Timer_Break" ){ Lamp_SetFlickerActive ( "living_quarters_fluo_1" , false ); Lamp_SetLit ( "living_quarters_fluo_1" , false , false ); Lamp_SetFlickerActive ( "living_quarters_fluo_3" , false ); Lamp_SetLit ( "living_quarters_fluo_3" , false , false ); ParticleSystem_CreateAtEntity ( "" , "elec_spark_physics_few_oneshot.ps" , "Elec_Area_1" , false ); ParticleSystem_CreateAtEntity ( "" , "elec_spark_physics_few_oneshot.ps" , "Elec_Area_2" , false ); } if( asTimer == "Timer_Stop" ){ Lamp_SetFlickerActive ( "living_quarters_fluo_*" , false ); Entity_SetActive ( "DistortionArea_6" , false ); } } void SwitchedOnLights (const tString & in asEntity , int alState ) { if ( alState == 1 ){ Sound_Play ( "SoundScream" , 0.1 ); Sound_CreateAtEntity ( "Startup" , "01_02_upsilon_inside_02/sfx/carl_torture_event/electricity_start" , "ElecSoundArea" , 0.0f , false , 1.0f ); Sound_CreateAtEntity ( "Loop" , "01_02_upsilon_inside_02/sfx/carl_torture_event/electricity_loop" , "ElecSoundArea" , 2.0f , false , 1.0f ); Sound_CreateAtEntity ( "CooldownLoop" , "01_02_upsilon_inside_02/sfx/carl_torture_event/cooldown_loop" , "ElecSoundArea" , 2.0f , false , 1.0f ); ParticleSystem_CreateAtEntity ( "OldSparky" , "elec_spark_large_continuous.ps" , "SamExecutionElec_*" , false ); ParticleSystem_SetVisible ( "SamElecPS_*" , true ); Entity_SetActive ( "DistortionArea_7" , true ); Map_AddTimer ( "TimerScreamSam" , .75f , "TimerSoundLoop" ); Light_SetVisible ( "SamsElectrolyte" , true ); } if ( alState == - 1 ){ ParticleSystem_Destroy ( "OldSparky" ); Map_RemoveTimer ( "TimerScreamSam" ); Lamp_SetFlickerActive ( "living_quarters_fluo_*" , false ); ParticleSystem_SetVisible ( "SamElecPS_*" , false ); Entity_SetActive ( "DistortionArea_7" , false ); Entity_SetActive ( "ark_crew_04_1" , false ); Entity_SetActive ( "ark_crew_04_2" , true ); Sound_Stop ( "Startup" , 1.0f ); Sound_Stop ( "Loop" , 1.0f ); Light_SetVisible ( "SamsElectrolyte" , false ); Button_SetLocked ( "theta_panel_lightswitch_attachment_3" , false , true ); Sound_CreateAtEntity ( "sparkssy" , "level_amb_shared_interior/amb/spot/sparks/spark_train_crash" , "theta_panel_lightswitch_attachment_3" , 0.0f , false , 1.0f ); ParticleSystem_SetVisible ( "panelPS_*" , true ); } } void TimerSoundLoop (const tString & in asTimer ) { if( asTimer == "TimerScreamSam" ){ Lamp_SetFlickerActive ( "living_quarters_fluo_*" , true ); Sound_Play ( "SoundScream" , 0.1 ); Map_AddTimer ( "TimerScreamSam" , .75f , "TimerSoundLoop" ); } } void InteractPartialDoorButton (const tString & in asEntity ) { Light_SetVisible ( "PointLight_156" , true ); ParticleSystem_SetVisible ( "wau_panelPS_*" , false ); Button_SetLocked ( "theta_panel_26" , false , true ); Entity_SetInteractionDisabled ( "theta_panel_26" , true ); Player_GiveDamage ( 0.1f , 0.1 , eDamageType_Electricity , "" ); } //------------------------------------------------------- //} END MAIN FUNCTIONS ////////////////////////////////////////////////////////////////////////////////////////// // ============== // SCENE X *NAME OF SCENE* // ============== //{////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////// // General //{////////////////////////////////////// //------------------------------------------------------- /*Put any variables that are used by many events in Scene X here.*/ //------------------------------------------------------- /*Put any functions that are used in more than one event in Scene X here.*/ //------------------------------------------------------- //} END General ///////////////////////////////////////// // Event *Name Of Event* //{////////////////////////////////////// //------------------------------------------------------- /*Put any variables that are only used in Scene X, Event X here.*/ //------------------------------------------------------- /*Put any functionsthat are only used in Scene X, Event X here.*/ //------------------------------------------------------- //} END Event *Name Of Event* //} END SCENE X ///////////////////////////////////////// // ============== // TERMINALS // ============== //{////////////////////////////////////// //------------------------------------------------------- ///////////////////////////////////////// // Terminal *Name Of Terminal* //{////////////////////////////////////// //------------------------------------------------------- /*Put any variables that are only used Terminal here.*/ bool mbButtonPressed ; //------------------------------------------------------- /*Put any functions that are only used Terminal here.*/ void Timer_ComputerLoad (const tString & in asTimer ) { //////////////////////// // This timer should repeat! Map_AddTimer ( "ComputerLoadStop" , cMath_RandRectf ( 3.0 , 6.0 ), "Timer_ComputerLoad" ); Sound_CreateAtEntity ( "CLoad" , "level_amb_shared_machines/tech/HDD/underload_loop" , "ComputerEntrance" , 0.5f , true , 0.8f ); if( asTimer == "ComputerLoadStop" ){ Sound_Stop ( "CLoad" , 0.2f ); Map_AddTimer ( "ComputerLoad" , cMath_RandRectf ( 10.0 , 18.0 ), "Timer_ComputerLoad" ); } } void TerminalEntrance_EnterGui (const tString & in asEntityName ) { } void TerminalEntrance_LeaveGui (const tString & in asEntityName ) { } void SetupLabCamera () { Gui_CreateCameraTexture ( "LabCamera" , cVector2l ( 768 , 613 ), 30 , 90.0f , 0.1 , 60 ); Gui_AttachCameraTextureToEntity ( "LabCamera" , "CameraLabArea" ); } /////////ResearchTerminals Begin\\\\\\\\\\\\ void ResearchTerminalOneOnGui (const tString & in asEntityName , float afTimeStep ) { cImGuiGfx gfx ( "LabCamera" , eImGuiGfx_Special ); ImGui_DrawGfx ( gfx , cVector3f ( 0 , 0 , 5.0f ), ImGui_GetSize (), cColor ( 1 , 1 )); } void ResearchTerminalTwoOnGui (const tString & in asEntityName , float afTimeStep ) { } void ResearchTerminalThreeOnGui (const tString & in asEntityName , float afTimeStep ) { } void ResearchTerminalFourOnGui (const tString & in asEntityName , float afTimeStep ) { } //------------------------------------------------------- //} END Terminal *Name Of Terminal* //} END TERMINALS }
RE: Level issue - Draugemalf - 11-02-2016
I had a similar issue when working on one of my mods. Check physics debug and see if you accidentally placed physics objects inside static stuff without checking the static physics button first (it was some oceanbottom rocks for me). That usually kills the framerate for some areas of the map.
RE: Level issue - i3670 - 11-02-2016
I've never done a physics debug, can you explain further?
RE: Level issue - Draugemalf - 11-02-2016
It should be somewhere on the somadev menu. Like show physics info or something similar. That might help you identify the problem if it's caused by that.
RE: Level issue - Abion47 - 11-03-2016
You still haven't given any indication as to when in the script the problem could possibly be. For example, if it happens around the time that "CollideAutoDoorOpen" gets triggered, or when the timer "TimerFlickerStart" is initiated. Without that kind of information, all we can do is blindly guess at the hundred things it might be.
That being said, unless the problem is coming from a custom particle system that creates a ton of particles with unlimited life (and assuming you've made sure the problem I mentioned in my last reply isn't the cause), nothing in the script jumps out to me as being obviously error-prone, so I'm inclined to say that the problem is more likely to be map-related.
RE: Level issue - i3670 - 11-03-2016
I found it. It's this little piece of code which just adds sound after sound until it can't even count them.
PHP Code:
void Timer_ComputerLoad (const tString & in asTimer ) { //////////////////////// // This timer should repeat! Map_AddTimer ( "ComputerLoadStop" , cMath_RandRectf ( 3.0 , 6.0 ), "Timer_ComputerLoad" ); Sound_CreateAtEntity ( "CLoad" , "level_amb_shared_machines/tech/HDD/underload_loop" , "ComputerEntrance" , 0.5f , true , 0.8f ); if( asTimer == "ComputerLoadStop" ){ Sound_Stop ( "CLoad" , 0.2f ); Map_AddTimer ( "ComputerLoad" , cMath_RandRectf ( 10.0 , 18.0 ), "Timer_ComputerLoad" ); } }