Giter Site home page Giter Site logo

amarlon's People

Contributors

lgromanowski avatar lonski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amarlon's Issues

CmdPick - inventory is full

When picking an item there is no control of actor's inventory slots available. Item is picked from the ground, theres message which confirms it, but it is not present in actor's inventory.

Solution:
in CmdPick.cpp check if afContainer()->add(...) returned true. Otherwise put back item on the ground.

Spell effects

There is nice possibility to implement some 'asci graphical' effect of spell casting.

For example: magic missile spell could create X missiles and trow them as a '*' character at target:

or a fireball:

Door blocking

When there is any item laying at open door tile, it should not allow the door to be closed.

Default/random loot of monster

Besides inventory dropping, mentioned in issue #23 monsters should have possibility of dropping some default or random loot. It should be regulated by some configurable rules.

For example

<DropRule actorId="666" amountMin="1" amountMax="6" chance="0.1"/>

Lets say that Actor of id 666 is a gold coin. This rule says that there is 10% chance that monster will drop from 1 to 6 gold coins.

Container xml structure

At the moment xml structure of Container ActorFeature looks as follows:

<Container maxSize="5">
  <Content aid="13" amount="8"/>
  <Content aid="14"/>
  <Content aid="16"/>
</Container>

The Content is an entry which defines item present in container. However theres no possibility to customize the item. Theres possibility only to define amount of the default items. First of all, it is needed to answer the question if there should be possibility to customize actor features here (like it happens in maps.xml, look at #17). If yes, it should look as follows:

<Container maxSize="5">
  <Content aid="13">
    <Pickable stackable="1" amount="3"/>
    <Openable type="0" lockId="8" locked="1"/>
  </Content>
  <Content aid="14"/>
  <Content aid="16"/>
</Container>

Xml parsing clean up

There is need to refactor xml parsing in ActorDB and MapGateway. It is messy and ugly work code.

Timed effects

There are already implemented regular, instant effects. It is needed to implement timed effects also. Timed Effect should have configurable amount of turns, when it is active. After the amount of turns passed, it should be automaticaly removed.

Map xml interpreter

Current map xml structure:

<Maps>
  <Map id="1" width="100" height="60">
    <Tiles>
    TTTT
    T...
    ..TT
    </Tiles>
    <Actors>
      <Actor id="2" x="45" y="18"/>
    </Actors>
  </Map>
</Maps>

Single Map tag contains coded map terrian - tiles and list od actors which are present on map.

TODO: extend <Actor> tag, so the ActorFeatures can be overwritten. At the momment the actor is created "blank" and its data is loaded from default ActorDB. The goal is to allow overwriting ActorFeatures by adding particural tag in map xml file:

  <Map id="1" width="100" height="60">
    <Tiles>
    TTTT
    T...
    ..TT
    </Tiles>
    <Actors>
      <Actor id="2" x="45" y="18">
        <Pickable stackable="1" amount="15"/>
      </Actor>
    </Actors>
  </Map>
</Maps>

In example above Pickable feature is overwriten. All other should remain default.

EventHandler

EventHandler will be layer between Gui and Actors or Commands. When there is need to print a message in log, it should be done via EventHandler.

Example events:
Actor dies
Parameters: Actor killed, Actor atacker
Brief: prints message that actor have beed killed

Actor gives/recieves damage
Parameters: Actor atacked, Actor atacker
Brief: prints message that actor hits another actor

Actor picked up an item
Parameters: Actor who picks, Actor picked
Brief: prints message that item has beed picked

CmdPick refactor

Now, when generis Menu widget is implemented, ItemPicker could be replaced or strongly refactored to use this widget. Additionaly, I think, the key "take all" will be removed. instead, the window will not hide, until "esc" is pressed, so the user will be able to pick multiple items.

Moving between maps and 'World' container

For now there is only one, test map. The map data is fetched from MapGateway, which loads predefined maps from xml file (in future random generated maps wtith some preconditions will be added).

World container
At the moment MapGateway does not return copy of a map, but gives pointer to loaded one, so MapGateway is also a World container. Maybe better way would be that MapGateway holds default maps, and returns copy of it when map is fetched, and then store modified maps in some other World container. Then, when game is saved, we save only modified maps to save game file.

Moving between maps
I know about three map change cases:

  1. Stairs up/down - it should be Actor with '<' or '>' character, and player will use command to use the stairs
  2. Moving to edge of map, wihich is part of bigger area (wilderness, big city, etc) - triggered by moving to the edge, there should be quote if player wants to change map
  3. teleportation - a special tile that teleports (for example trap) - tbd.

Window Manager

WindowManager should haldle gui windows creation, destruction. The windows should not be created localy (for example PickupWindow in CmdPick), but accessed via manager. The manager will also have access to configuration and will set the windows max sizes.

Configuration file

Create game configuration file and load it into some configuration structure. The configuration should replace glodef.h.

For now, there is a few config information to be placed there:
-map maximum width/height
-right panel width
-bottom panel height

ScreenHeight = map_maximum_height + bottom_panel_height
ScreenWidth = map_maximum_width + right_panel_width

Consoles sizes:
-right bar
-log console
-item view console

Equipment - wearing items

Define player equipment system, maybe it could be created via another ActorFeature, like "Wearer" which will define available wearing slots. It could have also contain methods for equipping items.

There is also question if equipped items should be moved to another container "equipped" or stay in main actor container and have some kind of 'equipped' flag.

Actor Actions

Unify actions performed by actors by defining generic ActorActions. The 'Commands' are bound to the player - they are triggered by user input and are triggering gui actions too. They can be used only for Actor::Player. ActorActions will fit to any actor.

Actor will provide an interface to perfrom actions:

bool performAction(ActorActionPtr action);

For example to move player, a MoveAction has to be created and passed to above funtion.

TargetSelectors

Currently there are implemented following Target Selectors:

  • SingleNeighbourSelector - selects actors on one of neighbouring tile
  • ExecutorSelector - selects executor

A few more selectors have to be implemented:

  • SingleRangeSelector - selects actors in a tile within some range.
  • AreaRangeSelector - selects actors in specified radius within some range
  • AreaNeighbourSelector - selects actors in radius, where executor is in center of the circle

At the momment those selectors are used in CmdUse.

Raw pointers -> smart pointers

I don't know why I did not used smart ptrs from the begining. But I think it is not too late to intruduce them now, and replace raw pointers with them. It is better to store shard_ptrs in std containers than raw pointers and I noticed that std::copy and std::copy_if is not working properly with containers holding raw pointers.

Actor statistics

I'd like to use Dungeons & Dragons system. I did not yet specified version, but I think the newest one should be used. There is much to think about possibilities how the system could be implemented here.

At the beggining basic stats, factors and basic fight system, without spells or special abilities should be implemented.

As a first stage it should be considered how, and where the base stats should be held - propably a POD structure in Actor class will be ok.

In-Game manual

A window containg help. It should be oppened using command "?".

Basicaly it could be some text window with navigation menu:

untitled

Inventory gui

Inventory window that allows equipment managing.

It could looks something like this:

untitled

Player will navigate between items using arrows, and change "active" window (equipped or inventory) using tab. When some inventory item is selected, a window will pop up, and show available item actions:

untitled2

There is already InventoryManager class. It should be extended.

Message manager

In order to prepare to multi-language version, all messages which appear on the screen, including the window titles and control names, have to be in one place.

First idea is to make some sort of message manager which will return string message when requested. The parameter to request a message string could be an enum.

For example:

std::string MessageManager::getMessage(MessageID id);

and:

enum MessageID
{
  INVENTORY_FULL,
  PICKUP_WINDOW_TITLE,
  ITEM_PICKED_UP
}

Openable actors

It is needed to define some generic system to check if actor can be opened. This feature should allow implementing some behaviour after opening: for example triggering a trap or allow to pick up content of oppened actor. It also should have lock option.

Widget system refactor

I recently noticed that widget system started to rot. It is because, at the begining there was no design for widget system, I was just adding some gui elements, then I noticed, "hey, it starting to look like widgets, we need widget system" and I unified some interfaces, and changed those implemented elements to widgets. Then I noticed that the raw widgets are not enough anymore, so I made Windows. It all sumed, and the design became poor. There is need to refactor the widget system, explode it into small single-responsible pieces, and apply good class hierarhy.

Tiles that smell - monster tracking

At the momment monster tracks player by heading right to player position. It could be replaced with tracking by scent. Tiles should have new property - smell. When player enters a tile, smell is set to maximum value, as player walks away, the smell value decreases until it reaches value of 0.

Apply function to actors

Engine::updateAis used to iterate over all actors on map and do some action. It is wrong, and now is disabled. Todo is implement feature in Map, that allows execute some function on all actors. The signature could look like this:

bool Map::doActionOnActors( std::function<bool(Actor*)> fun );

and then apply it in Engine::updateAis

Widget system

Lets hold all gui elements in class WIdget with simple interface, for example

class Widget
{
  virtual void render(TCODConsole* console) = 0;
};

and then implement widgets like Bar (for rendering for example health bar), Log, etc.

Then, create Gui Panels - bottom panel, right panel which will contain vector<Widget*> and draw all of them when Panel::render() is called.

Short user guide is needed

It would be nice to have short user guide describing how to move in game, which key opens the door, etc.

Code duplications.

There are a lot of places where code is duplicated (for example DataGateway.h/cpp and utils/utils.h). Imho it should be cleaned up before adding new features - code will be messy on each added feature if it won't be cleaned up.

Game sidebars

Right sidebar should contain player statistics:

player name
health bar
xp bar
active effects

Bottom panel could also display list of actors beneath player feet.

Each tile with own actors container

While working on CmdPick it turned out that there should be some manager for picking items. There are two main cases of picking items: picking items from map (CmdPick) and picking items from an Actor's container (CmdOpen). Each case is handled in a little different way, and it introduces some problems. So the goal is to unify those two cases. The idea is that the pickup manager will get a Container pointer as an argument to work on it. In order to do that it is needed to implement separate Container* for each map tile. At one side it will spimplify some operations on Map, for example adding new actor to map (dropping item). It will rather not change external Map interface, only internal implementation.

Text window

There is need for some window that will be able to display text (fro example help loaded from file or some message). It has to have scrolling implemented. It also should have have configurable size (height and width). It can be done using existing widget: Panel.

Actor stack on tile

When there are many actors on the same tile, right order of displaying them have to be maintain. For example corpse should be beneth monster (it is quite done in Map::addActor), or when any actor is put at open door, it should be in front (the door character not visible).

Functions involved:
Map::AddActor
Map::render

Stackable items

At the moment items are not stackable. I think it could be done via new ActorFeature "Stackable". It could have methods like:

-> stack(Actor* actor): if item has stackable feature, then increase amount of stacked items and delete stacked item.
-> spilt(int amount): create new item as copy of item to be spilt, set amounts of spilted item, and newly created, return newly created actor as result of spilting

Picking up issues

  1. When picking up stackable item: after window to set amount shows and hitting escape key items are picked up - action is not canceled
  2. when picking up and inventory is full and trying to pickup stackable item: each tim eamount window shows the default amount is multipled

Character sheet

CharacterSheet should be an object containing all information about character stats, feats, powers, level, experience, health, etc. It will be digital version of standard D&D 4e character sheet found in Players Handbook. I think it will be used as a member of Fighter ActorFeature or maybe a separate ActorFeature.

Put into command

A command that allows put an item into container.

key: 'p'
usage: after hit command key, inventory window will appear to choose item to put. Then, player has to choose actor from neighbouring tiles (SingleNeighbour ItemSelector) to which put the item. If there is many container-actors on the tile, a window will appear to choose the container.

Define compare function for Actor

Since it is possible that Actors with the same Id have different Actor Features it is needed to define a compare function. Propably the best way it to overload the operator==. Each ActorFeature should also have compare function defined.

After a while, I think it is better to define "equal" function, and declare it in interface as a vinrtual function, so it will force to implement it in every concreet class.

Item usage (pickables)

Pickable actor feature have 'use' methos. I think there should be implemented an Effect system, and usage of item will result applaying an effect.

The effect could divide for categories like:
-instant effect (heal/damage effect)
-timed effect (temporary stat change effect)

In future there propably will be need for implementing EffectManager, which will hold timed effects applied to actor (buffs and debuffs).

ItemPicker - item choosing using arrow navigation

At the moment an item is choosen by hiting character assigned to it. The goal is to make arrow nawigation: player will navigate between items using up/down arrow, and then apply selection by hitting enter key.

Look command

Look command:
key: 'l' (small 'L')
usage: navigate on a tile you want to inspect
result: a list of actors present on selected tiles displayed

The informations should be displayed on 'view console', which is positioned right to the log console at bottom of the screen.

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.