map editor season cycle

ImageImageTalking about Modding for EE2 and EE2 AOS. New maps, patches, programs and Multiplayer scenarios.
User avatar
Dr.MonaLisa
High Representative
Posts: 7916
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: map editor season cycle

Post by Dr.MonaLisa »

No they didn't use .IES. Scenarios are stored in game folders as .dll files (whatever they used).
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains

Sat42
Posts: 100
Joined: 03 Dec 2018, 18:01

Re: map editor season cycle

Post by Sat42 »

Ah right, thanks for reminding me.
I suppose it is basically impossible to retrieve info from those .dll files ?
User avatar
Dr.MonaLisa
High Representative
Posts: 7916
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: map editor season cycle

Post by Dr.MonaLisa »

Yes, impossible.
We could try with the cycle time of day, but it's complicated procedure, and I would need to search a lot.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Sat42
Posts: 100
Joined: 03 Dec 2018, 18:01

Re: map editor season cycle

Post by Sat42 »

Dr.MonaLisa wrote: 19 Nov 2020, 13:48 Yes, impossible.
We could try with the cycle time of day, but it's complicated procedure, and I would need to search a lot.
I hear ya, but I will love you forever if you manage to make cycle time of day available for scenario making! :D Will be patient!
User avatar
Dr.MonaLisa
High Representative
Posts: 7916
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: map editor season cycle

Post by Dr.MonaLisa »

Sorry, it's impossible without heavier debugging.

For EE2 I made it this way:

Code: Select all

Game time location: 0C9C3E4

Constant where game pointer it's stored at: 0CF8568

Writable5 (clicked change settings -2nd): 00FA6B62

Float(2) - 1: 00FA6B6A
Float(5) - 1: 00FA6B6E
Float(10) - 1: 00FA6B72
Float(15) -2: 00FA6B76

Float1 (+5 floats): 00FA6B7E (before 00FA6839)
Float2 (+2nd float): 00FA6B82
Writable1 (+4th floats): 00FA6B8A - last time (before 00FA6851)
Writable2 (+4th floats): 00FA6B92 - temp for esp (before 00FA6861)
Writable3: (2nd floats): 00FA6B9A - decides if day changing is active
Writable4: (2nd floats): 00FA6BA0 - store previous game time

