mogaika / god_of_war_browser

https://discord.gg/u6x3Z9v6Ed
47 stars 25 forks source link

Enemy Swap #27

Closed leonifc331 closed 3 years ago

leonifc331 commented 3 years ago

Would it be possible to change the types of enemies for each stage? (ex: placing normal enemies at the beginning of the boat with minotaurs, etc.)

mogaika commented 3 years ago

Hi, @leonifc331

As I remember correctly, enemy spawn controller by entities (ESC_). I do not have proper description of how entities works, but overall types id:

Type 0 - Entry Sensor
Type 1 - Exit Sensor
Type 2 - Creation Sensor
Type 3 - Destruction Sensor
Type 4 - Event Sensor
Type 5 - Animator
Type 6 - Unknown
Type 7 - Vis??
Type 8 - Event Transmitter
Type 9 - Start
Type 10 - Spawner << Creates enemies?
Type 11 - Creator < creates chests
Type 12 - GlobalData
Type 13 - LevelData
Type 14 - Marker
Type 15 - SoundController

Usually, one "Sensor" entity triggers others. Check some sensors (like ESC_PlayerStartZone in ATHN01A.WAD), you will see DependsEntitiesIds = [8,7,9,10,11,13,16,18,21,23,26,28,50,86,87,88,92,99] - that means that PlayerStartZone-nurbsSphere1-EntrySensor1 triggers all this entities (Id in EntityUniqueID) to execute some code (depends on entity type).

Some events id's (you may not need them, but just in case):

EVT_Break = 1009
EVT_Reset_usedWhenRestoreChestAndSoOn = 1015
EVT_FallAnim_or_Die = 1019
EVT_ChestOpened? = 1023
EVT_UseWorld_likeR2 = 1024
EVT_GrabCicle_or_Move = 1035
EVT_?ShowMessage? = 1040
EVT_ExplodeDeath? = 1042
EVT_ReadStart = 1048
EVT_MsgDone = 1049
EVT_Timer = 1050
mogaika commented 3 years ago

Was able to replace minotaurs with archers in athn03a.

What I did is changed ESC_GRPMinoLVL2Room Handler #4 method of all type 10 entities to push_int 31 (used hex editor and searched for previous value and adjacent opcodes). 31 - id for SKA usual AI. You can find AI ids by searching TWK_AI in R_SKA or other monster wads. Also, make sure that you have your monster wad referenced in RSRCS file inside wad. I used ska because it was already referenced in RSRCS.

First I tried to replace skeletons with minotaurs on first boat level, but maybe because of different hitboxes or entity parameters they either didn't spawn or either fall outside immediately. So not every place or monster can be replaced that easy.

image

leonifc331 commented 3 years ago

Was able to replace minotaurs with archers in athn03a.

What I did is changed ESC_GRPMinoLVL2Room Handler #4 method of all type 10 entities to push_int 31 (used hex editor and searched for previous value and adjacent opcodes). 31 - id for SKA usual AI. You can find AI ids by searching TWK_AI in R_SKA or other monster wads. Also, make sure that you have your monster wad referenced in RSRCS file inside wad. I used ska because it was already referenced in RSRCS.

First I tried to replace skeletons with minotaurs on first boat level, but maybe because of different hitboxes or entity parameters they either didn't spawn or either fall outside immediately. So not every place or monster can be replaced that easy.

image

it seems a little complicated, I will study these tips and try, thanks for answering!

leonifc331 commented 3 years ago

I edited the RSRCS file, but even then some enemies don't appear, but it worked with enemies already existing in certain stages as you said. https://youtu.be/QhARr0TQVOo

mogaika commented 3 years ago

Probably TWK_WadInfo_ should be modified as well, it contains virtual vfs values. TWK_ files contain hashes of strings, not strings themselves. Maybe we can copy content from other wads where monsters used and replace wad id only. athn01a TWK_WadInfo_068: https://pastebin.com/raw/uGhPrB07 athn03a TWK_WadInfo_047: https://pastebin.com/raw/mc9rdeHe dest01 TWK_WadInfo_046: https://pastebin.com/raw/gWbX04JZ

