lonski / amarlon Goto Github PK
View Code? Open in Web Editor NEWRoguelike and cRPG hybrid based on Basic Fantasy RPG Game system.
Home Page: http://amarlon.lonski.pl
Roguelike and cRPG hybrid based on Basic Fantasy RPG Game system.
Home Page: http://amarlon.lonski.pl
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.
When there is any item laying at open door tile, it should not allow the door to be closed.
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.
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>
There is need to refactor xml parsing in ActorDB and MapGateway. It is messy and ugly work code.
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.
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 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
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.
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:
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.
Hardcoded paths to XML files shall be removed.
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
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.
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.
Currently there are implemented following Target Selectors:
A few more selectors have to be implemented:
At the momment those selectors are used in CmdUse.
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.
In Fighter Actor Feature there is die() funtion. Propably it is best place for this feature.
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.
Inventory window that allows equipment managing.
It could looks something like this:
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:
There is already InventoryManager class. It should be extended.
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
}
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.
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.
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.
At the momment qmake is used. It has been decided to replace qmake with cmake.
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
Src directory should be converted into static library which should be linked to main application, map editor and unit tests.
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.
Solution:
Modify Map::addActor(Actor*) function to stack items
Describe available widgets and its structure.
It would be nice to have short user guide describing how to move in game, which key opens the door, etc.
Strings in Polish language shall be changed to English.
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.
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.
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.
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.
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
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
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.
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.
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.
Change all source filenames to CamelCase.
Maps are still handled as raw pointers
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).
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:
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.