New function (+ 10th floats): 00FA6BAE
	JMP @L00000012
	JMP @L00000112
	;aos loading fix not used in EE2:
	;JMP @L00001112
	@L00000050:
	;HotFix for clearing playback crownstatus:
	CMP DWORD PTR DS:[0FA6478],1
	JNE @L00000550
	MOV DWORD PTR DS:[0FA6478],0
	@L00000550:
	;its 00FA6BB3
	PUSHAD
	PUSHFD
	MOV DWORD PTR DS:[00FA6B92],ESP
	
	;New function to check if game changed (@ThisCycleTimeAddress)
	MOV ECX,DWORD PTR DS:[0CF8568]
	CMP DWORD PTR DS:[@ThisCycleTimeAddress],ECX
	JE @AfterNewFunction
	;not same, overwrite and set day variable:
	MOV DWORD PTR DS:[@ThisCycleTimeAddress],ECX
	MOV ECX,DWORD PTR DS:[ECX+1C]
	MOV DWORD PTR DS:[@ThisCycleTimeValue],ECX
	;NEW. Game changes so show welcome message:
	CALL 00FA7663
	
	;End of new function
	@AfterNewFunction:
	
	;MOV ECX,DWORD PTR DS:[EDI+1C]
	
	;disabling those 2 in new update:
	;MOV ECX,DWORD PTR DS:[0CF8568]
	;MOV ECX,DWORD PTR DS:[ECX+1C]
	
	;new check in new update:
	MOV ECX,DWORD PTR DS:[@ThisCycleTimeValue]
	
	CMP ECX,4
	JGE @L00000051
	CMP DWORD PTR DS:[00FA6B9A],0
	JE @L00000099
	
	FLD DWORD PTR DS:[0C9C3E4]
	FCOMP DWORD PTR DS:[00FA6B8A]
	FSTSW AX
	SAHF
	JA @L00000001
	;Compare last saved time with now to check if new game with new settings started.
	FLD DWORD PTR DS:[00FA6BA0]
	;FLD1
	;FADDP
	FCOMP DWORD PTR DS:[0C9C3E4]
	FSTSW AX
	SAHF
	JBE @L00000003
	FLDZ
	FSTP DWORD PTR DS:[00FA6B8A]
	;Disable dynamic time in case option changed in next game:
	MOV DWORD PTR DS:[00FA6B9A],0
	JMP @L00000099
	@L00000003:
	JMP @L00000099
	
	@L00000001:
	;Store new next time
	FLD DWORD PTR DS:[0C9C3E4]
	FLD DWORD PTR DS:[00FA6B7E]
	FADDP
	FSTP DWORD PTR DS:[00FA6B8A]
	
	;Save current game time to writable4:
	FLD DWORD PTR DS:[0C9C3E4]
	FSTP DWORD PTR DS:[00FA6BA0]

	@L00000005:
	;Things to change season
	
	;disabling in new update, or not
	MOV EAX,DWORD PTR DS:[0CF8568]
	
	CMP ECX,0
	JE @L00000081
	CMP ECX,1
	JE @L00000082
	CMP ECX,2
	JE @L00000083
	CMP ECX,3
	JE @L00000084
	
	@L00000081:
	
	;MOV DWORD PTR DS:[EAX+1C],1
	MOV ECX,DWORD PTR DS:[EAX+1C]
	MOV DWORD PTR DS:[@ThisCycleTimeTemp],ECX
	MOV DWORD PTR DS:[@ThisCycleTimeValue],1
	MOV DWORD PTR DS:[EAX+1C],1
	PUSH -1
	PUSH @str2
	CALL 00A1D9C0
	PUSH EAX
	CALL 007A26A0
	JMP @L00000090
	
	@L00000082:
	;MOV DWORD PTR DS:[EAX+1C],2
	MOV ECX,DWORD PTR DS:[EAX+1C]
	MOV DWORD PTR DS:[@ThisCycleTimeTemp],ECX
	MOV DWORD PTR DS:[@ThisCycleTimeValue],2
	MOV DWORD PTR DS:[EAX+1C],2
	PUSH -1
	PUSH @str3
	CALL 00A1D9C0
	PUSH EAX
	CALL 007A26A0
	JMP @L00000090
	
	@L00000083:
	;MOV DWORD PTR DS:[EAX+1C],3
	MOV ECX,DWORD PTR DS:[EAX+1C]
	MOV DWORD PTR DS:[@ThisCycleTimeTemp],ECX
	MOV DWORD PTR DS:[@ThisCycleTimeValue],3
	MOV DWORD PTR DS:[EAX+1C],3
	PUSH -1
	PUSH @str4
	CALL 00A1D9C0
	PUSH EAX
	CALL 007A26A0
	JMP @L00000090
	
	@L00000084:
	;MOV DWORD PTR DS:[EAX+1C],0
	MOV ECX,DWORD PTR DS:[EAX+1C]
	MOV DWORD PTR DS:[@ThisCycleTimeTemp],ECX
	MOV DWORD PTR DS:[@ThisCycleTimeValue],0
	MOV DWORD PTR DS:[EAX+1C],0
	PUSH -1
	PUSH @str1
	CALL 00A1D9C0
	PUSH EAX
	CALL 007A26A0
	
	@L00000090:
	;Dont worry, it's constant for EE2 game pointer
	MOV ECX,DWORD PTR DS:[0CF8568]
	CALL 006CAF70
	
	;new:
	MOV ECX,DWORD PTR DS:[@ThisCycleTimeTemp]
	MOV EAX,DWORD PTR DS:[0CF8568]
	MOV DWORD PTR DS:[EAX+1C],ECX
	
	;check if clicked "change settings". We are skipping it now, because of bugs when loading saves
	JMP @L00006969
	CMP DWORD PTR DS:[00FA6B62],1
	JNE @L00000099
	
	;call save settings function
	@L00006969:
	MOV EAX,DWORD PTR DS:[0D02200]
	MOV ECX,DWORD PTR DS:[EAX+4]
	CALL 0087D7C0
	
	;check if afternoon, so no more fixes needed
	;MOV ECX,DWORD PTR DS:[0CF8568]
	;MOV ECX,DWORD PTR DS:[ECX+1C]
	MOV ECX,DWORD PTR DS:[@ThisCycleTimeValue]
	
	CMP ECX,1
	JNE @L00000099
	MOV DWORD PTR DS:[00FA6B62],0
	
	
	@L00000099:
	;Jump back to the right place
	MOV ESP,DWORD PTR DS:[00FA6B92]
	POPFD
	POPAD
	@L00000098:
	MOV AL,BYTE PTR DS:[0D0DFC0]
	JMP 0059A3E8
	
	@L00000051:
	;Set floats and stuff depending on selected time of day
	
	CMP ECX,4
	JE @L00000041
	CMP ECX,5
	JE @L00000042
	CMP ECX,6
	JE @L00000043
	CMP ECX,7
	JE @L00000044
	
	@L00000041:
	;2 min
	FLD DWORD PTR DS:[00FA6B6A]
	FSTP DWORD PTR DS:[00FA6B7E]
	
	JMP @L00000030
	@L00000042:
	;5 min
	FLD DWORD PTR DS:[00FA6B6E]
	FSTP DWORD PTR DS:[00FA6B7E]
	
	JMP @L00000030
	@L00000043:
	;10 min
	FLD DWORD PTR DS:[00FA6B72]
	FSTP DWORD PTR DS:[00FA6B7E]
	
	JMP @L00000030
	@L00000044:
	;15 min
	FLD DWORD PTR DS:[00FA6B76]
	FSTP DWORD PTR DS:[00FA6B7E]
	
	
	@L00000030:
	;reset save settings variable:
	MOV DWORD PTR DS:[00FA6B62],0
	
	;dynamic time active
	MOV DWORD PTR DS:[00FA6B9A],1
	;setting night cus will change to morning:
	;MOV EAX,DWORD PTR DS:[0CF8568]
	;MOV DWORD PTR DS:[EAX+1C],3
	MOV DWORD PTR DS:[@ThisCycleTimeValue],3
	;reset timer:
	FLDZ
	FSTP DWORD PTR DS:[00FA6B8A]
	JMP @L00000099
	

