[Script] RPG Mode (beta)

14 replies [Last post]
KoBeWi
KoBeWi's picture
User offline. Last seen 30 min 52 sec ago. Offline
Joined: 2010-12-25
Posts: 443

It should be known that I worked on a script for some time. I finally decided to do what I usually do: a rushed release. I originally started it even before 0.9.23, so it's high time to share it, since it's in usable state already.

So what is it about? Have you ever played Hedgewars and thought "oh, wouldn't it be cool if my hedgehogs had stats and levels and experience and stuff?"? No? Well, but it happened.

RPG Mode adds RPG elements to standard gameplay. Each hedgehog can gain experience to increase level and its' stats. Each hedgehog has also up to 3 different classes, which determine available weapons and some class combinations activate "Combos" which might have different effects.

You can download the script here: http://www.mediafire.com/file/eivj5a8z1398r1h/RPG_Mode.hwp

Disclaimer: the script is still in beta. It's not tested thoroughly and not balanced at all. Write any impressions/feedback/bug reports. Also I take suggestions too, because I'll be adding more combos.

==========INSTRUCTIONS==========

Each hedgehog has statistics. These are as follows:
level - experience level of the hedgehog, determines available classes
lifes - number of lifes left before hedgehog will actually die
health - max health hedgehog can have, also health it has on respawn
attack - additional damage each weapon deals
defense - damage reduction hedgehog gets
speed - number of actions hedgehog can take per turn

You can see stats of currently active hedgehog on mission panel (ESC). You can also see required experience to next level there. You can gain experience by dealing damage to ENEMY hedgehogs. Number of experience you gain is equal to base damage you deal.

Final damage is calculated as base damage + your attack - enemy defense ± 20% random variation. This overrides the damage you deal and is used to modify health. When hedgehog's health reaches 0, it will die and lose a life. Hedgehogs will respawn with their full health until their lifes reach 0, then they will die for real. When hedgehog drowns, instead of losing life, it will just lose 50 health. If you deal enough damage to make enemy health drop to -100 or below, you will get OVERKILL and your gained experience will double.

Each hedgehog can take only a number of actions equal to its speed. Weapons that end turn consume an action and once you reach the limit, you can't attack at all. Number of actions taken is shared between hedgehogs, however you can switch to hedgehog with greater speed for additional actions.

Important feature of RPG Mode are classes. Each hedgehog can have up to 3 of them and they are divided in tiers. You can get only one class per tier. You can get tier 1 class on level 1, tier 2 on level 5 and tier 3 on level 10. Your class determines available weapons and stat gains. Health increases by 50 per level, attack and defense by 10 and speed increases by 1 each 5 levels. When class has bonus for certain stat, the gain is increased by 50%. Stat gain from multiple classes is cumulative.

List of classes and their weapons/growth:
--Null-Tier--
Hedgehog

--Tier1--
Artilleryman: Bazooka, Mortal (+defense)
Grenadier: Grenade, Cluster Grenade (+defense)
Gunslinger: Desert Eagle, Shotgun (+attack)
Fighter: Fire Punch, Whip (+health)
Scout: Rope, Parachute, Mudball (+health)
Escavator: Jackhammer, Blowtorch (+defense)
Blazer: Flame Thrower, Molotov (+attack)
Bombarder: Air Strike, Drill Strike (+defense)
Glutton: Seduction, Cleaver, Cheese (+health)
Trapper: Mine, Sticky Mine, More Damage (+defense)

--Tier2--
Demolitionist: Dynamite, Cake (+attack)
Hitter: Baseball, Hammer (+health)
Infiltrator: Saucer, Portal, Bird (+health)
Engineer: Girder, Rubber, Mud Gun, Low Gravity (+defense)
Sniper: Sniper Rifle, Sniper Scope (+attack)
Incinerator: Napalm (+attack)
Cannon Fodder: Kamikaze (+health)
Coordinator: Plane, Vampirism, Mine Strike (+defense)

