Anonymous Login
2021-12-08 14:06 UTC

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001379OpenClonkEnginepublic2019-05-07 16:04
Assigned To 
PlatformGNU G++OSLinuxOS Version 
Product Version 
Target Version8.1Fixed in Version 
Summary0001379: Loading Sections has issues
DescriptionI tried to reimplement quick saving/loading as in the old Harkon game. It worked by switching to another section and saving the section Landscape/Objects/Effects. I attached a Test Szenario. When I call my function SaveGame() the game either crashes or shows a transparent landscape (I tried with different game versions) and the objects are also resetted and not saved, so I think there is something broken with section saving.
TagsNo tags attached.
Attached Files




Caesar (developer)

Last edited: 2015-09-12 03:34

View 2 revisions

For me it crashes on non-high-res landscape with

#0 C4Pattern::PatternClr (this=0xac0, iX=iX@entry=0, iY=iY@entry=399) at ../src/graphics/C4Draw.cpp:167
#1 0x00000000006c6cc8 in C4LandscapeRenderClassic::Update (this=0x754bf20, To=..., pSource=0xc2b680 <Landscape>) at ../src/landscape/C4LandscapeRenderClassic.cpp:117
#2 0x00000000006c4071 in C4Landscape::Init (this=0xc2b680 <Landscape>, hGroup=..., fOverloadCurrent=fOverloadCurrent@entry=true, fLoadSky=fLoadSky@entry=false, rfLoaded=@0x7ffffffcd92f: true, rfLoaded@entry=@0x7ffffffcd92f: false,
    fSavegame=<optimized out>) at ../src/landscape/C4Landscape.cpp:1526
0000003 0x00000000005c47d2 in C4Game::InitGame (this=this@entry=0xbc4ec0 <Game>, hGroup=..., fLoadSection=fLoadSection@entry=true, fLoadSky=fLoadSky@entry=false, numbers=numbers@entry=0x7ffffffcda30) at ../src/game/C4Game.cpp:2226
#4 0x00000000005c534a in C4Game::LoadScenarioSection (this=0xbc4ec0 <Game>, szSection=<optimized out>, dwFlags=<optimized out>) at ../src/game/C4Game.cpp:3523
0000005 0x00000000005e4536 in FnLoadScenarioSection (_this=<optimized out>, pstrSection=<optimized out>, dwFlags=<optimized out>) at ../src/gamescript/C4GameScript.cpp:2160
0000006 0x00000000005f1d74 in C4AulDefFunc2<long, C4String*, long>::Exec (this=<optimized out>, _this=<optimized out>, pPars=<optimized out>, fPassErrors=<optimized out>) at ../src/script/C4AulDefFunc.h:324
0000007 0x0000000000826782 in C4AulExec::Call (this=this@entry=0xc54100 <AulExec>, pFunc=pFunc@entry=0x2257c90, pReturn=0xc5b268 <AulExec+29032>, pPars=0xc5b268 <AulExec+29032>, pContext=0xc73f70, pContext@entry=0x0)
    at ../src/script/C4AulExec.cpp:891
0000008 0x0000000000828d53 in C4AulExec::Exec (this=this@entry=0xc54100 <AulExec>, pCPos=0x7443740, fPassErrors=fPassErrors@entry=true) at ../src/script/C4AulExec.cpp:673
0000009 0x000000000082dabd in C4AulExec::Exec (this=this@entry=0xc54100 <AulExec>, pSFunc=<optimized out>, p=0xc73f70, pnPars=<optimized out>, fPassErrors=<optimized out>) at ../src/script/C4AulExec.cpp:166
#10 0x000000000082ddab in C4AulScriptFunc::Exec (this=<optimized out>, p=<optimized out>, pPars=<optimized out>, fPassErrors=<optimized out>) at ../src/script/C4AulExec.cpp:1030
0000011 0x000000000084722c in C4AulFunc::Exec (fPassErrors=true, pPars=0x7fffffffc7d0, p=0xc73f70, this=0x6a237b0) at ../src/script/C4AulFunc.h:82
#12 FnCall (_this=0xc73f70, Pars=0xc5b178 <AulExec+28792>) at ../src/script/C4Script.cpp:353
0000013 0x00000000008400f7 in C4AulDefFunc::Exec (this=<optimized out>, p=<optimized out>, pPars=<optimized out>, fPassErrors=<optimized out>) at ../src/script/C4Script.cpp:151
0000014 0x0000000000826782 in C4AulExec::Call (this=this@entry=0xc54100 <AulExec>, pFunc=pFunc@entry=0x1b0da80, pReturn=0xc5b178 <AulExec+28792>, pPars=0xc5b178 <AulExec+28792>, pContext=pContext@entry=0x0) at ../src/script/C4AulExec.cpp:891
0000015 0x0000000000828d53 in C4AulExec::Exec (this=this@entry=0xc54100 <AulExec>, pCPos=0x6b495e0, fPassErrors=fPassErrors@entry=false) at ../src/script/C4AulExec.cpp:673
0000016 0x000000000082dabd in C4AulExec::Exec (this=this@entry=0xc54100 <AulExec>, pSFunc=<optimized out>, p=0x0, pnPars=<optimized out>, fPassErrors=<optimized out>) at ../src/script/C4AulExec.cpp:166
0000017 0x000000000082ddab in C4AulScriptFunc::Exec (this=<optimized out>, p=<optimized out>, pPars=<optimized out>, fPassErrors=<optimized out>) at ../src/script/C4AulExec.cpp:1030
0000018 0x00000000005d55b1 in C4AulFunc::Exec (fPassErrors=false, pPars=0x7fffffffd370, p=<optimized out>, this=<optimized out>) at ../src/script/C4AulFunc.h:82
0000019 C4Effect::Execute (this=<optimized out>, pObj=pObj@entry=0x0) at ../src/gamescript/C4Effect.cpp:303
0000020 0x00000000005c2214 in C4Game::Execute (this=0xbc4ec0 <Game>) at ../src/game/C4Game.cpp:730
0000021 0x00000000005b2912 in C4Application::GameTick (this=0xc00880 <Application>) at ../src/game/C4Application.cpp:707
0000022 0x00000000005b2ae7 in C4ApplicationGameTimer::Execute (this=0x11d1b30, iTimeout=<optimized out>) at ../src/game/C4Application.cpp:903
0000023 0x000000000087cb27 in StdScheduler::DoScheduleProcs (this=0xc00880 <Application>, iTimeout=27) at ../src/platform/StdSchedulerPoll.cpp:175
0000024 0x000000000087b8e8 in StdScheduler::ScheduleProcs (this=this@entry=0xc00880 <Application>, iTimeout=iTimeout@entry=27) at ../src/platform/StdScheduler.cpp:153
#25 0x000000000080199d in C4AbstractApp::Run (this=0xc00880 <Application>) at ../src/platform/C4App.cpp:25
0000026 0x0000000000531e9f in main (argc=2, argv=0x7fffffffd8b8) at ../src/game/ClonkMain.cpp:237