;set settings changed 1
@L00000112:
MOV DWORD PTR DS:[00FA6B62],1
MOV ECX,DWORD PTR DS:[0D235B4]
JMP 0087D8E4
	
@L00000012:
JL @L00000013
CMP EAX,17
JE @L00000014

;compare in this strange way with texts:
PUSHAD
PUSHFD
MOV DWORD PTR DS:[00FA6B92],ESP
MOV ECX,DWORD PTR DS:[EAX]
MOV EDX,DWORD PTR DS:[@str5]
CMP ECX,EDX
JE @L00000221
MOV EDX,DWORD PTR DS:[@str6]
CMP ECX,EDX
JE @L00000222
MOV EDX,DWORD PTR DS:[@str7]
CMP ECX,EDX
JE @L00000223
MOV EDX,DWORD PTR DS:[@str8]
CMP ECX,EDX
JE @L00000224
JMP @L00000225

@L00000221:
MOV DWORD PTR DS:[@AosTempFix],4
JMP @L00000226
@L00000222:
MOV DWORD PTR DS:[@AosTempFix],5
JMP @L00000226
@L00000223:
MOV DWORD PTR DS:[@AosTempFix],6
JMP @L00000226
@L00000224:
MOV DWORD PTR DS:[@AosTempFix],7
JMP @L00000226

@L00000225:
MOV DWORD PTR DS:[@AosTempFix],5
@L00000226:
MOV ESP,DWORD PTR DS:[00FA6B92]
POPFD
POPAD
MOV EAX,DWORD PTR DS:[@AosTempFix]
;MOV EAX,5
JMP @L00000015
@L00000014:
MOV EAX,3
JMP @L00000015
@L00000013:
MOV EAX,2
@L00000015:
JMP 0088544B

ADD BYTE PTR DS:[EAX],AL
ADD BYTE PTR DS:[EAX],AL
@str1:
"tx_changing_to_dawn\0"
@str2:
"tx_changing_to_afternoon\0"
@str3:
"tx_changing_to_sunset\0"
@str4:
"tx_changing_to_night\0"

