Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds
Watch MODSonair

Members Online

»
0 Active | 65 Guests
Online:

LATEST FORUM THREADS

»
Gaming
Q4 General
eXtreme+ v2.9
CoDBO Map + Mod Releases
map loading error
CoD2 MP Mapping
Good Servers on PC
CoDBO General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
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]
Level 8
Category: CoD4 Scripting
Posted: Monday, Jan. 30, 2012 08:31 am
I wonder if i understand the hooking right:

  1. game engine calls the main function of the map gsc, e.g. mp_mymyap.gsc::main()
  2. codescripts\struct.gsc and codescripts\delete.gsc get called (delete if there are forbidden entities in map) - true?
  3. once all non-threaded commands are executed, gametypes\_callbacksetup.gsc::CodeCallback_StartGameType() is run
  4. gametype script gets called (depends on what gametype is set) - true?
  5. on player events, the appropriate codecallback functions in the callbacksetup are used, which redirects to the _globallogic.gsc
  6. all other scripts are either run from the map gsc, globallogic or gametype script - or did i miss another hook?
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD4 Scripting
Posted: Monday, Jan. 30, 2012 09:09 am
Sevenz writes...
Quote:
I wonder if i understand the hooking right:

  1. game engine calls the main function of the map gsc, e.g. mp_mymyap.gsc::main()
  2. codescripts\struct.gsc and codescripts\delete.gsc get called (delete if there are forbidden entities in map) - true?
  3. once all non-threaded commands are executed, gametypes\_callbacksetup.gsc::CodeCallback_StartGameType() is run
  4. gametype script gets called (depends on what gametype is set) - true?
  5. on player events, the appropriate codecallback functions in the callbacksetup are used, which redirects to the _globallogic.gsc
  6. 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.

Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Monday, Jan. 30, 2012 09:26 am
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
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD4 Scripting
Posted: Monday, Jan. 30, 2012 09:50 am
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).


Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Monday, Jan. 30, 2012 12: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
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD4 Scripting
Posted: Monday, Jan. 30, 2012 12: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".
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Monday, Jan. 30, 2012 12: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. [rolleyes]
IWI files are just renamed DDS files with a slightly modified header, not some special new format to be proud of.
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD4 Scripting
Posted: Monday, Jan. 30, 2012 12: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. [rolleyes]
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?
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Monday, Jan. 30, 2012 01: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. [rolleyes]
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.
Share |
BraX
General Member
Since: Apr 29, 2008
Posts: 413
Last: May 26, 2012
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Monday, Jan. 30, 2012 06:18 pm
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.
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»