Github Fork: Ranged Weapons, Monsters follow player and/or flee.

Discussions of the development process of the game.
Post Reply
User avatar
twirlimp
Posts: 204
Joined: Wed Dec 30, 2015 8:00 am
android_version: 4.3

Github Fork: Ranged Weapons, Monsters follow player and/or flee.

Post by twirlimp » Thu Dec 31, 2015 10:10 am

I made some modifications to the game.
Here is the fork on Github.

Here's the Dropbox folder for the apk files.
Make sure to select the newest file.

Instructions:
1- Press "Bows" to get the new weapons in your inventory. Equip one.
2- You will find a new icon in your toolbox. Press it to start aiming.
3- Long-press a monster to select it. Normal-Press anywhere to cancel.

Extra game preferences, starting from most automatic:
1 - enable "Auto Aim" -- to directly snipe monsters without needing to aim.
2 - enable "Press on Hero to Aim" -- to start aim by pressing the hero himself.
3 - change "Aim Button Position" -- to move the aim button from your toolbox to the HP bar.
Warning. This is a development release so you should backup your old saves. I test everything for cashes but you might find some bugs/features. Be warned.

I apologise if the features should have been in different forks,
but they seemed more related at the time.

Current Features
  • Line of Sight
Monsters have line of sight which determines whether attacked monsters will flee or move towards you.
  • Monster Rage.
When the player attacks a monster, it becomes enraged.
It will move towards the player during combat, but if the path is blocked it instead flees.
The monster will also follow outside combat for a number of turns.
  • Fleeing Behavior:
Monsters now flee when they reach a certain HP threshold (currently 20% by default).
If it's set to 0% then they will never flee -- kamikaze.
  • Ranged Weapons.
Currently there are three weapons that I made for testing, but anyone can create more.
Wooden Crossbow, Wooden Longbow, and Mighty Longbow.
Ranged weapons increase maximum attack range and decrease accuracy.
They also have a new Status Effect called "Minor Stun" which stuns and lowers enemy block chance for 2-3 turns.
They have another Status condition called "Exposed" which lowers the player's evasion and block chance. (soon)


How ranged attacking works.

See the instructions at the beginning of this thread.

Miscellaneous Features in same apk
  • Repetition in combat log. Messages that appear frequently will now show a (x2) at the end. or x3, x4, etc...
  • Inventory categories AND sorting. This should help find the new ranged weapons. Hint: They're under "weapons".
  • Skill list categories, so we won't worry anymore about having too many skills.
  • Skill list sorting by invested points & unlocked requirements.
  • Shop list sorting like inventory.
Relevant thread.
Last edited by twirlimp on Sun Jan 17, 2016 2:16 pm, edited 63 times in total.
ideas plox

User avatar
twirlimp
Posts: 204
Joined: Wed Dec 30, 2015 8:00 am
android_version: 4.3

Re: Github Fork: Monsters will follow the Player if attacks and flees

Post by twirlimp » Thu Dec 31, 2015 10:47 am

Update Log.
(Outdated; just read the forum posts :P)
January 5, 2016 wrote: 2 new ranged weapons (different range and accuracy). Current weapons are:
Wooden Crossbow: Max range increase by +2, accuracy decrease by 10%
Wooden Longbow: Range + 4, Accuracy -20%
Stronger Wooden Longbow: Range +6, Accuracy -30%
Weapon range now shows in item info.

Like before, will now automatically exit combat when fleeing if no monsters are adjacent.
(Used to be "if monsters inside attack range")
This is balanced because monsters now follow in real-time to compensate.

Monsters that follow player after combat will now give up after a limited distance.
Default rage multiplier in JSON data is now 1.0 so they will move towards the player's old location;
a value of 2.0 means they go double the distance of first attack.
0 means they will not follow at all.

Line of sight implemented to check whether monsters follow/engage when ranged-attacked.
Default in JSON data is 200 tiles. 1 makes them only respond to melee attacks. 0 makes them passive to attacks.

HP threshold that controls fleeing is now modifiable through JSON data.
Default is 0.2 so they flee at 20% hp or lower.
0 means that never flee, 1.0 means they flee as soon as they are attacked (still at 100% hp).

Fixes for teleport mode collision detection with monsters (still no clip with other tiles).

Debug: Removed button for +range because of new weapon types with diff ranges.
Removed button for "realtime following" because it is ON by default.

Will show messages when target is invalid or out of range (both inside combat, and also outside combat when in the immobile "safe aim mode").
January 3, 2016 wrote:
Limited Attack Distance for Ranged Weapons
Ranged weapons now have a property that decides what their attack range is.
The Wooden Longbow has an attack range of +2, which means it's +2 more than melee range.

