Page 1 of 1

adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sun May 10, 2020 5:10 am
by Enjl
Oh, what a doozy.
In development for the past 3 years, these libraries are like siblings, so I'm packing them together.
adversary takes care of the heavy lifting of completely lua-based boss enemies.
projectiles takes care of said boss's completely lua-based attacks and effects.

Included in the download is a demo.
https://drive.google.com/file/d/1I9pnlf ... sp=sharing
Spoiler: show
Image
Image
Here are a few paragraphs about what you can expect from each library. There's further documentation within the files, and the sample gives a solid overview over what each library lets you do.

Adversary:
Spoiler: show
Adversary is a boss library I started in 2017 for the bosses in my ongoing episode. Now that I have finished programming all the bosses, I think the library has evolved into a solid position for release. It has a lot of features for doing the heavy lifting for your bosses, but you the logic itself is something you will have to write yourself.
- Exposes onTick, onDraw and onHarm functions for you to use
- Includes a :draw() function that you can optionally use. If your boss is more complex, you might opt to choose to draw the boss yourself, however.
- Includes a harm type system that can distinguish between jump, slash, yoshi tongue, down slash, tail, as well as any NPC collision. Freely expandable using string-based harm types for custom collider-collider collision.
- Each harm type can have a damage multiplier.
- Includes a state system, in which a table mapping states to harm multipliers can be provided (e.g. "boss takes less damage when shielded")
- Includes a collider registration system, in which a boss can be assigned any amount of colliders, each with their own harm damage multiplier (weak spots, sour spots)
- Boss's hp drawing functions are overridable on a per-instance basis.
- Works with any amount of bosses simultaneously.
- Mininmal overhead
- Multiplayer support
Adversary is currently unable to natively provide harm types for the SMBX2 characters. However, you can cover those with the custom harmtypes on a per-boss basis, by calling boss:damage("Harmtype") when you detect a collision.
Also worth noting: The hpSlice sprite is drawn truncated. Feel free to try one wider than 1 pixel to see how it looks.

Projectiles:
Spoiler: show
Projectiles is a projectile library (duh) started before the new effect rewrite of SMBX2. The effect rewrite ended up taking a lot of ideas from it, and the library evolved in parallel to it.
The library serves as a lightweight alternative to using NPCs or effects for certain things. It handles keeping track of inidividual entities, as well as spawning them and managing their speeds. Drawing is not handled.
For handling drawing and logic, each list has an onTick and an onDraw function (see the sample) which are invoked for each entry in the list.
Furthermore, a projectile can optionally provide a kill effect that is to be invoked when the :kill() function is called.
The sample, what does it show?
Spoiler: show
The sample shows a boss fight against a Waddle Dee. It shows:
- Custom collision programming
- Sample of a state machine system with walk, jump and hurt states
- Custom hp bar drawing
- Multiple bosses
- Harm type registration
- Two projectiles, one with a custom harmtype collider that harms the boss
For a little reference to how easy this makes things: I wrote the sample in 3 hours this morning.

Re: adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sun May 10, 2020 5:15 am
by Eri7
Wow, that's an awesome system! It seems you have put a lot of thought in the creation of bosses to be so much easier for creators.

Re: adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sun May 10, 2020 9:36 am
by Taycamgame
Is the idea behind this toolkit meant to be a replacement of the traditional way to create lua bosses, or is it simply just another way of doing it?

Re: adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sun May 10, 2020 9:40 am
by Enjl
Taycamgame wrote:
Sun May 10, 2020 9:36 am
Is the idea behind this toolkit meant to be a replacement of the traditional way to create lua bosses, or is it simply just another way of doing it?
Not quite sure what you mean by "traditional way". Could you describe that way to me?

Re: adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sun May 10, 2020 10:54 am
by Taycamgame
Enjl wrote:
Sun May 10, 2020 9:40 am
Taycamgame wrote:
Sun May 10, 2020 9:36 am
Is the idea behind this toolkit meant to be a replacement of the traditional way to create lua bosses, or is it simply just another way of doing it?
Not quite sure what you mean by "traditional way". Could you describe that way to me?
I mean like, the normal way of creating lua bosses. You know, where you'd do it all yourself and whatnot. Without this kind of tool to do parts for you.

Is this tool supposed to just make it easier to create bosses in future?

Re: adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sun May 10, 2020 11:22 am
by Enjl
Taycamgame wrote:
Sun May 10, 2020 10:54 am
Enjl wrote:
Sun May 10, 2020 9:40 am
Taycamgame wrote:
Sun May 10, 2020 9:36 am
Is the idea behind this toolkit meant to be a replacement of the traditional way to create lua bosses, or is it simply just another way of doing it?
Not quite sure what you mean by "traditional way". Could you describe that way to me?
I mean like, the normal way of creating lua bosses. You know, where you'd do it all yourself and whatnot. Without this kind of tool to do parts for you.

Is this tool supposed to just make it easier to create bosses in future?
I think it's best to answer this with an analogy. Imagine you need custom collision in your level. You can either hardcode it all yourself, using coordinate checks and whatnot, or you could use colliders.lua. adversary.lua is that, but for bosses instead of collision. The underlying principle is the same (it's a table), you just don't have to reinvent the wheel every time.
That isn't to say that aversary is "the definitive" boss library. I know of a couple of other WIP episodes that have their own specialized boss libraries (because copying boss code between levels is a tad inefficient). It's just... I guess the first to be released.

Re: adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sat Aug 08, 2020 9:01 pm
by the lolie
i need a tutorial for this

Re: adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sun Aug 09, 2020 3:10 am
by Enjl
the lolie wrote:
Sat Aug 08, 2020 9:01 pm
i need a tutorial for this
A sample boss is included in the download. If you don't understand that, you wouldn't understand a tutorial. I recommend learning the basics of programming and lunalua. These libraries are frameworks that don't do any of the thinking of how to program AI for you, merely making the setup and common situations faster to handle uniformly.

Re: adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sun Aug 09, 2020 6:48 am
by the lolie
Enjl wrote:
Sun Aug 09, 2020 3:10 am
the lolie wrote:
Sat Aug 08, 2020 9:01 pm
i need a tutorial for this
A sample boss is included in the download. If you don't understand that, you wouldn't understand a tutorial. I recommend learning the basics of programming and lunalua. These libraries are frameworks that don't do any of the thinking of how to program AI for you, merely making the setup and common situations faster to handle uniformly.
i can't learn lunalua cuz wiki is outdated

Re: adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sun Aug 09, 2020 6:51 am
by Enjl
the lolie wrote:
Sun Aug 09, 2020 6:48 am
i can't learn lunalua cuz wiki is outdated
Wiki is outdated in parts but a lot of it still applies. On top of that there are general programming tutorials all over the internet, there's the handbook for when you need references for new features not present on the old wiki, and there's a lunalua tutorial video series you can find in the guides forum. Even if all those resources weren't there, SMBX2 is open source (you download the source code with the program) so it's always possible to learn something simply from examining what basegame actually does.

Re: adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sun Aug 09, 2020 6:55 am
by the lolie
im bad with video tutorials

Added in 1 minute 45 seconds:
i just want my custom npc to have multiple hp

Re: adversary.lua, projectiles.lua - Boss Toolkit

Posted: Sun Aug 09, 2020 6:59 am
by Enjl
This library has nothing to do with that. It's for creating pure lua implementations of bosses. Use lighthitpoint for adding HP to npcs. It's really, really easy to use. I can only give more specific help once you can present a piece of code you tried that didn't work as you expected it to.