GithubHelp home page GithubHelp logo

j-t-de / sourcehold-maps Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sourcehold/sourcehold-maps

0.0 0.0 0.0 58.58 MB

Reverse engineering the map file format of Stronghold

License: MIT License

Python 63.08% C 22.51% C++ 1.40% Batchfile 0.06% Shell 0.02% C# 8.34% Kaitai Struct 4.60%

sourcehold-maps's Introduction

sourcehold-maps Discord

Reverse engineering the map file format of the 2D Stronghold Games.

Project Goal

The goal is to understand the map file format of Stronghold, Stronghold Crusader and Stronghold Crusader Extreme and to be able to manipulate it.

Table of Contents

Map File Format

The current knowledge of the map file format (*.map, *.sav and *.msv) is documented in a human-readable form in the wiki and in a machine-readable form in here.

Tools

Python Library

The python library contains multiple useful tools to interact with map files. The most important tools are directly accessible using the command line (CL), but most of the stuff is access

Unpacking (CL)

Unpack map files to a folder:

python -m sourcehold --in "mymap.map" "mymap2.map" "mysav.sav" --unpack

Unpack single sections:

python -m sourcehold --in "mymap.map" "mysave.sav" --unpack --what 1107

(Re-) Packing (CL)

Repack map folder to a file:

python -m sourcehold --in "mymap/" "mymap2/" "mysav/" --pack

Generate Images of Map Sections (CL)

python examples/map_section_imaging.py "mymap.map" "mymap_images"

Map Preview Image (CL)

Extract an image:

python examples/map_preview_image.py extract "mymap.map" "mymap.png"

Substitute an image:

python examples/map_preview_image.py replace "mymap.map" --replacement "mymap.png" "mymap_modified.map"

Modify Map Properties

Disable buildings:

from sourcehold import load_map, expand_var_path, save_map
# You can configure your installation folder (where shcmap points to) in /config.json
map = load_map(expand_var_path('shcmap~/mymap.map'))
map.directory["building_availability"].granary = False
save_map(map, expand_var_path('shcusermap~/mymap_modified.map'))

Set starting popularity and goods:

from sourcehold import load_map, expand_var_path, save_map
map = load_map(expand_var_path('shcmap~/mymap.map'))
map.directory['STARTING_GOODS'].wood = 0
save_map(map, expand_var_path('shcusermap~/mymap_modified.map'))

Installation

Find the right wheel file for your OS and (python) architecture here (download the artifacts of the latest successful build). Then install using pip:

python -m pip install sourcehold.whl

Online Map Unpacking, Repacking and Exploring

If you don't want to install the python library and jump directly into action, there is an online tool to unpack, repack and visualize map sections.

Contribute

There are multiple ways to contribute to this project, see Contributing.md for more information.

sourcehold-maps's People

Contributors

dependabot[bot] avatar gynt avatar j-t-de avatar lawrencefoley avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.