Code Monkey home page Code Monkey logo

settlers.ts's Introduction

Settlers 4 remake (File Formats)

This is a Settlers 4 (Siedler 4) Remake (it will be :-) ) written in JavaScript (Typescript) so it can be run in your browser.

๐ŸŽ‰ run the "game" ๐ŸŽ‰

How to compile:

  1. Install NodeJs

  2. run on command line:

     npm install
     npm run build
    

โžœ This will create the ./dist/ folder with the app.

How to start:

You need a WebServer that serves the App. E.g. you can use the included one:

  1. Install NodeJs
  2. Copy the Settlers-4-game folder with the files (game.lib, gfx.lib, Gfx/0.gfx, ...) to the /dist/ folder - e.g. to ./dist/Siedler4/
  3. Run ./dist/run.bat
    This will:
    • create a list of all files in your e.g. ./dist/Siedler4/ folder.
    • start a local Webserver on your PC
  4. Open: http://localhost:8888/

How to edit:

You can use Visual Studio Code to edit and debug your code:

  1. Visual Studio Code

  2. Install Debugger for Chrome Plugin in Visual Studio Code

  3. Copy the Settlers-4-game folder to ./public/ e.g. to ./public/Siedler4/

  4. run

     npm install
     npm run serve
    

    Or press Ctrl+Shift+B to start the live-server in VS-Code

    โžœ This will start a live-server on http://localhost:8080/

  • Fix code style / linter errors

      npm run lint -- --fix
    
  • Run unit tests

      npm run test:unit
    

or to run a single file in watch mode:

    npm run test:watch tests/unit/objects-info.spec.ts

Next BIG steps:

  1. using webGl to render the state of a game by loading a save game and pushing all data to webGl:

    • โœ”๏ธ drawing map background
    • โŒ› drawing objects
    • drawing settlers
    • drawing buildings
  2. adding game logic to process state changing in the game

  3. adding backend logic

State:

Load/view a Map

View Landscape using WebGL

screenshot

View / decode file formats

You can access 'all' Settlers file formats

gfx-file view:

screenshot

gl-file and gh-file view:

screenshot

lib-file view:

screenshot

map-file view:

screenshot

Disclaim

This Software reads the original graphics/data from the original Settlers 4 title released by Blue Byteยฎ - The authors of this Software do not clam any rights on any of that data nor the name Siedler and Settlers.

settlers.ts's People

Contributors

tomsoftware avatar wizzardmaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

settlers.ts's Issues

StreamWriter will return 0xFF (-1) instead of 0

Hey,

currently there is a bug that will result in incorrect unpacking of data. In very rare cases, you will receive a (distance/length) symbol, with the distance being higher than the current pointer of the decompressed data buffer. E.g. you are writing on copyPos = 5, receiving (6,3), it will go write the values of indices {-1,0,1}, or without a boundary check the values {deflatedBuf[-1],deflatedBuf[0],deflatedBuf[1]}

In Settlers, this will result in the values out of bounds trying to be read being 0, but due to the implementation of StreamWriter.getByte(x) with x < 0 || x > data.length returning -1 (0xFF), it will not do the same as expected. Weirdly enough, this appears to be intended behaviour to read beyond the beginning of the inflated buffer.

Sadly I do not have an example at the moment, but I just wanted to let you know that this may result in unintended behavior in the future :)

Also I'd like to say that your work is amazing! I would have probably given up if it wasn't for your RE'ing of settlers DEFLATE function. I have learnt so much about compression from trying to understand your implementation and it helped me a lot! I have at this point completely reversed the entire MAP/EDM format with all its segment (chunk) contents and I will soon upload a repository if you lack any information, feel free to use that repository in return of your great effort๐Ÿ‘

Cheers

Possible to write maps?

Hi, cool project.

I see that you can read and display .map files.
Do you think it's possible to write .map files so we can create maps programmatically?
Or do you not actually read .map files and just display what the graphics engine spits out?

Thanks in advance

Contact

Hi tom, is there a way to contact you? It seems you don't have an email provided.
Cheers, MadShadow

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.