--Tier3--
Infernal Grenadier: Hellish Hand Grenade, Melon Bomb (+attack)
Time Lord: Teleportation, TARDIS, Extra Time (+health)
Sciencist: Sine Gun, Freezer (+defense)
Sacrifice: Piano Strike (+attack)
Lifegiver: Invincibility, Ressurection (+health)
Barrager: Minigun, Ballgun (+attack)

Another important concept are combos. Certain class combinations yield combos, that affect weapons and gameplay. It's important to plan your growth to not only get desired weapons, but also take advantage of some powerful combos.

List of combos:

Blazer + Demolitionist = Fiery Dynamite - dynamite explosion creates fire
Artilleryman + Strategist = Triple Missiles - bazooka and drill shoot 3 missiles at once
Artilleryman + Coordinator = Mortar Plane - RC plane drops mortar missiles
Blazer + Incinerator = Longfire - fire lasts 3 times longer
Sniper + Sciencist = Chained Sine - when Sine Gun hits, it will create another sine seeking close enemies in a chain reaction
Blazer + Incinerator + Barrager = Balls of Fire - Ballgun balls will leave flames
Grenadier + Demolitionist + Barrager = Melongun - Ballgun shoots melon pieces instead of balls
Glutton + Hitter = Cheesy Hammer - using hammer will also drop cheese in created hole
Gunslinger + Sniper = Amplified Sniper - sniper gun damage is increased
Cannon Fodder = Kami of Life Stealing - when enemy is killed with Kamikaze, attacker doesn't lose life
Trapper + Time Lord = Teleporting Surprise - using Teleportation will leave a mine behind
Escavator + Engineeer = Tool Master - using tools doesn't consume action
Trapper + Coordinator = Psi Thorns - attackers get damaged when this hedgehog is attacked
Grenadier + Infernal Grenadier = Melon Party - melon pieces are doubled
Escavator + Sacrifice = Eternal Sonata - Piano jumps all the way down to water
Cannon Fodder + Lifegiver = Non-kamikaze Kamikaze - using Kamikaze doesn't cost life at all
Coordinator + Lifegiver = OUR Health - Vampirism heals whole team
Engineer + Barrager = Ballproof - gives invulnerability while Ballgun is in use (until last ball explodes)
Bombarder + Scientist = Ion Cannon - Air Strike fires a laser beam that obliterates everything below

Well, that's it. I will be adding more combos and make tweaks and balancing etc. also based on feedback. Have fun.

KoBeWi
KoBeWi's picture
User offline. Last seen 30 min 52 sec ago. Offline
Joined: 2010-12-25
Posts: 443

So, this happened: https://pastebin.com/u7KPQ3b8

Scripts desyncs in multiplayer for some reason :/

nemo
nemo's picture
User offline. Last seen 1 hour 55 min ago. Offline
Joined: 2009-01-28
Posts: 1621

KoBeWi allegedly wrote:

So, this happened: https://pastebin.com/u7KPQ3b8

Scripts desyncs in multiplayer for some reason :/

so typically to learn anything useful about a desync logs from both parties are needed and ideally a demo too. However I don't see the word lua anywhere in that pastebin? Are you sure you loaded a script? And as for script desyncs in general, feel free to pastebin the exact version of script you have, can look over it for problematic operations. Unsynced randoms, use of values that aren't same between parties, floating point math...

And, you're versioning your scripts right?

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

KoBeWi
KoBeWi's picture
User offline. Last seen 30 min 52 sec ago. Offline
Joined: 2010-12-25
Posts: 443

nemo allegedly wrote:
so typically to learn anything useful about a desync logs from both parties are needed and ideally a demo too.
Ah, right. I can give that, but not now.

nemo allegedly wrote:
And as for script desyncs in general, feel free to pastebin the exact version of script you have, can look over it for problematic operations.
We used exact same script I posted here. If you want Pastebin version: https://pastebin.com/Lx62UF7t

EDIT:
Logs and demos: https://ufile.io/edi5x

nemo
nemo's picture
User offline. Last seen 1 hour 55 min ago. Offline
Joined: 2009-01-28
Posts: 1621

Ok. Yeah. That script will desync.
Can't use Lua floating point math operations.