Also, this property can be added to other equipment like rings or whatever in order to boost attack range.
(e.g. Eyeglasses that enhance vision, enchanted rings, etc...)
However, even if you wear "ranged" equipment then at least one of them has to be a weapon.
(you can't do ranged attacks with a sword if you have enchanted ring)

Ranged Attacks
Can now start ranged attacks without an "aim mode" (although the option can still be toggled to "need to aim" ).
This means that you just need to press on the monster,
and you will walk towards it and attack as soon as you are within range.

Combat Movement
If there are still attackable monsters within range then player will not auto-exit combat.
This means that monsters (that you have attacked) will be following you and the only way to end combat is to somehow make more flee-moves than them (or kill them).

Tip: you can currently change to melee weapons mid-fight in order to flee faster because of shorter attack range.
January 2, 2016 wrote: Slightly Better Fleeing AI:
Fleeing decisions properly separated from move/attack.
Tweaked the fleeing pathfinding a bit.

Monster Following
Not yet sure if monsters will follow player in real-time even after combat ends.
So I added a debug button that toggles real-time following for the outside-combat.
(turn-based following inside combat is always on)

Ranged Weapons
1- Added a new item and item category -- Wooden Longbow and rangedweapon_big, respectively.
The item categories can perhaps be better integrated by making it a separate field, for better modding possibilities and sorting capabilities.
But game-play wise, having only rangedweapon_big & rangedweapon_small is not too horrible.

2- Moving in ranged combat now flees the fight, which is how movement in melee also works.
Note that if "real-time following" is enabled, you will be followed outside combat, so staying in a fight is better than trying hit-and-run tactics.
January 1, 2016 wrote: Basic Fleeing AI:
Cleaned the code and fleeing is now almost a completely different function than move/attack.
(It used to be a hack to those two functions but I separated it).

Ranged Attacks
Outside Combat: Can move while wielding a ranged weapon,
but must activate an "aim mode" in order to use ranged attacks.
(Cannot move in aim-mode).


December 31, 2015 wrote:Basic Fleeing AI:
Current Limitation: Monsters only start fleeing when combat ends.
They will move away from player to any adjacent tile on opposite side.
They will not attack adjacent players even if attacked.

Ranged Attacks
Still only enabled thru debug buttons (eventually by weapon-wielding).
During combat: Aim by long-press on a monster.
Outside Combat: Aim by normal press on monster. Can not move while wielding a ranged weapon.
Need to unwield ranged weapon to exist combat screen.
Last edited by twirlimp on Fri Jan 08, 2016 4:35 pm, edited 17 times in total.
ideas plox

User avatar
twirlimp
Posts: 204
Joined: Wed Dec 30, 2015 8:00 am
android_version: 4.3

Re: Github Fork: Monsters will follow the Player if attacks and flees

Post by twirlimp » Thu Dec 31, 2015 10:48 am

List of undone goals by priority.

Soon:

[*] Add the option for NPCs to flee after a conversation ends.

[*]

Tentative???

[*] Should ranged attacks fail if there's something in between?
It's not necessary because when monsters can't find a path towards you then they flee away.
And also most bows have short ranges so it doesn't matter.

[*] Make cornered monsters stop fleeing and attack?
I coded the feature but not sure if people want it.

[*] Better fleeing behavior?
Currently they get stuck in corners. Good enough for forest animals, not good enough for humanoids.
It works well enough considering the map sizes in the game, just don't expect them to navigate a maze to flee you.

[*] Monsters decide to flee without being attacked?
e.g See him from afar and become scared from his power.
(Not technically fleeing, more like fear, or "anti-aggression".)
Last edited by twirlimp on Fri Jan 08, 2016 4:14 pm, edited 10 times in total.
ideas plox

User avatar
ace
Posts: 482
Joined: Sat Jun 21, 2014 4:00 am
android_version: 5.1
Location: lodar's hideout

Re: Github Fork: Attacked Monsters Follow Player when he Flees, Mons Flee when low HP, Basic Ranged Attacks Support

Post by ace » Thu Dec 31, 2015 2:50 pm

wow, nice work. but I wanted to chase the And/or (andor) not the monsters. but I really liked the idea of ranged attack. +10
the secrets of shadow and light#ace.
https://facebook.com/andorstrail
be happy :lol:

User avatar
twirlimp
Posts: 204
Joined: Wed Dec 30, 2015 8:00 am
android_version: 4.3

Re: Github Fork: Attacked Monsters Follow Player when he Flees, Mons Flee when low HP, Basic Ranged Attacks Support

Post by twirlimp » Thu Dec 31, 2015 4:29 pm

ace wrote:wow, nice work. but I wanted to chase the And/or (andor) not the monsters. but I really liked the idea of ranged attack. +10
Well I want it to be a small feature, nothing too fancy,
and I imagine it'll open up some new quest possibilities
(kill that kind grandfather and I'll teach you how to wield magic!!!)

Simply, when a ranged weapon is equipped, the ranged mode is activated (currently it's through a debug button).
The weapon calculations and everything else don't have to be changed at all.

On another note, the monsters now flee!
(At low HP and/or if they are a "coward" type,
And will not attack when adjacent to player.)
ideas plox

User avatar
twirlimp
Posts: 204
Joined: Wed Dec 30, 2015 8:00 am
android_version: 4.3

Re: Github Fork: Attacked Monsters Follow Player when he Flees, Mons Flee when low HP, Basic Ranged Attacks Support

Post by twirlimp » Thu Dec 31, 2015 4:45 pm

ace wrote:wow, nice work. but I wanted to chase the And/or (andor) not the monsters. but I really liked the idea of ranged attack. +10
May I ask what features you'd like me to work on?

I went through the forums but they're a bit stale,
and I'd like the opinion of "contemporary" moderators. :P
ideas plox

User avatar
ace
Posts: 482
Joined: Sat Jun 21, 2014 4:00 am
android_version: 5.1
Location: lodar's hideout

Re: Github Fork: Attacked Monsters Follow Player when he Flees, Mons Flee when low HP, Basic Ranged Attacks Support

Post by ace » Thu Dec 31, 2015 5:21 pm

well, here in forums ranged attacks is not very much supported b/c everybody doubt that if it will ruin the game. but the only method to know this is to implement this and I am you are trying on this.

IMO don't make ranged weapons too powerful and give NPCs extra high dodge chance based on their importance in the game against these weapons only. and if you feel that these weapons make the game too easy then you can give monsters extra ability like immune to missiles etc. there are really going to be so much options.

and if monsters are fleeing mid fight then it will be like real life, where you try to catch a dog but he runs away.

BTW happy new year everybody.
the secrets of shadow and light#ace.
https://facebook.com/andorstrail
be happy :lol:

User avatar
twirlimp
Posts: 204
Joined: Wed Dec 30, 2015 8:00 am
android_version: 4.3

Re: Github Fork: Attacked Monsters Follow Player when he Flees, Mons Flee when low HP, Basic Ranged Attacks Support

Post by twirlimp » Thu Dec 31, 2015 5:56 pm

ace wrote:well, here in forums ranged attacks is not very much supported b/c everybody doubt that if it will ruin the game. but the only method to know this is to implement this and I am you are trying on this.

IMO don't make ranged weapons too powerful and give NPCs extra high dodge chance based on their importance in the game against these weapons only. and if you feel that these weapons make the game too easy then you can give monsters extra ability like immune to missiles etc. there are really going to be so much options.

and if monsters are fleeing mid fight then it will be like real life, where you try to catch a dog but he runs away.

BTW happy new year everybody.
I'm mostly just adding them for fun.

Yeah ranged weapons will be mega-nerfed of course.
I'll make them extra-weak just to be sure it's balanced.

I could do many simple things to balance: make it double the AP cost,
1/2 the accuracy of melee,
and make distance short at first (like, 1 block extra every 20 levels).

That way, when starting out, the player can make two attacks before the monster reaches him (and can't move because AP is depelted),
and because 1/2 the accuracy then it'll be the same amount of damage at the end.
ideas plox

User avatar
rijackson741
Posts: 1517
Joined: Tue Aug 20, 2013 2:04 am
android_version: 6.0
Location: Somewhere in Dhayavar

Re: Github Fork: Attacked Monsters Follow Player when he Flees, Mons Flee when low HP, Basic Ranged Attacks Support

Post by rijackson741 » Thu Dec 31, 2015 11:01 pm

How do you choose a target, and what happens if there's something in the way (can I shoot round the corner of a building?)?
Level: 64, XP: 4734786, HP: 196, AC: 246%, AD: 49-59, AP: 3, ECC: 25%, CM: 3, BC: 127%, DR: 2
Gold: 232355 | RoLS: 1, RoL: 1, GoW: 1
HH: 1, CS: 2, IF: 4, Ev: 3, Re: 2, WP:DA: 1, WP:1S: 1, AP:L: 1, FS:DW: 2, S:DW: 1
SR

User avatar
Voom
Posts: 453
Joined: Sat Dec 19, 2015 5:24 pm
android_version: 4.4
Location: Fort Lauderdale, FL

Re: Github Fork: Attacked Monsters Follow Player when he Flees, Mons Flee when low HP, Basic Ranged Attacks Support

Post by Voom » Thu Dec 31, 2015 11:39 pm

I like it. I wish I had your ability for coding. I go to business school and will most likely learn only a very limited amount. I attempted mapmaking and completed several area blocks, they were awesome, but my brother started deleting unnecessary programs and defragging the computer and deleted everything, even Tiled! After that I was just angry and never attempted again.

Anyway, you could do far more than I could...for now. Keep it up.
Voomster Lvl 23 |HP 52 |AC 173% |AD 17-52 |ECC 20% |CM 3.0 |BC 61% |DR 2 Build 2/3221/0

Voomboy Retired at 41 and is reading The Fey of Feygard
Voom Retired at 46 and took up translating

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest