{"_id":"@camoto/gamemap","_rev":"2-78e547104b2a9aeeb2ec232d9940a012","name":"@camoto/gamemap","dist-tags":{"latest":"1.2.0"},"versions":{"1.2.0":{"name":"@camoto/gamemap","version":"1.2.0","description":"Read and write the playable levels used by DOS games","main":"index.js","type":"module","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+ssh://git@github.com/camoto-project/gamemapjs.git"},"keywords":["camoto","libgamemaps","dos","ms-dos","level-editor","games","modding"],"author":{"name":"Adam Nielsen","email":"malvineous@shikadi.net"},"license":"GPL-3.0","bugs":{"url":"https://github.com/camoto-project/gamemapjs/issues"},"homepage":"https://github.com/camoto-project/gamemapjs#readme","devDependencies":{"chalk":"^4.1.1","command-line-args":"^5.1.1","eslint":"^7.17.0","mocha":"^8.2.1","mocha-eslint":"^6.0.0"},"dependencies":{"@camoto/record-io-buffer":"^3.0.0","debug":"^4.3.1"},"directories":{"test":"test"},"gitHead":"9f18e71742c3e65cd9c2f6e7c983f183a876f84c","_id":"@camoto/gamemap@1.2.0","_nodeVersion":"16.4.2","_npmVersion":"7.17.0","dist":{"integrity":"sha512-z+mA49mkga6cQ70Cd9zyJSTo+TVgr5wt9vygtSpLH1a4uMgATGwhtwUu0Ru5NkIUvEVWJBOsOlO9Z1PFH47+Cw==","shasum":"b5632581880b0e9b2ad915b472fa4e5f247e11c8","tarball":"https://registry.npmjs.org/@camoto/gamemap/-/gamemap-1.2.0.tgz","fileCount":20,"unpackedSize":90155,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzaz+CRA9TVsSAnZWagAAnC4P+wQUnRyQyGhJ3y2vxKi+\nNNLGr16ePsUDOf8mQAxUQDPWf6ixzCrsrDMyTkwbcZXN7D8zbH32lziTLU9M\neCy6O6iG4ILTBBvpJ6EaNMckkJuG3xauzwnVZj0NmA6c8GEwTPJ7SkEBzRaD\n1HzLcBJxMmfK5MpidG/ORSXoyEzcqUP+9+Ep7OMShfOKlPxaYe77sJVxIx9I\ngCjD555mp+HkfPk9K1jqy8hptuJFQ5bH1Q/gDWaqtT1UJqntnrEhUEiKPjhN\noDM2Af2RsqWnQNgnNntGxWf5i/ouHYnAiWJL22KwbZWE3fuUn07WlLjzDyNF\nAIMKmoKHQ8OHiuqNGI6aMwU47xiI5MTVw+TQXM36yqRANdNgyRVdINgMV9iO\nskgZ53EyHDDafxIu3es9oPAhwBdSjb1DnuTwUv7pQ/wU8hs3NUJpLOnYsmap\nFSWV394t0X1TpOzaEPez+gQsulPxfL2+KqTSNBCCJrM0T+gZ7zwFxB/13wEI\nKjfbt0mym4NckocwwIN7eVw4NHJSkc5G+ptSw/fGKu815EYPsaW+kPhzGVRv\n1UX1flURxr+1aDsFtLYtXLOb2nIako2wBj1rSqdRlxXF3EOgvgCm6giH3PGi\n6IV8IO/UYW+XGgAwOyVyhvB447MQDMb/X9xi6h9o/qrfRyPI9boUvI+1M3xM\nbJJo\r\n=ue0/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDa32aEAQwUZxoHB7qxN67LRuOeBMvZtlgpS6jGMcYCDwIgBOpU4H4dtD868fGkP6hDVrraBkD3CAAIuoodt4vucfc="}]},"_npmUser":{"name":"malvineous","email":"malvineous@shikadi.net"},"maintainers":[{"name":"malvineous","email":"malvineous@shikadi.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gamemap_1.2.0_1631950068608_0.9126884699955202"},"_hasShrinkwrap":false}},"time":{"created":"2021-09-18T07:27:48.536Z","1.2.0":"2021-09-18T07:27:48.748Z","modified":"2022-04-04T21:34:35.852Z"},"maintainers":[{"name":"malvineous","email":"malvineous@shikadi.net"}],"description":"Read and write the playable levels used by DOS games","homepage":"https://github.com/camoto-project/gamemapjs#readme","keywords":["camoto","libgamemaps","dos","ms-dos","level-editor","games","modding"],"repository":{"type":"git","url":"git+ssh://git@github.com/camoto-project/gamemapjs.git"},"author":{"name":"Adam Nielsen","email":"malvineous@shikadi.net"},"bugs":{"url":"https://github.com/camoto-project/gamemapjs/issues"},"license":"GPL-3.0","readme":"# gamemap.js\nCopyright 2010-2021 Adam Nielsen <<malvineous@shikadi.net>>  \n\nThis is a Javascript library that can read and write the playable levels in\nsome MS-DOS games from the 1990s.  The levels are returned in a generic form,\nso that code using this library will work with all supported games in the same\nway.\n\n## Installation as an end-user\n\nIf you wish to use the command-line `gamemus` utility to work with map files\ndirectly, you can install the CLI globally on your system:\n\n    npm install -g @camoto/gamemap-cli\n\n### Command line interface\n\nThe `gamemap` utility can be used to inspect game levels.  Use the `--help`\noption to get a list of all the available options.  Some quick examples:\n\n    # Display information about a map\n    gamemap open -t map-ddave level01.dav info\n\nTo get a list of supported file formats, run:\n\n    gamemus --formats\n\n## Installation as a dependency\n\nIf you wish to make use of the library in your own project, install it in the\nusual way:\n\n    npm install @camoto/gamemap\n\nSee `cli/index.js` for example use.  The quick start is:\n\n    import { map_cosmo } from '@camoto/gamecomp';\n    \n    // Read a game level\n    const content = {\n        main: fs.readFileSync('a1.mni'),\n    };\n    let map = map_cosmo.parse(content);\n    \n    // Save the level to a new file\n    const output = map_cosmo.generate(map);\n    fs.writeFileSync('a1new.mni', output.main);\n\n## Installation as a contributor\n\nIf you would like to help add more file formats to the library, great!  Clone\nthe repo, and to get started:\n\n    npm install\n\nRun the tests to make sure everything worked:\n\n    npm test\n\nYou're ready to go!  To add a new format:\n\n 1. Create a new file in the `formats/` folder for your format.\n    Copying an existing file that covers a similar format will help\n    considerably.\n\n 2. Edit `formats/index.js` and add an `import` statement for your new file.\n\n 3. Make a folder in `test/` for your new format and populate it with\n    files similar to the other formats.  The tests work by opening a sample\n    map in the new format and ensuring it matches some expected values (like it\n    only contains tiles the map format reports as being permitted).\n    \n    You can either create these files by hand, with another utility, or if you\n    are confident that your code is correct, from the code itself.  This is done\n    by setting an environment variable when running the tests, which will cause\n    the data produced by your code to be saved to a temporary file in the\n    format's test directory:\n    \n        SAVE_FAILED_TEST=1 npm test\n        cd test/map-myformat/ && mv default.bin.failed_test_output default.bin\n\nIf your file format has any sort of compression or encryption, these algorithms\nshould go into the [gamecomp.js](https://github.com/Malvineous/gamecompjs)\nproject instead.  This is to make it easier to reuse the algorithms, as many of\nthem (particularly the compression ones) are used amongst many unrelated file\nformats.  All the gamecomp.js algorithms are available to be used by any format\nin this library.\n\nDuring development you can test your code like this:\n\n    # Read a sample song and list its details, with debug messages on\n    $ DEBUG='gamemap:*' ./bin/gamemap open -f map-myformat example.map info\n\n    # Run unit tests just for your format only\n    npm test -- -g map-myformat\n\nIf you use `debug()` rather than `console.log` then these messages can be left\nin for future diagnosis as they will only appear when the `DEBUG` environment\nvariable is set appropriately.\n\n### Development tips\n\n#### Levels inside .exe files\n\nIf a game's levels are stored inside the main .exe file, or another file that\ncontains other data, there are two ways this can be handled.  Remember that none\nof the libraries modify files in-place, they only read them into memory in full,\nand write new files from the data stored in memory.\n\nThe first method is to have the map handler read the whole file, and store the\nextra unused .exe data so that it can be written out again in full when the maps\nare saved.  This method is simple but it cannot be used unless the only moddable\ndata contained in the file is map data.  If it contains other data that can be\nmodified, such as game graphics, then there is a problem.\n\nImagine an .exe file with both maps and graphics.  The file is loaded by\ngamemapjs which decodes the game levels and stores the rest of the data for\nlater.  Then gamegraphicsjs loads the same file, decodes the images, and also\nstores the rest of the data for later.  If both modified graphics and maps are\nthen saved, what happens?  When the maps are saved the extra .exe data will be\nwritten, including the original graphics.  When the graphics are saved, the\nextra .exe data written includes the original maps.  So whichever one gets saved\nfirst will have its changes lost.\n\nSo whenever a file contains multiple types of data, the second option must be\nused.  This is to add it to gamearchivejs as if it were an archive file.  In the\nexample above, the map and graphics data would appear as separate files within\nthe .exe \"archive\".  This allows the maps to be loaded from the map files inside\nthe archive, the graphics loaded from the graphics files, and whenever any of\nthem are saved, the archive handler takes care of combining all the data back\ninto the complete .exe file.\n","readmeFilename":"README.md"}