All those atan and cos operations will desync. We pretty much forbid that kind of operation on non-visual-only lua effects.

The only safe things to do in lua math IMO is addition, subtraction, multiplication of integers (so long as value is less than 2⁵³-1 same as javascript), division by a power of two. Do not send the engine any non-integer values for gears - visual gears are fine.

For division by non-power of two use div()

We'd have to expose the engine's fixed point math to avoid that issue that plagues deterministic lockstep games.

I'd suggest you reconsider how you are implementing triple missile. Maybe set hog angle and force 3 rapid fires.

Otherwise need to expose all of uFloat

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

KoBeWi
KoBeWi's picture
User offline. Last seen 30 min 52 sec ago. Offline
Joined: 2010-12-25
Posts: 443

Uh ;_;
But the script desynced right at the beginning. Not sure where.

nemo
nemo's picture
User offline. Last seen 1 hour 55 min ago. Offline
Joined: 2009-01-28
Posts: 1621

Well the game log you sent didn't even load a script so maybe someone was missing a copy. But yeah, even without that it is unworkable at present

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

KoBeWi
KoBeWi's picture
User offline. Last seen 30 min 52 sec ago. Offline
Joined: 2010-12-25
Posts: 443

v2 uploaded.
-fixed error spam in OnGameTick20
-fixed hedgehog switching
-fixed some combo-related crashes
-experience per level reduced
-fixed stat updating
-potentially fixed bug where hedgehog's weapons didn't load on new turn

Seems like v1 was totally unplayable due to some bugs. Floating numbers aren't fixed yet. Also, my desync was caused by wrongly named script xd

nemo
nemo's picture
User offline. Last seen 1 hour 55 min ago. Offline
Joined: 2009-01-28
Posts: 1621

Well, you're using InfAttack so setting angle and forcing fire 3 times should work pretty well. Players prob wouldn't even notice a difference if it was within a few onGameTick/onGameTick20

If you weren't using InfAttack, using mudballs to collect the 3 dx/dy would probably work too (fire them then delete them, they wouldn't burn a turn)

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

nemo
nemo's picture
User offline. Last seen 1 hour 55 min ago. Offline
Joined: 2009-01-28
Posts: 1621

Oh, a thought KoBeWi - what if you just used a 1024 item Angle to integer Dx Dy mapping (or sin table whatever) ?
We should probably have that in the helper lua libs anyway. Pregenerated, no more desyncs.

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

UltiMaxKom
UltiMaxKom's picture
User offline. Last seen 2 weeks 5 days ago. Offline
Joined: 2016-06-26
Posts: 349

@KoBeWi Ooooooooh :OOO !!!

Now this is a boom :OO!
Even for a Beta Release :O!
Congrats bruh! Now let's see what you got on your RPG!
Hehehe =D

And about the features you've spoils, make me think that our project shares some major features, er... Kinda downfall for me because I've implemented many things already, can't put them down now =/. So in case if one wonder what are those similarities, I think mine and yours has (Note: haven't tried yours yet):

Quote:

*"C." Stands for "Custom"

C. Lives system
C. Health system
C. Damage system
Level system
Experience system
Stats system (Mine has STR, END, AGI, SPD, INT, WIS, ATT, DEF (RPG player surely know what's these))
Limited action system (Mine called AP - Action Points)


Then some other stuff idk--yet about, lemme check your awesome RPG game first =)

Also
A boat mine, uh...
Well, it's sad mine won't come out any soon, nor in distant future I say =[
Damn tho, I can't even get my main engine done thanks to arrr,,, hiatus ;_;
Maybe because my project is toooo ambitious and welp, real overkill (it's not meant for a casual game so yeah, it's super complex). Dunno if I could be on par or even get along the majestic release of your finished RPG next on, uff... At least it'll be over 0.9.25, waiting for devs' implementing the visual gear resizing feature duh! (thanks nemo =]])

Then talking about the crash, now I know what nemo meant by not using float values over non-visual gears works, if that is the cause ofc. I hope your next more awesome release get rid the multiplayer crash so us Hedgewarriors may know how powerful a will and a notepad++ can be! Hehe ^^

