Giter Club home page Giter Club logo

recordeu4's Introduction

RecordEU4

RecordEU4 allows you to record your EU4 campaigns and replay them at a later date.

Now, behold this piss-poor README.

Installation

There are three parts to RecordEU4 that must be managed for installation.

Mod

The mod can be setup via the EU4 launcher or by creating your own .mod files and placing them in ~/Documents/Paradox Interactive/Europa Universalis 4/mod. Enable it in the launcher and Voila, nothing else is needed on your part.

As of now, the mod depends on there being exactly 4939 provinces. If you are using a modified map, make sure to update /common/scripted_effects/rec_set_prov_vars.txt.

Log Collector

The log collector is a python project that can be extracted anywhere. A requirements.txt is provided. Make sure to update config.py with correct paths for EU4_DOCUMENTS_DIRECTORY and EU4_GAME_DIRECTORY.

Desktop Application

The desktop application is a NodeJS project that can be extracted anywhere.

Usage

Log Collector

The log collector can be run via python main.py or pythonw main.py, and that's it, it'll run in a console or in the background respectively.

Note that the collector relies on the game.log file created by EU4 to create a recording. This file is reset whenever EU4 is opened. Alternatively, you can pass a file path like so python main.py ./file/path/to/my/saved/log/file.txt, causing the collector to read it as the log file instead.

Desktop Application

The application can be run via npm start, opening an electron window. To replay a recording, select it from the left-hand panel to begin loading it. Once loaded, the map can be panned and zoomed using the mouse. In the bottom right hand corner, the recording can be played, paused, and stepped.

recordeu4's People

Contributors

zeplar-exe avatar

Watchers

 avatar

recordeu4's Issues

Province Recoloring

Provinces need to be setup such that they can be flood filled individually. As of now, flood filling will cause an entire country to be recolored whenever an enemy wins a siege. Some solutions are as follows;

  1. Store a polygon of the province's shape and iterate over all of its containing pixels
  2. Store a list of pixels that represent a province
  3. Draw province borders to permit using flood fill

Desired on_actions

The following events are needed to improve recording accuracy;

  • on_siege_began
  • on_occupation_transfered
  • on_war_declared
  • on_occupation_ended (at the end of wars, for example)

Automatic State Reset for Log Collector

As of now, the log collector must be restarted whenever the player loads a new gamestate (via new or loaded game). Instead, it should be able to determine when a new game is started and reset its state for a new recording.

Preferably, this can be implemented by checking for on_startup and doing the aforementioned reset before any event handlers are invoked.

Improved Canvas Drawing Speed

Overall, the current speed to draw province updates is painfully slow and disruptive. Some ideas;

  • Switch from regular HTML canvas rendering to WebGL rendering. Not only is this faster, it's also much better suited for the current requirement of updating large bitmaps.
  • Generate lines from provinces to draw polygons directly onto the canvas. I'm not sure of the performance implications of this.
  • If it's supported, draw rectangles where only the province's pixels are filled in.
  • Implement a form of background processing to prevent stutters and input delay in general

Backwards Seeking

Backwards seeking does not rewind, but rather executes previous events again. This is to be expected, as the changeDate function is written in a forward-only fashion. In the future, this should be changed to either do the opposite of the given events or otherwise undo the events after it.

Recording to EU4

A possible expansion of this project is to take recordings and generate a mod which plays out the described events in an EU4 game. This is entirely possible via on_monthly_pulse, is_year, and is_month with events delayed by n days.

The primary bottleneck would be the size of the output mod, since it would need to execute an effect for nearly every province and country.

Improve EU4 File Parser

The current parser (/src/log_collector/eu4_parser.py) is very basic and works for the default EU4 data files. However, it is in no means future proof and should be updated to manage statements spanning multiple lines, as well as nesting.

Province IDs

Find a way to get the number of provinces in-game AND assign each province with an id variable dynamically. The primary roadblocks so far are that (a) sea tiles cannot be iterated, and (b) IDs seem to be a special type which cannot be constructed normally and put into a variable.

The only alternative solution I know of is the use of trigger_value in export_to_variable. However, trigger_value is broken for non-numerical values at this time.

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.