Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripting #10

Open
rukai opened this issue Apr 28, 2017 · 0 comments
Open

Scripting #10

rukai opened this issue Apr 28, 2017 · 0 comments
Labels

Comments

@rukai
Copy link
Owner

rukai commented Apr 28, 2017

This is a big vague issue, I'm just collecting/publishing ideas here.

Needed for

  • give fighters unique special abilities.
  • unique game mechanics
  • Ledge getup actions will use it for the following:
    • what frame to stop hogging
    • what frame to actually land/give control back to player
    • position offset from the ledge for each frame

Language choice

There a lot of options. The main ones include:

Rlua

  • lua binding

Hlua

  • lua binding

Rhai

Dyon

  • Functional

Gluon

  • Functional

Roll our own

  • Would integrate better with treeflection
  • Tailor syntax to our needs
  • Would never be as nice as a proper language, dont have the resources to devote to such a task.

Scope

The scope for the scripting language is very important, some potential ideas:

  • Move all game logic into script callbacks, things like collisionbox/stage collision are kept in rust.
  • Each character gets their own script which is called during their step method.
  • A unique script is stored for each action or frame for each character

Example Lua API

For each fighter there is a fighter.lua file containing the following functions:

spawn(usize player);
action(usize player, usize action, usize frame);
hitbox_collide(usize player, usize action, usize frame, int collision_flags);
hurtbox_collide(usize player, usize action, usize frame, int collision_flags);

The functions are called by pf sandbox when each event occurs.
They have access to an api:

set_acc_player(usize player, float x, float y);
get_acc_player(usize player, float x, float y);
set_vel_player(usize player, float x, float y);
get_vel_player(usize player, float x, float y);
set_pos_player(usize player, float x, float y);
get_pos_player(usize player, float x, float y);
set_action(usize player, usize action);
generate_entity(String name, float x, float y);
random(int max); // seeded determined at start of game + frame_index
// high and low level input e.g. can_jump and press_x

@rukai rukai added the Engine label Apr 28, 2017
@rukai rukai mentioned this issue Apr 28, 2017
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant