Why would I want to mod KanColle? Is it safe?
- The simple answer is to keep this game interesting by allowing more customisation. As much as we love KanColle and the contributing artists, some of the artwork is not as good as the rest and there are no signs that the developers are planning to fix it anytime soon.Instead of relying on developers to come up with new content every now and then, players are given the options to change the apperance of their own game at will.
- And you must admit it looks pretty cool.
- [+] Spoiler
- Various implementations of this modding method works by inserting itself between the client-server traffic route and selectively intercept those requests for certain file types (*.swf, *.png and *.mp3 in the current version) and save a copy of the file to a local folder. When the same file is requested again, the local copy is preferentially used unless a newer version is available on server. Additional rules has been written so that when a mod file ( [FileName].hack.[Extension]) is present, it will be injected into the game client instead of the real response.
- Technically, the file injection method is safe to use as both the client and the server are totally unaware of the interception. The same tools has been used for more than a year by the Chinese community without any issues reported. If a locally stored file ever becomes corrupted, it may cause errors to occur in game. Once the offending file is removed the game shall resume working. This can happen with unmodified games as well as browser cache do occasionally become unusable, therefore this should not raise alarms anywhere.
- I have made a simple flow diagram to help illustrate its internal logic used by the KCV plugin I use. More documentation and the source code is available for review from my GitHub repo with all comments translated.
Set up KancolleCacher
- [+] Spoiler
- Copy KancolleCacher.dll to the plugins folder under your KCV installation
- Right click on the file, choose 'Properties' from the context menu and thenÂ click 'Unblock'Â on the 'General'Â tab before clicking 'OK' to exit.
- Launch KCV and clear cache before the game is loaded. This step is important as the browser wrapped inside KCV maintains its own cache and will not request it through our plugin unless forced to do so. Similarly, it is necessary to flush the browser cache after adding mods. This should not cause any noticeable delay in game loading speed as the files has already been downloaded to your computer.
- Cache Manager can be found under the 'Tools' tab of KCV alongside other plugins. Feel free to play with the settings, but the defaults should work fine.
- For each ship, all sprites and banners are packaged in a single .swf. Therefore as long as the particular ship has been displayed once in game under any context, the full set of sprites will be downloaded and saved to MyCache folder by default. If you wish to mod enemy ships (yes, this can be done), you will need to sortie to a node where the enemy ship can be found.
- Ship names are obfuscated in a half-assed attempt to prevent fuzzing. It is, unsurprisingly, only a small annoyance as the startup API (api_start2) contains a full list of ships matched to file names. The file names generally stay the same between game updates, with new ships added gradually over time.
- To parse this information, go to the Cache Manager tab and choose 'Generate Sprite File List'Â. A list will be saved as Ã¢'GraphList.txt'Â to the cache folder in your settings.
- Open the list and search for the character card number or ship name in Japanese. Note that ships with multiple character card numbers will have multiple files.
- The files themselves are located under /kcs/resources/swf/ships/
Sprite file pack- Data structure
- As far as we are concerned, the .swf file is merely a stack of images in the following structure
- Banners are static icons of fixed size, however they are not actually easy to make from scratch because we don't have access to the fonts and background texture used by the developers. People have tried to make their own template to emulate the appearance, however they are still a major hassle to create. I will leave them out of this tutorial for simplicity's sake. That said, well-drawn banners can be absolutely amazing like the one shown at the beginning of this post.
- That leaves us with the most important part: images number 17 and 19. They are the highest resolution sprites used almost everywhere in game. The maximum size that can be displayed without obvious problem appears to be an 800x800 pixel square. Technically it is possible to accommodate oversized (as well as undersized) images by editing the shapes and frames defined in the swf file; however this can get fairly complex may require using paid software. In this tutorial I will try to keep it simple and only use in situ image replacements.
Basic Mod Creation Example
(Obsolete, please refer to the automated tools above)
- [+] Spoiler
- First, prepare renders of your new sprite with transparent background. Plenty of tutorials can be found online.
- Try to use that have a good amount of contrast/sharpness and without unnatural borders. For example, the render shown below is great, but not really usable with a large chunk missing to the left.
- Open ShipGraph.txt generated by the plugin and find the files names we need to modify. In this case it will be feyfhhruhjse.swf. Find it under /kcs/resources/swf/ships/ and make a copy of it before you start. If you have not yet remodeled her, then you need to modify the sprite pack for Littorio which is hkhkiqkleprp.swf.
- It is very tempting to simply resize the render and drop it in. However this rarely comes out satisfactory as the game only displays a pre-defined portion of the sprite that is unique for each sprite. While the game client has the mechanism to adjust the alignment, the x,y-coordinates are stored in api_start2 and not modifiable using our method. Hence we need to align the sprites before they are loaded into the game.
- A quick way to align the images is to copy the new sprite to a new layer above the stock one, adjust the size and location until the head and/or torso of two layers overlap. The result may not be perfect, but should serve as a good starting point.
- Delete the stock sprite layer; save the file under a new name.
- Replace image 17 in feyfhhruhjse.swf with our new sprite, save the new file as feyfhhruhjse.hack.swf and make sure it is saved under /kcs/resources/swf/ships/
- Relaunch KCV and click the 'Clear Cache' button before the game is loaded. This action forces the browser wrapped inside KCV to download those files again so our mods can be injected.
- Not spectacular, but not bad either. The main sprites shown at port will not appear as sharp as you might expect - this is a consequence of the poorly coded 'breathing'Â animation in the game client. Depends on the source image you may need extra sharpening to maintain the appearance.
- Also, waist-up renders are best not to be used for making damaged sprite as the battle damage animation scrolls through the entire height of the image. Use only full-body sprites if you are put off by the unintentional amputation. But don't just give up yet, patching things up is also part of the fun.
- Some attempts at making full-body collages. For me this is a long shot, but the more artistic types of you should be able to do a better job!
- Sound files are stored under /kcs/sound/kc[shipname]/ for friendly ships, and /ksc/sound/kc9998/ for enemy ships.
- [Shipname] is the same string used for sprites that can be found in GraphList.txt, while vID needs to be parsed from BattleMain.swf (More information to come soon)
- To mod it, simply rename the new sound clip to [number].hack.mp3 under the respective folder. Here appears to be no limitations on the length of audio, however you might want to keep it brief anyway.
- Be very careful if you wish to push the boundaries and edit files outside /kcs/resources/! Whilst unlikely, corrupted scripts within these files may cause the game to send malformed API calls that could attract repercussions. Scene files in particular are known to contain bot-detection code and a high degree of caution is advised if you wish to modify them.
- The fonts used for game interfaces are stored in /kcs/resources/swf/font.swf. It is not commonly done, however people have done it and it should be safe.
- commonAssets.swf, icons.swf and itemicons.swf contains other sprites shown in game. These should be safe to mod as long as you keep to the size limits.
- /kcs/resources/image/slotitem/ contains the icon for equipment icons and text as they appear in battle.
- Please show some respect to the artists by not redistributing their work unless you have clear permissions to do so. I would also suggest against repackaging any of the stock images in sprite packs you intend to redistribute as they are owned by DMM/KDKW. In any case the stock files are readily available for download from the game server anyway.
- This tutorial is provided as is without any guarantees or liabilities admitted. I cannot be held responsible for any damage done to your property and data as a result of using this guide. Images used in this tutorial are covered under the fair use provisions of DMCA and they remain the intellectual property of their respective authors.
Sources, references and acknowledgements
@Gabracr07 for creating KancolleViewer
@veigr for documenting the API and resource file structure
df32 for creating the KancolleCacher project
Julius128 for awesome Iku/Hestia art, 243798061 for making one of the best sprite packs
@Nagifuma and @AkasaAi for Littorio art pieces.