Skip to content

Archeia/RPG-Maker-MV-Game-Player

Repository files navigation

RPG Maker MV Game Player

This is the game engine for RPG Maker MV. By default, the core scripts are merged and creates a long js file. This repository exists for plugin developers to have an easy time to reference the code and find the changes of the engine. This repository will be updated when the engine does. If you want to work with the core scripts, refer to Core script Collaboration.

Documentation

Script Call List by Archeia and RMW
https://docs.google.com/spreadsheets/d/1-Oa0cRGpjC8L5JO8vdMwOaYMKO75dtfKDOetnvh7OHs/edit#gid=0
Library Documentation by Kino:
https://kinoar.github.io/rmmv-doc-web/index.html

How to build

To build Corescripts, install Node.js, change working directory, and just type in console:

npm install
npm run build

Then you can find Corescripts in folder “dist”

If you want to build indivisually, Here’s some command,

npm run build:core
npm run build:managers
npm run build:objects
npm run build:scenes
npm run build:sprites
npm run build:windows

To test, place MV’s project in game/ and type

npm test

There are helpful tasks, watch and start.

Watch task is watching js/rpg_*** changes, concat them, and copy that to ./game/js/ .

npm run watch

Start task starts local server. You can test Corescripts in your browser.

http://localhost:8080/

npm start

Constitution

The core script is finally output to mainly 6 files.

rpg_core.js
Features base classes such as audio and input processing. It also contains the wrapper classes from Pixi.js
rpg_managers.js
Static classes named XxxManager that manage the game overall.
rpg_objects.js
Classes named Game_Xxx dealing with game data (many are saved).
rpg_scenes.js
Classes named Scene_Xxx in which the scene is defined.
rpg_sprites.js
Classes named Sprite_Xxx related to image display and processing.
rpg_windows.js
Classes named Window_Xxx handling window display and input.
Others
In addition, a plugin list is defined in plugins.js, and main.js launches the game.

Inheritance style

// In JavaScript this function is constructor
function Derived() {
    this.initialize.apply(this, arguments); // Delegate to initialize()
}

Derived.prototype = Object.create(Base.prototype); // Derived inherits from Base
Derived.prototype.constructor = Derived;

Derived.prototype.initialize = function () {
    Base.prototype.initialize.call(this); // This makes super.initialize() sense
};

Global variables

Variables named $dataXxx are read from JSON in the data folder. These files are changed by the editor, but they are immutable during play. Variables named $gameXxx are instances of the class defined in rpg_objects.js. When saving the game, these objects (except $gameTemp, $gameMessage, $gameTroop) are serialized to JSON and saved. When loading, since the prototype chain is reconnected simultaneously with deserialization, you can continue using instance methods.

Scene graph

The scene graph is a drawing tree like FLASH provided by Pixi.js. Children are influenced by parent's coordinates and visibility. Register a child in the form (scene or sprite or window).addChild(child).

Scene

In RMMV the scene is the root element of the scene graph and has children with Sprite and Window. The life cycle is managed by SceneManager, and it operates up to one at the same time.

Life cycle: new Scene_Xxx() -> create() -> start() -> update()* -> stop() -> terminate()

Flow

Initialization

  1. When the page is loaded, call SceneManager.run(). (main.js)
  2. Initialize classes such as Graphics, WebAudio, Input, TouchInput.
  3. Set Scene_Boot to SceneManager.
  4. Register SceneManager.update in requestAnimationFrame.

requestAnimationFrame is called by the browser at regular time intervals (every time drawing is required).

Update

  1. requestAnimationFrame calls SceneManager.update().
  2. Process the current scene every 1/60 second according to the scene lifecycle rule
  3. If Scene_Xxx.update() is called, then
    1. Call all children update().
    2. Children recursively call their children update().
  4. Render the scene (including its children) onto the screen.
  5. Register SceneManager.update in requestAnimationFrame.

License

This content is released under the (http://opensource.org/licenses/MIT) MIT License.

About

Game Player Corescript of RPG Maker MV

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published