and gives an empty landscape with high-res.

Let's see if I can do something about this.

Edit: Crash happens during second LoadScenarioSection()


Caesar (developer)

I think I fixed the issue with the landscape drawing. Would you mind CC-ing your TestSave.ocs, so I can commit a minimized version as a testcase? (I.e. like done in the forums )


Randrian (developer)

I hereby license the attached file TestSave.ocs under the CC-BY license.

Fell free to commit it. Thank you for fixing the bug.


Caesar (developer)

Heh. I thought I fixed it with
Further testing revealed that it was only a symptomatic fix.


Sven2 (developer)

I've fixed a bug in landscape reinitialization (pushed to repos). Haven't looked at the objects yet.


Caesar (developer)

Last edited: 2015-09-15 15:00

View 2 revisions

Sven: Heh, you got the same patch as I just made on my flight… (Minus two asserts.)
There is something else though: Sky doesn't get handled properly. I think ck borked that with in C4Sky::Init, because the resulting calls through C4Shader::Create don't go through.


Sven2 (developer)

We should probably split C4Sky initialization and deinitialization to not re-init shaders on section change.


Clonk-Karl (administrator)

The sky shaders have to be re-initialized if the sky changes from fade-sky to bitmap-sky or vice versa. Alternatively, both shaders could be kept around all the time, but given that section change is not very frequent I'd prefer to just re-init the shaders.


Randrian (developer)

Is someone still working on this? I still need this feature for Harkon.


Clonkonaut (developer)

Reminder sent to: Sven2

Sven2 said he might fix this before the release.


Sven2 (developer)

I tested again and couldn't see any problems in the test scenario.

The clonk is not reset because it's in the deactivated list. So it looks like that is intended. Landscape and other objects are saved and loaded.

I would also recommend either carrying over the GUI or deleting and reinitializing it.


Foaly (developer)

I can reproduce the crash on git master.
I also have a small fix for it, but objects are still not saved.

About the crash:
It seems that in C4Landscape.cpp:Init, in line 1582 the landscape is cleared, but in InitBorderPix it is assumed that p->Map is non-null.
I fixed that by scaling Surface8 down and putting it in Map.

-Issue History
Date Modified Username Field Change
2015-09-04 23:02 Randrian New Issue
2015-09-04 23:02 Randrian File Added:
2015-09-12 02:50 Caesar Note Added: 0003795
2015-09-12 03:34 Caesar Note Edited: 0003795 View Revisions
2015-09-12 05:24 Caesar Note Added: 0003796
2015-09-12 06:41 Randrian Note Added: 0003797
2015-09-12 06:48 Caesar Note Added: 0003798
2015-09-15 03:48 Sven2 Assigned To => Sven2
2015-09-15 03:48 Sven2 Status new => assigned
2015-09-15 04:16 Sven2 Note Added: 0003802
2015-09-15 14:58 Caesar Note Added: 0003803
2015-09-15 15:00 Caesar Note Edited: 0003803 View Revisions
2015-09-15 15:43 Sven2 Note Added: 0003804
2015-09-15 17:15 Clonk-Karl Note Added: 0003805
2015-10-16 00:33 Sven2 Target Version => 7.0
2016-01-02 10:33 Randrian Note Added: 0004436
2016-01-02 11:58 Clonkonaut Note Added: 0004437
2016-01-08 03:27 Sven2 Assigned To Sven2 => Randrian
2016-01-08 03:29 Sven2 Note Added: 0004493
2016-01-08 03:29 Sven2 Status assigned => feedback
2016-01-09 20:16 Sven2 Target Version 7.0 => 7.1 (Bugfix update)
2017-08-05 09:06 Maikel Target Version 7.1 (Bugfix update) => 8.0
2017-08-20 11:43 Zapper Assigned To Randrian =>
2017-08-20 11:43 Zapper Target Version 8.0 => 8.1
2019-05-07 16:04 Foaly Note Added: 0006260
+Issue History