I will try to make an editor for TWK data

leonifc331 commented 3 years ago

so with a TWK editor we could certainly swap with chests too? (I replaced TWK_Wadinfo files, and some chests are missing)

mogaika commented 3 years ago

so with a TWK editor we could certainly swap with chests too? (I replaced TWK_Wadinfo files, and some chests are missing)

Chests should be easy, will check. I tried to add SKA to wadinfo, but it didn't help to spawn SKA on levels not having them previously. Cheking further (maybe group should correlate somehow, or ESC_ should have additional parameters)

leonifc331 commented 3 years ago

so with a TWK editor we could certainly swap with chests too? (I replaced TWK_Wadinfo files, and some chests are missing)

Chests should be easy, will check. I tried to add SKA to wadinfo, but it didn't help to spawn SKA on levels not having them previously. Cheking further (maybe group should correlate somehow, or ESC_ should have additional parameters)

It is much more complicated than I thought, but all the details about the TWK Files that you gave me are being very useful, thank you very much. Is your Gow Debugger tool available to the public or is it just for your studies to improve the gow browser tool

vigneshvampire commented 3 years ago

Was able to replace minotaurs with archers in athn03a.

What I did is changed ESC_GRPMinoLVL2Room Handler #4 method of all type 10 entities to push_int 31 (used hex editor and searched for previous value and adjacent opcodes). 31 - id for SKA usual AI. You can find AI ids by searching TWK_AI in R_SKA or other monster wads. Also, make sure that you have your monster wad referenced in RSRCS file inside wad. I used ska because it was already referenced in RSRCS.

First I tried to replace skeletons with minotaurs on first boat level, but maybe because of different hitboxes or entity parameters they either didn't spawn or either fall outside immediately. So not every place or monster can be replaced that easy.

image

Will You Make Tutorial for this because i cant understand this process i never used Hex editor also

leonifc331 commented 3 years ago

so with a TWK editor we could certainly swap with chests too? (I replaced TWK_Wadinfo files, and some chests are missing)

Chests should be easy, will check. I tried to add SKA to wadinfo, but it didn't help to spawn SKA on levels not having them previously. Cheking further (maybe group should correlate somehow, or ESC_ should have additional parameters)

I had a little progress, I managed to add some enemies by editing the TWK_WADInfo_xx file 2021-03-24 (11)

2021-03-24 (10)

leonifc331 commented 3 years ago

Probably TWK_WadInfo_ should be modified as well, it contains virtual vfs values. TWK_ files contain hashes of strings, not strings themselves. Maybe we can copy content from other wads where monsters used and replace wad id only. athn01a TWK_WadInfo_068: https://pastebin.com/raw/uGhPrB07 athn03a TWK_WadInfo_047: https://pastebin.com/raw/mc9rdeHe dest01 TWK_WadInfo_046: https://pastebin.com/raw/gWbX04JZ

I will try to make an editor for TWK data

@mogaika Thanks for all imformations, its work for minotaurs, and any enemies 2021-05-29 (5)

2021-05-29 (9) 2021-05-29 (12)

vigneshvampire commented 2 years ago

Probably TWK_WadInfo_ should be modified as well, it contains virtual vfs values. TWK_ files contain hashes of strings, not strings themselves. Maybe we can copy content from other wads where monsters used and replace wad id only. athn01a TWK_WadInfo_068: https://pastebin.com/raw/uGhPrB07 athn03a TWK_WadInfo_047: https://pastebin.com/raw/mc9rdeHe dest01 TWK_WadInfo_046: https://pastebin.com/raw/gWbX04JZ

I will try to make an editor for TWK data

hash(4b762f21) path(/TweakTemplates/WadInfo/047//"Extra GO 2 Name\r") value("goChest\\x00int\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00")

did you calculate the hash value - hash(4b762f21)

why hash value length is only 8 ?

how do i calculate hash values of string ?