game-design-driven / Create-Prepare-to-Dye

Create: Prepare to Dye an opinionated, minimalistic modpack centered around complex and interesting automation.
GNU General Public License v3.0
23 stars 19 forks source link

Animation Library #496

Open Discord-Github-Bridge opened 4 months ago

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Tulkin wanted to make an animation library - but as he is busy it has fallen on us to pick up his burdens 💪 We must not disappoint

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

What are we animating? We're animating create:contraptions by setting their nbt to a certain premade-structures

How are is the nbt data for the structures created? Right now they're hard coded. Could we put these into a file and read them. (Has to be a json; or we add a read function to ptdye-plus)

What is animated currently? What does it do? Right now; the only thing it really does is handle the "opening" sequence of the trading platform. Which requires it increasing by Y amount every tick until it reaches the desired height where it is then made solid from the create:contraption

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

What is needed?

We need a way to smi-quickly define structures and their animations and be able to call them through lets say a minecraft command.

Basically we need three main things

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

How bad is generating json from nbt or vice versa?

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

If we can hold the structure data in an object at runtime that will be the best

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Well we can just have a single string field

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

Well but I want to manipulate it

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

So that's not that good

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

mhm

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

I think making nbt from json could work, kjs has some helper functions that we can highjack

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

But making json from nbt...

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

Which we need if we want to build something and use it instead json define each block

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

So define each block as an json object?

[
  { "blocka": "dirt", "nbt":"{\t"I_am\":\"dirt\"}" },
  { "blocka": "container", "nbt":"{\"insertdata\":\"${here}\"}"
]
Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

I think the biggest issue is creating these structures in a readable-or even an editable format

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Since; in nbt world the position is a hash of the 3 axises

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Oh; there's NBT.toJson() function in kjs globals. No idea what it actually does

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

https://github.com/KubeJS-Mods/Rhino/blob/1.19/main/common/src/main/java/dev/latvian/mods/rhino/mod/util/NBTUtils.java#L403

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

But there's no fromJson function

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Ah; there's fromTag which has an edge case for the json format

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Update time (mostly for self-reflection) I found how to find glue. Which doesn't sound exciting... BUT with this new found power instead of making nbts with limited knowledge. You can make a build; select it with glue and BAM we can find it in code to convert it into all the things we need to do https://github.com/EngineerSmith/Create-Prepare-to-Dye/blob/animation/kubejs/server_scripts/base/animation/commands.js

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Update time Been busy (and got distracted with 'art' so now there's a new painting in the game).

Made a block that can be placed next to 'glued' structures. So that when you right click it, it saves the time of having to type any commands as it can all be done with a click. It will then highlight (similarly to glue) the connected blocks of the structure so the builder can check that everything is correctly included.

Current issue is that I found BlockEvents.rightClicked is being triggered twice in a row. Not sure what is causing it as it seems they're both running server side; so it's not running once on client and then on server... I'll have to keep looking into it.

Anyway; once this is done. I think adding some sort of interface (<:cry:1184476833090113606> ) for naming the structure. Then some sort of item, which you can link structures together and start animating them (without affecting the already built ones - think ghost blocks of create's schematics)

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

Twice one for each hand!

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

Check if main hand and it should work

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

I seems like you are making it player facing, that sounds like a lot more work

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Mhmm; not really. I think this will be the best way to make it useable than having commands and trying to figure out positions.

I got rid of the UI idea for naming; and just using name tags (named on anvils)

You could purely do it with commands sure; but I think having no visuals will cause it to be harder to animate

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Just trying to make it UX friendly than end user friendly

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Also

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

The end results will be "two" systems which work together

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

1st the creation of the animation; which will produce a json of keyframes (with functions like lerps to positions, and actions like adding/removing blocks (e.g. upside down fire)) 2nd reading the jsons and putting them into action when it's called for it

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

makes sense. i like

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Do you know how to add block entity values to jade? So they show when you look at the block?

Discord-Github-Bridge commented 4 months ago

yarden.zamir on Discord says

not sure but kikis2111 did something similar with the ponder tooltip thing maybe he knows

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

yarden.zamirWhat's the mod that allows you to shift+click to pick up a block entity? And do you know how I can blacklist my block? If you don't know I can look into it

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

You know your luck for a simple solution is out when you find autistic.sack.of.friends asking a similar question https://discord.com/channels/303440391124942858/1149285329417797672/1149285329417797672

Discord-Github-Bridge commented 4 months ago

kikis2111 on Discord says

Yeah its possible with the jade api if you add on to the java mod

Discord-Github-Bridge commented 4 months ago

autistic.sack.of.friends on Discord says

json serialization isn't so bad, but not terribly efficient

Discord-Github-Bridge commented 4 months ago

kikis2111 on Discord says

Code in these files is related: https://github.com/jasperalani/ptdye-plus/tree/main/src/main/java/com/kikis/ptdyeplus/integration

Discord-Github-Bridge commented 4 months ago

autistic.sack.of.friends on Discord says

i don't know if it works for blocks

Discord-Github-Bridge commented 4 months ago

autistic.sack.of.friends on Discord says

probably not...

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

I need the block position every frame

Discord-Github-Bridge commented 4 months ago

autistic.sack.of.friends on Discord says

can't you just store a time and an animation id

Discord-Github-Bridge commented 4 months ago

autistic.sack.of.friends on Discord says

and an origin

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

This is for the blocks within the structure

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

OHH big brain moment

Discord-Github-Bridge commented 4 months ago

autistic.sack.of.friends on Discord says

isn't that a default feature of create structures...

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

I can just send the client aabb information and then let the client find the blocks instead of storing the blocks in nbt/entity data

Discord-Github-Bridge commented 4 months ago

autistic.sack.of.friends on Discord says

is it that reliably ordered...

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

While it won't be the most accurate; it should work fine as it'd use the same create function as the server is doing

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

and order doesn't matter for this

Discord-Github-Bridge commented 4 months ago

autistic.sack.of.friends on Discord says

i meant if the bounding box thing runs after the blocks are placed

Discord-Github-Bridge commented 4 months ago

engineersmith_4628 on Discord says

Imagine create glue visual outline; do you notice it lagging as it only draws 1/20 a second than the frame rate