;2 mins:
@str5:
"LargeIslands\0"
;5 mins:
@str6:
"SmallIslands\0"
;10 mins:
@str7:
"Pangea\0"
;15 mins:
@str8:
"Plains\0"

@ThisCycleTimeAddress:
"\0\0\0\0\0\0\0\0"

@ThisCycleTimeValue:
"\0\0\0\0\0\0\0\0"


@ThisCycleTimeTemp:
"\0\0\0\0\0\0\0\0"


ADD BYTE PTR DS:[EAX],AL
@AosTempFix:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
I suppose it checks for the time of day ID here:

Code: Select all

MOV ECX,DWORD PTR DS:[0CF8568]
[...]
MOV ECX,DWORD PTR DS:[ECX+1C]

You can enable Cycle Time of Day by editing RAM of game process with HXD, then setting address 00FA6B9A to 01 (from 00). But it doesn't know how fast to change, and it cycles every 10 seconds.

90% of players dislike Cycle time of day, make sure that you really want to have it used in your scenario.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Sat42
Posts: 100
Joined: 03 Dec 2018, 18:01

Re: map editor season cycle

Post by Sat42 »

Dr.MonaLisa wrote: 19 Nov 2020, 18:27 Sorry, it's impossible without heavier debugging.

For EE2 I made it this way:
[...]

90% of players dislike Cycle time of day, make sure that you really want to have it used in your scenario.
Holy crap, thanks for sharing, it's just a bit above my head!

Yes I know why cycle time of day is rather imperfect (no smooth progression). To be honest, the best would still be the option to simply select the time of day, if not across a fine spectrum of values (as that SetCurrentTimeOfDay() would suggest), then at least between the 4 "morning", "afternoon", "evening" and "night" times.

You say it may check for the time of day ID here:

Code: Select all

MOV ECX,DWORD PTR DS:[0CF8568]
[...]
MOV ECX,DWORD PTR DS:[ECX+1C]
May I suggest that you look (not saying immediately!) into adapting the cycle time of day code so that instead of cycling, we can actually set the time of day to one of four values :) I would have thought having a scenario fixed to a particular time (from a choice of 4 times) would be easier to implement than having it cycling through times!

As always, thank you for your time.
User avatar
Dr.MonaLisa
High Representative
Posts: 7916
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: map editor season cycle

Post by Dr.MonaLisa »

Theoretically you can do this. You can set other time of day values there (0 to 3 I think). But getting pointer from 0CF8568, then finding +1C offset isn't something that can be done easily or instantly :/
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Sat42
Posts: 100
Joined: 03 Dec 2018, 18:01

Re: map editor season cycle

Post by Sat42 »

Dr.MonaLisa wrote: 19 Nov 2020, 19:16 Theoretically you can do this. You can set other time of day values there (0 to 3 I think). But getting pointer from 0CF8568, then finding +1C offset isn't something that can be done easily or instantly :/
Good to know it is within the realm of the possible! I half understand the technical hurdle, but I appreciate it isn't easy :)

If you can look into this at some point that's awesome - I don't understand the technical side enough to do it myself.
User avatar
Dr.MonaLisa
High Representative
Posts: 7916
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: map editor season cycle

Post by Dr.MonaLisa »

Ok, I think I made something...

You need to use program Cheat Engine: https://www.cheatengine.org/downloads.php

Then download this file:
EE2-EE2X-1.5-HackTimeOfDayScenariosAndSaves.CT
(1.88 KiB) Downloaded 4 times
Double click on downloaded "EE2-EE2X-1.5-HackTimeOfDayScenariosAndSaves.CT" file.

In Cheat Engine window click on "Select a process to open" (magnifier icon), and choose "Empire Earth II" from the list (or "Empire Earth II: The Art of Supremacy"). MAKE SURE IT'S NOT THE LAUNCHER PROCESS, IT SHOULD HAVE A LITTLE "OLDER" ICON.
Click "Yes" when it asks to keep current addresses.

Load your scenario to map editor.

