Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Lets say you are playing Starcraft 2 melee map. The game loads the map. Melee maps have the following dependencies:

  • Liberty (Mod)
  • Liberty Multi (Mod)

I think the game engine will load the data from Liberty (Mod) first, then from Liberty Multi (Mod). For data that exists in both dependencies, the engine will use the one from Liberty Multi (Mod). Is this correct?

Liberty Multi (Mod) is updated with each patch of Starcraft 2.
Does the game engine load just the latest version of Liberty Multi (Mod)?
or
Does the game engine load all the versions and overwrite duplicate data with the latest version?

share|improve this question
    
Close to a "How Was Game X Made"-question, which are generally off-topic ( meta.gamedev.stackexchange.com/questions/626/… ). Questions no-one can answer are not useful. –  Anko Mar 19 '12 at 8:44
    
@Aku disagreed. This isn't asking how the whole game is created - just a portion of it. –  Jonathan Dickinson Mar 19 '12 at 9:06
    
@Jonathan Hence "close to". I don't mean to close-vote; just to note that great answers may not come up. –  Anko Mar 19 '12 at 10:02
    
@Aku you should state that - someone did vote to close it and likely because of that comment :). –  Jonathan Dickinson Mar 19 '12 at 10:42
    
@Jonathan Oh dear, words are powerful indeed! :D I'll be more careful in the future. –  Anko Mar 19 '12 at 13:51

1 Answer 1

up vote 5 down vote accepted

You are very close to understanding how the system works. My answer won't necessarily be how Starcraft works - but most moddable games work like this; and Starcraft is either very similar or the same.

Firstly the mod system would have some form of a header file for each mod. This would list any 'base' dependencies: in the instance of "Liberty Multi" it would list "Liberty" as the only base mod. This is basically used to build a chain of names and nothing more, so what you are looking for at the end of the day is:

  • My Cool Map (more on this later)
  • Liberty Multi
  • Liberty

When you need to load an asset you would search the mods top-down. Starcraft would therefore look in Liberty Multi for assets and then Liberty. MPQ (Blizzard's zip-like files) are actually quite good at this as you can very quickly determine if a file is not present. If the file is not present look through any additional base mods. Something like the following pseudo-code:

routine findAsset(string assetName):
  let mods = "Joes Mod", "Liberty Multi", "Liberty"
  each mod in mods
    if modFileExists(mod, assetName):
      return loadAsset(mod, assetName)
  raise error "Asset not found" -- Or return a default asset for the asset type

You could even pre-build a table that contains the resolved file table for all the mods that are loaded - again investigate on how MPQ would make this possible.

Some systems let you skip the asset discovery and load an asset directly from a specific mod - this helps when, for example, a mod wants to call a script from the base mod that it has a new implementation/override of.

Starcraft overwrites assets when a patch is released. The engine is unaware of previous versions; except a routine which is used to upgrade (or translate-on-the-fly) previous save games and replays. If you remove something from the game you must leave the tombstones in your assets so that you don't get missing textures etc. for replays.

Finally remember that, in Starcraft specifically, a map is actually the first mod in the chain; and it is due to this that maps like DoTA were possible in Warcraft 3 (which is the code-base for Starcraft 2).

share|improve this answer
    
I thought when sending out patches it might be better (less bandwidth) to only send the changes in data to the client. The client could then build the latest assets based on the old data and the change information. This could all be done as part of the patching process. I wonder why that might not be the case. –  chobok Mar 20 '12 at 3:57
    
@chobok only the changes are usually sent to the client. What you would typically do is download the new assets from your CDN, crack open the MPQ (or zip file/directory/whatever) and replace/diff-patch the files that are different - but you wouldn't keep the old ones around once the patching process has completed. –  Jonathan Dickinson Mar 20 '12 at 8:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.