Git Product home page Git Product logo

ascii-fantasy-tactics's People

Contributors

przem360 avatar

Watchers

 avatar

ascii-fantasy-tactics's Issues

Turn order

Possible turn playout idea:

move av
 > to where? __
f20
attack av
 > who? __
g1

AI: look around and move

Make monster to check neighbouring fields - see #15 if no fighter around then move towards targeted fighter.

Resseting Initial positions

Fighters positions are not coming back to defaults after battle, so fighters when starting next battle are placed where they have ended a previous one.

Investigate chase_fighters()

Sometimes monsters are send to position 0,0.
Probably because chase_figters() can sometimes set finalx and/or finaly to 0.
Need to check if these values are 0 and if so, set them to original .x_position and .y_position.

defs.h

#define RANGE_CHAR "+"
const char commands[6][6] = {"move", "attack", "use", "end", "skip", "quit"};
/* First letters of commands should be also legal aliases.
Need to convert input to lower case before checking. */
const char alphabet[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};

Test dice

Test how "random" dice really is.
Consider using time.h to seed srand(); with current time.

Room 22 breaks exploration loop

Like in title, entering room 22 breaks exploration loop and goes to intro.
Reason:

while (current_location != 22 && qresult != 0 && game_mode == 2) {
...
}

(textadventure.c, line 177)

Ranged attack for archer

For now attack works only on adjacent areas.
Function player_action_attack(); needs to test if PC has a ranged weapon (pcs[i].weapon, weapons[i].ranged), if it has draw range based on weapons[i].range.

AI: Basic movement

After calling draw_monster_range() loop thru screen array ang get coorinants of every RANGE_CHAR to array available_moves[20][2].
Loop thru available_moves and calculate coordinates from every point to targeted fighter. If currently calculated distance available_moves[i][j] is smaller then previous one then save the new one.
Move monster figure to the place where it will be in closest position to targeted fighter.

Check if spell is available

If currently selected fighter has no spells, command cast should return an information.
Casting a soell should be posible only if currently selected fighter has this spell.

helpers.c rename

File helpers.c should be renamed and broken to battle.c and battle.h.

stack smashing detected

When in battle mode program sometimes crashes while monsters are taking first move.
GDB:

*** stack smashing detected ***: terminated

Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=140737351489344) at ./nptl/pthread_kill.c:44
44	./nptl/pthread_kill.c: Nie ma takiego pliku ani katalogu.
(gdb) backtrace
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737351489344)
    at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737351489344)
    at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737351489344, signo=signo@entry=6)
    at ./nptl/pthread_kill.c:89
#3  0x00007ffff7dbe476 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/posix/raise.c:26
#4  0x00007ffff7da47f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff7e05676 in __libc_message (action=action@entry=do_abort, 
    fmt=fmt@entry=0x7ffff7f57943 "*** %s ***: terminated\n")
    at ../sysdeps/posix/libc_fatal.c:155
#6  0x00007ffff7eb278a in __GI___fortify_fail (
    msg=msg@entry=0x7ffff7f5792b "stack smashing detected")
    at ./debug/fortify_fail.c:26
#7  0x00007ffff7eb2756 in __stack_chk_fail () at ./debug/stack_chk_fail.c:24
#8  0x000055555555aac3 in ai_choose_action (
    mid=0x555555561a7f <selected_monster> "b1") at asciibattle.c:1235
#9  0x0000000400000002 in ?? ()
#10 0x000000020000000b in ?? ()
#11 0x0000000c00000005 in ?? ()
#12 0x0000000600000002 in ?? ()
#13 0x000000030000000d in ?? ()
--Type <RET> for more, q to quit, c to continue without paging--c
#14 0x0000000900000003 in ?? ()
#15 0x0000000400000003 in ?? ()
#16 0x000000030000000a in ?? ()
#17 0x0000000b00000005 in ?? ()
#18 0x0000000400000004 in ?? ()
#19 0x00007fff00000009 in ?? ()
#20 0x0000000000000000 in ?? ()
(gdb) 

GDB points at variable selected_monster passed to the ai_choose_action().
Valgrind points to: chase_figters() called from the ai_choose_action().

Investigate Monsters x_position and y_position

Might be related to issue #19
After targeting first monster gets wild x_position value, sometimes.
May be caused by chase_figters();
Monsters targetting starts in weird coordinants.
Maybe coords[0] and coords[0] must be also set to 0 before use?

sleep on Windows

At least, must note how to pause in Windows/DOS:

#include <dos.h>

... 
    sleep(5);

Init function

Inside of helpers.c should be function called init();, to provide initial setup. Function should be invoked in main() before the game loop.

void init() {
    printf("ASCII FANTASY TACTICS");
    memcpy(screen, lvl1,sizeof(lvl1));
    place_figures();
    draw_interface();
}

AI: draw_monster_range

Need draw_monster_range(); function. Identicalbwith c mode in the draw_range();. Monster should perform an attack on first fighter found in range.

Fighter selection indicator

Arrow indicating selected fighter or active monster should be added to side_panel.

###################### Monsters:
#....................#   [g] [G1] Fred  (Goblin) HP:4 
#....................#   [r] [R1] Rogue (Human ) HP:5
#..##................#   [t] [TW] Tentacle Worm  HP:14
#..##................#   [f] [BF] Black Flan     HP:50
#....................#
#.............##.....#
#.............##.....#
#...+................#
#..+++...............# Fighters:
#.+++++..............#   [A] [AV] Avery (Fighter) HP:8
#+++++++.............# > [K] [KK] Koko  (B. Mage) HP:6
#+++AKMZ.............#   [M] [MA] Marsh (Archer ) HP:6
######################   [Z] [ZK] Zok   (W. Mage) HP:8

MARCHE
Fighter MV:4 HP:8 AC:4 MP:2

> move to __

Quitting battle in adventure mode

After hitting q during the battle, the battle quits but player stays in adventure mode. Quitting battle should always end with going back to welcome screen.

Make Monsters more agressive

In the ai_choose_action();, at the end, in the else block should toss a coin dice(2); and eventually attack fighter in range instead doing chase_figters();.

Indicate death

HP should be set to zero when it drops below zero.
When HP becomes zero board representation (.letter) should change to ~ and dead one should be out of the turn queue.

AI

Basic AI idea

Does monster have target? If not, choose.
Walk towards target.
Is target in attack range?
If yes - attack, if no, pass turn.

Every next turn.
Does monster have a target?
How far this monster is from its target?
Is there some Fighter closer (first found is enough)?
If there is 60/40:
60: take closer fighter as a new target.
40: keep following original target.

That's it. Not every fighter has to be targeted.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.