Author |
Topic: Script calls - Hooking between game engine and scripts? |
Sevenz |
|
General Member Since: Apr 24, 2006 Posts: 2390 Last: May 10, 2013 [view latest posts] |
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Monday, Jan. 30, 2012 04:09 pm |
|
Sevenz writes...Quote: I wonder if i understand the hooking right:
- game engine calls the main function of the map gsc, e.g. mp_mymyap.gsc::main()
- codescripts\struct.gsc and codescripts\delete.gsc get called (delete if there are forbidden entities in map) - true?
- once all non-threaded commands are executed, gametypes\_callbacksetup.gsc::CodeCallback_StartGameType() is run
- gametype script gets called (depends on what gametype is set) - true?
- on player events, the appropriate codecallback functions in the callbacksetup are used, which redirects to the _globallogic.gsc
- all other scripts are either run from the map gsc, globallogic or gametype script - or did i miss another hook?
I'm not sure about the codescript files, as I am not sure they are absolutely necessary. As I understand it, only 2 main() functions are called from the engine as a conditio sine qua non:
1. level script main()
2. gametype script file main()
From the gametype main() function, a runtime script call (found at the top of each gametype script file) is made to set up the callbacks (hooks) in _callbacksetup.gsc into engine for:
Quote: CodeCallback_StartGameType()
CodeCallback_PlayerConnect()
CodeCallback_PlayerDisconnect()
CodeCallback_PlayerDamage()
CodeCallback_PlayerKilled()
CodeCallback_PlayerLastStand()
Obviously, these callbacks don't have to go to the gametype script file at all - as is the case with _globallogic.gsc. As such, a gametype file need only really have the main() function, and the runtime script call to set up where the CodeCallbacks are going to go. As you correctly observe, all other calls are performed as runtime script calls from wherever the Codecallbacks are defined.
|
|
|
|
serthy |
General Member Since: Sep 8, 2010 Posts: 482 Last: Jun 28, 2013 [view latest posts] |
|
|
|
Category: CoD4 Scripting Posted: Monday, Jan. 30, 2012 04:26 pm |
|
Quote: codescripts\struct.gsc and codescripts\delete.gsc get called (delete if there are forbidden entities in map) - true?
tried it with iPrintLn() and also searched for calls from somewhere else from the script, results:
codescripts\struct::InitStructs() is called
codescripts\delete::main() seems not
also like Tally said:
gametype::main() , mapname::main() > called on start
& the severall _callbacksetup::CodeCallback's() are called on their events
|
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Monday, Jan. 30, 2012 04:50 pm |
|
serthy writes...Quote: & the severall _callbacksetup::CodeCallback's() are called on their events
But that is at runtime. I think that Sevenz is trying to work out what gets called by the engine as a map is loaded.
As for codescripts\struct::InitStructs() - it is totally redundant; it doesn't do anything at all. The struct array is actual defined in the engine code itself. I think it is legacy code left over from when they were building the COD2 engine. It is not well known that, half way through the development of COD2, Infinity Ward did a U turn on how the engine would work and how it would be structured. I was told this when I visited the IW studios the first time, but a clear example of it can be seen in that half of the materials files are strange .TGA files which replaced COD1's .STYPE files, and then they switched over to Maya .MTL files (materials files). This was about half way through development. The initStruct() function appears to be similar redundant development - kind of like leaving in all the Quake 3 menu .H and .C stuff, which was/is never used in any COD game (not even in the Return to Castle Wolfenstein engine).
|
|
|
|
.KiLL3R. |
|
General Member Since: Oct 26, 2006 Posts: 1437 Last: Jul 3, 2017 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Monday, Jan. 30, 2012 07:13 pm |
|
Tally writes...Quote: strange .TGA files which replaced COD1's .STYPE files
TGA is an image format, .STYPE files are text files, I wounder how they were going to replace text with images :o |
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Monday, Jan. 30, 2012 07:27 pm |
|
.KiLL3R. writes...Quote: Tally writes...Quote: strange .TGA files which replaced COD1's .STYPE files
TGA is an image format, .STYPE files are text files, I wounder how they were going to replace text with images :o
Actually, that is not correct. It might well be in other usage, but in COD2, .TGA files act as early MTL files - they are NOT image files. All image files in the IW Tech engine are IWI files.
BTW - "wounder" is spelt "wonder". |
|
|
|
.KiLL3R. |
|
General Member Since: Oct 26, 2006 Posts: 1437 Last: Jul 3, 2017 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Monday, Jan. 30, 2012 07:42 pm |
|
Tally writes...Quote:
.TGA is an image format? You don't say? Get out of town!
As it is, in COD2, .TGA files act as early MTL files - they are NOT image files. All image files in the IW Tech engine are IWI files.
BTW - "wounder" is spelt "wonder".
Hey now, I was just curious about how they would use images to replace text files, but I guess their TGA files are not of the type that they are commonly know as.
IWI files are just renamed DDS files with a slightly modified header, not some special new format to be proud of. |
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Monday, Jan. 30, 2012 07:55 pm |
|
.KiLL3R. writes...Quote: Tally writes...Quote:
.TGA is an image format? You don't say? Get out of town!
As it is, in COD2, .TGA files act as early MTL files - they are NOT image files. All image files in the IW Tech engine are IWI files.
BTW - "wounder" is spelt "wonder".
Hey now, I was just curious about how they would use images to replace text files, but I guess their TGA files are not of the type that they are commonly know as.
IWI files are just renamed DDS files with a slightly modified header, not some special new format to be proud of.
I never for a moment made like IWI files are anything "special". Maybe you're reading things into my words which aren't there. But while we're on the subject, these IWI files with that "slightly modified header" means they cannot be used in any image program without using a program to decompile back to .DDS. So, maybe it is a "special new format" after all eh? |
|
|
|
.KiLL3R. |
|
General Member Since: Oct 26, 2006 Posts: 1437 Last: Jul 3, 2017 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Monday, Jan. 30, 2012 08:12 pm |
|
Tally writes...Quote: .KiLL3R. writes...Quote: Tally writes...Quote:
.TGA is an image format? You don't say? Get out of town!
As it is, in COD2, .TGA files act as early MTL files - they are NOT image files. All image files in the IW Tech engine are IWI files.
BTW - "wounder" is spelt "wonder".
Hey now, I was just curious about how they would use images to replace text files, but I guess their TGA files are not of the type that they are commonly know as.
IWI files are just renamed DDS files with a slightly modified header, not some special new format to be proud of.
I never for a moment made like IWI files are anything "special". Maybe you're reading things into my words which aren't there. But while we're on the subject, these IWI files with that "slightly modified header" means they cannot be used in any image program without using a program to decompile back to .DDS. So, maybe it is a "special new format" after all eh?
I never stated that you said IWIs are anything special, but you certainly put that point across.
Please note 'special', changing the format or even just the header of an image file is, of course, creating a new image format, but with IWIs the actual image data is left untouched and so in my opinion IWIs are nothing special. |
|
|
|
BraX |
|
General Member Since: Apr 29, 2008 Posts: 413 Last: May 26, 2012 [view latest posts] |
|
|
|
Category: CoD4 Scripting Posted: Tuesday, Jan. 31, 2012 01:18 am |
|
Tally writes...Quote: This was about half way through development. The initStruct() function appears to be similar redundant development - kind of like leaving in all the Quake 3 menu .H and .C stuff, which was/is never used in any COD game (not even in the Return to Castle Wolfenstein engine).
Return to Castle Wolfenstein engine? Never heard about it.. you meant IDTech 3 :p
I'm wondering why almost all posts in this thread are off-topic.
Some people say that IW developed their own engine, for me it's just next-gen Quake 3's engine with almost all it's bugs, even blendfunc bug is still there. |
|
|
|