EDIT: It makes me amazed by looking at your script. I mean, yours has ~24000 character length and ~700 lines using only one single script (atm) yet mine already on ~74000 lengths and ~2400 lines just for the core script excluding 14 libraries it already used (O O) yet there's more to come because I believe it hasn't reached half the way of completion yet, the heck!? Like, yours are so awesome, but only using that little spaces? But mine that uses about a hundred of thousand of length won't even impress myself, what a bump =[
Uff...

EDIT2: You wrote "Melongung" in the combos part, just curious is this an intention? Although it won't be necessary to be a thing or smth hehe

EDIT3: As we may add feedbacks, then don't mind if I do hehe

Hi allegedly wrote:

(idk but imho one word weapon sounds better, sometimes)

Fiery Dynamite -> Incineration (at least a logical choice)
Tripple Missiles -> Tripodiac (give me some slack)
Mortar Plane (Mortal Plane eh? xD) -> Terrabomb (idk...)
Longfire -> Ablaze (uh?)
Chained Sine -> Sinelink (uh^2?)
Balls of Fire (hubba-hubba!) -> Fireballs (wut?)
Melongun (right?) -> Melongun (your welcome...)
Cheesy Hammer -> Greenslap (I have no idea why)
Amplified Sniper -> Metaljacket (it makes me hard)
Kami of Stealing Life -> Eye4Eye (oh cmon me)
Teleporting Surprise -> Pikaboom! (eh...)
Tool Master -> Architect (let's build a wall)
Psi Thorns -> Thorn (100% original)
Melon Party -> Meloniac (Maniac, said Patrick)
Eternal Sonata -> Pianist (uff)
Non-kamikaze Kamikaze -> Bomberman (don't overthink this one)
OUR Health -> Tetheralism (Absurbism, Phobianism, Nonsensism, etc x))
Ballproof -> Ballproof (okay?)
Jingle Cannon -> Memestorm (4lyfe)

PS: This is a feedback, not a police, and haven't repeated yet *cough*

( 'ಠ_ಠ)▄︻̷̿┻̿═━一 ̿̿ ̿̿ ̿̿ ̿'̿'\̵͇̿̿\з= ( ▀ ͜͞ʖ▀) =ε/̵͇̿̿/’̿’̿ ̿ ̿̿ ̿̿ ̿̿ ᕙ(⇀‸↼‶ )ᕗ

KoBeWi
KoBeWi's picture
User offline. Last seen 30 min 52 sec ago. Offline
Joined: 2010-12-25
Posts: 443

v3 uploaded:
-new t3 class: Barrager - uses Minigun (moved from Demolitionist) and Ballgun (moved from Scientist)
-Extra Damage moved to Cannon Fodder
-experience required for each level is now increased by 10 instead of 50
-added some floor()s
-class storage is rewritten, now Hedgehog can have infinite number of classes
-you can get 4th and consecutive classes at level 15 and every next 5 levels (right now classes can repeat)
-Infiltrator now has health bonus, instead of attack
-new combo: Ion Cannon

I played few rounds with the mode and every single one of them ended with a draw, due to lack ground for respawning XD Also, in every round there was this one hedgehog that was totally OP. Minigun is able to easily deal 2k overkill, because each shot deals over 100 damage when attacking high vs low level XDDDD
Yeah, it needs balancing.

nemo, I don't know how to map dx/dy to angle nor how to get a sine table (other than hard-coding it).

Ulti, they are not "weapon names", but "combo names", which IMO are perfectly fine with more than one word. I like Pikaboom tho, but forgot to include it in this version.

btw, I switched from Notepad++ to VS Code.

nemo
nemo's picture
User offline. Last seen 1 hour 55 min ago. Offline
Joined: 2009-01-28
Posts: 1621

Heh. Kobewi. Most trivial way for you to generate an Angle to dx/dy table would be to make a lua script to generate all angles, fire a mortar, and print out the dx/dy Big Grin

That is, set infattack and invulnerability, set hog angle, fire mortar, note down dx/dy, set angle, fire mortar, note down dx,dy...
Might need some delays in there since odds are some angles would kick the hog regardless of the map (straight up, or anything near horizontal). Just trigger next firing once hog stopped moving I guess.

Hm... I suppose if you used a mudball you wouldn't need to worry about hog moving or inf attack. Just need to be sure to give it enough power to get a nice value for the lua. Gravity and wind don't matter at spawn.

Ofc you'd only really need a quarter of the angles.

But yeah. At that point you could easily spawn gears flying any old place depending on hog aim.

Speed could be controlled ofc by div()/mult of both dx/dy by same integer scale.

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

UltiMaxKom
UltiMaxKom's picture
User offline. Last seen 2 weeks 5 days ago. Offline
Joined: 2016-06-26
Posts: 349

KoBeWi allegedly wrote:

v3 uploaded:
-new t3 class: Barrager - uses Minigun (moved from Demolitionist) and Ballgun (moved from Scientist)
-Extra Damage moved to Cannon Fodder
-experience required for each level is now increased by 10 instead of 50
-added some floor()s
-class storage is rewritten, now Hedgehog can have infinite number of classes
-you can get 4th and consecutive classes at level 15 and every next 5 levels (right now classes can repeat)
-Infiltrator now has health bonus, instead of attack
-new combo: Ion Cannon

I played few rounds with the mode and every single one of them ended with a draw, due to lack ground for respawning XD Also, in every round there was this one hedgehog that was totally OP. Minigun is able to easily deal 2k overkill, because each shot deals over 100 damage when attacking high vs low level XDDDD
Yeah, it needs balancing.

nemo, I don't know how to map dx/dy to angle nor how to get a sine table (other than hard-coding it).

Ulti, they are not "weapon names", but "combo names", which IMO are perfectly fine with more than one word. I like Pikaboom tho, but forgot to include it in this version.

btw, I switched from Notepad++ to VS Code.


First part:
Congratulations :OOO!!! And... RPG.v3 already? I'm not even reaching Au.v1e-10 yet!? It's poor me then x(

Second part:
Oh, combo names...
Didn't realize that xD good job left brain! (I've just said "(idk but imho one word weapon sounds better, sometimes)" which pin them mistake in my feedback). Anyhow, it's all great then :3

Last one:
BUT WHY D;?
Notepad++ is all Cool++! Give me some reason before you say goodbye *sob*! (so I may compare between two, in case if my uncanny betrayals take hold *lol*). If not, I would say...
It's treason then

Last one++:
Have a good day n' night ^^

( 'ಠ_ಠ)▄︻̷̿┻̿═━一 ̿̿ ̿̿ ̿̿ ̿'̿'\̵͇̿̿\з= ( ▀ ͜͞ʖ▀) =ε/̵͇̿̿/’̿’̿ ̿ ̿̿ ̿̿ ̿̿ ᕙ(⇀‸↼‶ )ᕗ

KoBeWi
KoBeWi's picture
User offline. Last seen 30 min 52 sec ago. Offline
Joined: 2010-12-25
Posts: 443

UltiMaxKom allegedly wrote:
BUT WHY D;?
Notepad++ is all Cool++! Give me some reason before you say goodbye *sob*! (so I may compare between two, in case if my uncanny betrayals take hold *lol*). If not, I would say...
It's treason then
Uh, well >_>

I sometimes use Unity, which uses Visual Studio for scripting, which is a terrible program, because takes lots of space and loads long time and stuff. It also has Mono, which is even worse (total garbage). Then I discovered there's a thing like Visual Studio Code, which is open source, A LOT smaller than standard Visual Studio and pretty light-weight. I used it for Unity and its usability just struck me. It's just more polished than Notepad++, e.g. intending and auto-complete works better. I never used auto-complete, but in VS Code it's so flawless, that I have it turned on even for Ruby and LUA. Well, VS Code just has some stuff that Notepad++ doesn't and does some things better. So, um, I just replaced my Np++ with this ¯\_( •_•)_/¯
Not saying that Np++ is bad. It's really a good code editor, but was just lacking for me in some areas.
/offtopic

Copyright © 2004-2017 Hedgewars Project. All rights reserved. [ contact ]