spelunky-fyi / overlunky

An overlay for Spelunky 2 to help you with modding, exploring the depths of the game and practicing with tools like spawning arbitrary items, warping to levels and teleporting.
MIT License
87 stars 33 forks source link

Lua API features and goals #28

Open Dregu opened 3 years ago

Dregu commented 3 years ago

Feel free to dump your ideas and required functions for the Lua scripting API here.

sjtower commented 3 years ago

Thank you for all your work, Dregu!

I don't know anything about Lua scripts, what kinds of things could we use them for in Spelunky2? Just off the bat, it would be cool if we could load in enemies and traps that are not in the level editor. This would require integrating more tightly with the editor.

d11z commented 3 years ago

I think the Lua API should allow access to primitive drawing using imgui (line, text, etc). Or maybe even simpler, just a boolean to toggle showing an entity's hitbox.

0novo commented 3 years ago

An enum for search flags would be a great addition, especially since it's entirely reliant on your memorization skills right now

Mr-Auto commented 3 years ago

Can we also get event's on_entity_spawn with uid as argument (ideally run before the item is drawn on screen), on_entity_kill or before_entity_kill with uid, actually why events never have arguments? can they have them even? like on_level giving you a level number, on_win giving info what win it is etc.

SuperNinjaFat commented 3 years ago

Currently, spawning LIQUID_* entities with spawn_entity() results in a crash. A fix for this or a workaround would be appreciated.

Another related topic; having increased liquid pools for areas in which liquid is problematic would be useful. For instance, currently on olmec, any liquid other than LIQUID_STAGNANT_LAVA won't work.

0novo commented 3 years ago

Some things that would be nice to have:

  1. ~Expand BUTTON enum to include movement (e.g. left = 0x100, right = 0x200, up, down), also maybe~ change the numbers to hex on the script doc (currently it goes 1, 2, 4, 8, 16, 32 instead of 0x1, 0x2, 0x4, 0x8, 0x10, 0x20) [Edit: now that I think about it, don't_ expand the enum or else people will get confused]
  2. PLAYER_STATE (CHAR_STATE?) enum (e.g. number = STANDING, otherNumber = HANGING, etc.)
  3. AI_STATE enum (e.g. number = IDLING, etc.) <-- not sure if this one would work, i'm assuming that every entity uses the same values for their ai_states

hopefully shouldn't be too hard to implement :p

Mr-Auto commented 3 years ago

@0novo for the ai_state aka move_state there are different numbers used in different ways, some are common like idle, attack, but other like 11 is caveman sleep and 5 when he blinks the eyes + even some between for a split second, i would be hard to name them properly

SuperNinjaFat commented 3 years ago

Allow us to redefine level entrance and exit specific variables.

There may be certain scripting scenarios involving entrances and exits that are more elaborate than simply manipulating the LOGIC_DOOR entities created from level generation. For instance, entities spawned upon starting a level (spelunkers, the starting torch on dark levels, the skull/pot that spawns by the entrance) do not spawn during the set_post_tile_code_callback() phase while LOGIC_DOOR and its associated entities do. Since this is the case, we are unable to define a spelunker's spawn location at this stage of level generation. Below are some exit/entrance related requested variables:

Mr-Auto commented 3 years ago
* When the compass is equipped, the arrow points towards the exit door(s) (or the mothership entrance when the alien compass is equipped)

compass works by attaching ENT_TYPE_FX_COMPASS to the LOGIC_DOOR, you can just kill it and attach it to whatever you want, same with alien compass = ENT_TYPE_FX_SPECIALCOMPASS

About the player spawn, ankh and tun, there is spawn_x/spawn_y in the plugin in LevelGen, you just need someone to expose them to lua. Oh also the hundun ankh spawn is door1_x/door1_y in exit_door_locations in the same place as the spawn

Mr-Auto commented 3 years ago

Order of options can we get some way to manipulate order of options made with register_option ?

Dregu commented 3 years ago

can we get some way to manipulate order of options made with register_option ?

They are in alphabetical order based on the key. Might not be the ideal way to order them, but at least it is a way to do it.

SuperNinjaFat commented 3 years ago

Allow us to define finite procedural spawns.

We can now define our own chance-determined procedural spawns; Now allow us to define unique guaranteed procedural spawns.

For example, spawning the locked chest in a random part of the level, the same way the golden key spawns.

SuperNinjaFat commented 2 years ago

Allow us to define multiple shop types in one level.

Currently in terms of shop definitions, we are limited to defining a custom room template type as a shop and to changing what type of shop spawns in a level. Allow us to specify what shop type is spawned for our custom shop-type room templates.

For example, creating a level with multiple custom shop-type room templates and assigning them a variety of shop types, such as a general store, clothing shop, hired hand shop, and dice shop.

MstrVLT commented 1 year ago

Overlunky has an udp sockets feature - I think it's a good idea to add support for tcpsocket

SuperNinjaFat commented 1 year ago

Allow us to define magmar spawn spots via scripting

According to JayTheBusinessGoose, state.logic_volcana has something to do with how magmar spawns are set. Expose this to the API so we can define the spots that magmars can spawn from.

A bonus would be allowing magmar spawns to be set and work in other themes, such as Temple, the City Of Gold, or Olmec.

SuperNinjaFat commented 1 year ago

Allow us to apply custom normal maps to textures via the scripting API

Our mod changes textures via script that need to be normal mapped.