In the list, you will see fields like:
- EE2: Time of Day Pointer
- EE2: Enable Cycle Time of Day
- AOS: Time of Day Pointer
- AOS: Enable Cycle Time of Day

Click on the "Active" box so it becomes a red "X", to enable it.
I made a dropdown list of available time of days in UP1.5, so no need to describe it here. So for EE2 it might look like this:
2020-11-19_20-51-40_Cheat_Engine_7.2.png
2020-11-19_20-51-40_Cheat_Engine_7.2.png (39.68 KiB) Viewed 34 times
Uncheck the "Active" box when you finish setting up, because once the pointer address change, your game might crash! It should have already overwritten RAM values.

Click on "Test Mission" to see.

Once you quit the test mission, it even displays the correct time of day in the editor:
EE2_ScreenShot_2020-11-19_20.53.38.555.jpg
EE2_ScreenShot_2020-11-19_20.53.38.555.jpg (239.44 KiB) Viewed 34 times
I didn't have much time to test, but I hope and believe that it will save the selected time of day in the .scn file.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Sat42
Posts: 100
Joined: 03 Dec 2018, 18:01

Re: map editor season cycle

Post by Sat42 »

OH SWEET thanks so much for trying this out and making that epic post!! I will try it out this evening (after dinner) and will report back as soon as I can!!!

Added after 1 hour 57 minutes 51 seconds:
I am so close dammit, but I haven't gotten the pointer address to change yet!

Sorry for sucking hard at this but:
- I have the test map open in editor (using Dev version of 1.5)
- Cheat Engine open with your file, I see the same list
- I already did the click on the "Active" box so it becomes a red "X", to enable "EE2: Time of Day Pointer"
- I already did the change to the value thanks to drop-down menu, to Dawn in my case
- I waited for the change in pointer address to occur but nothing happens even after several seconds (at first I didn't even wait because you warned of a crash)
- if I test the map, the value just goes back to Afternoon
- I also tried the above with "EE2: Enable Cycle Time of Day" active (but its value still 0), nothing happens

How do I trigger the pointer address change?

It seems like I am missing a step: once you activate the line of interest ("EE2: Time of Day Pointer" in my case), and once you change its value, how do you get the new pointer address? sorry never used Cheat Engine before!

Added after 12 minutes :
OK it's weird it seems the change only happens if, once I set to another time of day, I click "Test Mission" in the editor and in-game my map displays that sweet new time of day, but then I deactivate the box for fear of a crash, and when I leave the mission and go back to editor, the map is back to afternoon

Added after 3 minutes 56 seconds:
OK so if I don't deactivate the box in-game during testing, and go back to editor, then editor displays the right new time of day (dawn for me) and I deactivate the box, save my scenario, leave, reload my scenario and it is back to afternoon :/
I redid the exact same thing directly above but this time only deactivated once I saved the map. Leave editor (not game), reload my scenario and it is back to afternoon :/
I tried saving under a new name - same result, change of time not saved.

Added after 7 minutes 9 seconds:
On the plus side, seems I don't need to untick the "Active" box, no crash so far!

Added after 6 minutes 10 seconds:
Also the pointer address is never the same when it changes and I don't have the knowledge to understand why!

Added after 32 minutes 51 seconds:
Finally, I can confirm that, while I am getting no crashes:
- starting EEII game (with 1.5 Dev version),
- opening EEII process in Cheat Engine (and keeping current addresses),
- opening scenario editor,
- start forcing change of "EE2: Time of Day Pointer" value to something other than default Afternoon,
- creating/generating new map,
- seeing new map with new time of day,
- saving new map as scenario,
- closing editor and shutting down game BEFORE even deactivating the "EE2: Time of Day Pointer" line in Cheat Engine

-> still does not save new time of day values :/
Note: my EEII + AoS installation is on the F drive, not C drive, in case that changes anything...

Added after 1 minute 59 seconds:
But holy molly we're close...

Added after 5 minutes 5 seconds:
As a side note :D
- your sunset looks more like dawn
- your dawn looks more like early evening
Why? shadow orientations, sun rises to the east, goes down to the west :mrgreen:

- smartass mode off
Post Reply

Return to “EE2 files, modding, maps, testing, etc.”