|Thread: [Playable Demo] Fan made Heroes-like game|
I must act
posted August 07, 2021 01:31 AM
|Edited by tyrael at 09:59, 08 Aug 2021.
[Playable Demo] Fan made Heroes-like game
For the past few months, I have been working on a Heroes-like game. I want to share with you the first playable prototype.
[url=https://www.mediafire.com/file/zws21hkok5v7kzg/Game.rar]Game[/url] 8/7/21 84 MB
FEATURES of the GAME:
* Fully playable Heroes-like game, but with reduced feature set. Start with a city and a hero, explore the map, gather resources and experience, recruit armies and fight against your opponent. A map can be played from start to finish, and ends when one player loses all towns and heroes.
* Map editor. Set the terrain type and elevation of tiles, either individually or using brushes. Add water, roads, rivers, vegetation, then place cities, heroes, mines, resources, Adventure Map buildings. Modify placed cities and heroes or delete them. Saved maps can be played from the New Game.
* Random map generator. The RMG only sets terrain data (elevation, water, vegetation). Gameplay data (cities, heroes, resources, mines) has to be added by the user. The maps can have unconnected landmasses or regions not accessible due to elevations. Generated maps can be edited freely inthe Map Editor.
The game has no AI, so the other player must be controlled by another human (or you can play against yourself ). The only game mode is pretty much Hot Seat mutiplayer.
2. THE ADVENTURE MAP
The Adventure Map is a grid made of hexagonal tiles. I chose to use hexagons because they have six equidistant neighbors. In contrast, on a square grid there are two types of neighbors, edge and corner neighbors, and diagonal movement costs more. Having two type of neighbors would have complicated things.
The camera is free to move in all three dimensions.
* zoom in and out using the mouse wheel
* move it by using the WASD keys
* rotate it using the Q and E keys.
There are three map sizes. Each map size is twice as big as the previous
* Small - 20 by 15 tiles
* Medium - 40 by 30 tiles
* Large - 80 by 60 tiles
There are seven different levels of elevation. Each tile of the Adventure Map has its own elevation.
Heroes spend the standard movement cost when travelling between neighbors of equal elevation. Travel between neighbors with an elevation difference incurs a movement cost penalty. Travel between neighbors with an elevation difference greater than one is not possible.
When drawing tiles of different elevations, passable boundaries are represented as terraces, and unpassable boundaries as slopes.
In the future, I would like for the elevation to play a bigger role in the gameplay. When a fight is initiated on the Adventure Map, the height difference between the attacker's tile and the defender's tile could determine the shape of the battlefield. Units would move downhill or uphill when engaging their enemies, and this could have an effect on the damage, ranged distance penalty, creature abilities, movement speed etc. Imagine having to fight uphill when sieging a city, that would be fun to watch. Maybe there are Hero Skills that allow burrowing, or carving tunnels through mountains, or even factions such as the Dwarves that relate to the elevation in a completely unique way.
I felt that introducing elevations also required support for water at different altitude levels. If I want to add a lake in the mountainous part of the map, it would be nice to be able to place it at a higher altitude than the global ocean.
There are seven Water Levels, each one corresponding to one of the seven Elevation Levels. Each tile has it's own Water Level. A tile is underwater if and only if it's Elevation Level is lower than it's Water Level.
Currently, the Map Editor allows to set each tile's Water and Elevation Levels. The two levels are completely independent, so it is possible to create nonsensical water bodies. For example, a lake to completely stops despite not encountering shore tiles.
In the future, I think I will remove the ability to set a tile's Water Level directly. Rather, water can be placed with a bucket tool. You set the desired Water Level and click on a tile, and water covers all connected tiles of appropriate altitude. However, this might make water placement cumbersome and counterintuitive. I still to think of the best way to go about this.
2.4. Terrain types
There are five types of terrain types. Sand, Grass, Mud, Stone and Snow. The terrain type can be set per tile and you are not constrained in any way. You can make underwater tiles to be snow if you want.
Apart from using different textures, the terrain types have no influence on the game at all. Not even in setting different movement cost per terrain.
2.4. Rivers and roads
Tiles can contain rivers and roads.
Each hexagonal tile can be seen as being formed from six triangles, one for each of its six neighbors. There can be at most one river or one road passing through each one of these six triangles.
An additional limitation for rivers: there is no support for merging or forking rivers, so at most two of a tile's triangles can contain rivers. Roads can merge and fork just fine.
This limitation is caused by the fact rivers require a lot more effort than roads. Roads are nothing more than textures, but rivers need to carve river beds in the terrain's mesh. I would like to extend the river system in the future, but for now it is what it is.
River and road segments are placed individually by clicking and dragging over tiles. A river has a flowing direction given by the order in which its segments are placed. Rivers cannot flow uphill, if you try to add an invalid river segment the Map Editor will refuse.
2.5. Map Buildings
Apart from Cities, which will get their own section in this post, there are 10 type of map buildings.
The first six provide resources. There are three types of resources in the game (Gold, Wood and Ore). Each resource type gets a mine and a stockpile.
The mines produces a quantity of resources at the end of each turn for the player that owns them.
The stockpiles provide a quantity of resources to the first player that visits them during that week. All subsequent visits during that week will yield no new resources. Stockpiles cannot be owned, and are replenished at the beginning of the first day of the next week. Resources don't accumulate from one week to the next, so they are lost if nobody visits the stockpile during that week.
The other four building types improve hero attributes. The stables can be captured and, as long as they are held, increase the distance covered by ALL the player's heroes. The other three award one-time bonus to each hero that visits them. We have a building for +1 Attack, one for +1 Defense and another for +1000 Experience.
The full list of Map Buildings:
* The Gold Mine provides 1000 Gold per turn.
* The Sawmill provides +2 Wood per turn.
* The Ore Min provides +2 Ore per turn.
* The Gold Stockpile provides +5000 Gold per week.
* The Wood Stockpile provides +10 Wood per turn.
* The Ore Stockipile provides +10 Ore per turn.
* The Stable increases the movement of ALL heroes by 10.
* The Pillar awards a one-time bonus of +1000 Experience.
* The Barracks awards a one-time bonus of +1 Attack.
* The Tower awards a one-time bonus of +1 Defense.
2.5. Fog of War and Exploration
The game uses Exploration and Fog of War. At the beginning of the game, the Adventure Map tiles are unexplored. As the heroes move across the map, they encounter and explore new tiles. Tiles that come within viewing range of a hero are considered Explored. A tile's content is visible only as long as it remains within viewing range of one of the player's heroes or cities. If it's not within viewing range, it is considered to be covered by the Fog of War. An Explored tile can never revert to being Unexplored.
Unexplored tiles are not drawn to the screen at all. Explored tiles under the Fog of War are drawn in a darkened color. Visible tiles are drawn normally.
What do I mean by the tile's content being visible?
We need to distinguish between permanent tile info (such as terrain type or the presence of a river), and temporary tile info (whether it contains a stack of resources or an enemy hero). Once explored, a tile's permanent data will always be available to the player. Despite being drawn in a darker color, the tile's mesh is still clearly visible, and the tile's terrain type and altitude distinguishable.
However, a tile's temporary info is only updated as long as the tile remains visible. We can't see the enemy's movement through the Fog of War. This temporary tile info could be further divided in two categories:
* content that is shown with the most recent info available, but is not updated once the tile becomes fogged. For example, let's say you explore a new tile and see that it contains a stack of resources. You move your hero away from that tile and it becomes darkened, but the stack of resources is still drawn. The game remembers that the tile contains resources, but you are not informed when those resources are picked up by the enemy. The resources will continue to be drawn until the tile becomes visible once again. Only then you find out that the resources are not there anymore. Other type of content in this category is the ownership of Map Buildings.
* content that is only shown while the tile is visible. For example, the positions of enemy heroes. Enemy heroes covered by the Fog of War are never drawn to the screen.
This is how things should work, but that would require me to implement two different ways to treat tile info, and then a system to decide which approach to use for each tile. I haven't gotten around to do this yet, so I treat all tile content as belonging to the second category. So resources and building ownership flags disappear as soon as the tiles become fogged.
In order to truly hide the contents of a tile, it is not enough to not draw them. Other systems had to be tweaked as well. For example, when right clicking on an fogged tile the game should ignore its real content and display that it's empty. Similarly, the pathfinding system has to pretend fogged tiles are empty and allow paths to pass through them. Paths that pass through occupied tiles are revealed to be invalid when the respective tiles come into sight during movement. In such cases, the travelling hero stops automatically before entering the occupied tile.
It would be possible to make Fog of War optional without too much effort, but I haven't gotten around to implement this yet.
Currently, there is no minimap. This is perhaps the most important of the missing features, and it is at the top of my priority list.
There is no easy way to implement a minimap that is both efficient and convenient to use.
The simplest way to make a minimap is to add a second, overhead camera that renders to a texture. The texture is then displayed in a corner of the screen as the minimap This doubles the amount of rendering that has to be done each frame, because now we have two camers and one of them is drawing every single object on the map. A lot of this work is unnecessary because the minimap doesn't need to be updated each frame, but only when something happens. Also, the minimap texture would contain the in-game models, with all their animations and shadows, which would be almost indistinguishable. A real minimap doesn't display the level as is, but a schematic representation, with icons for heroes, cities, resources etc.
So this would be the bad approach. At the moment, I don't know what is the good approach, I still need to study.
Be careful on Large Maps. Without a minimp, it is easy to get lost.
Maps can be wrapped east-west. This means that the east and west edges of the map are connected, so you can move the heroes (or the camera) freely over the edge, and they will automatically teleport on the other side of the map.
The wrapping system is not fully integrated with the free-moving camera. To maintain the east-west connection, whenever the camera moves, the most distant column of tiles in the opposite direction of the movement is detached and teleported to the other side of the map. The choice of the removed column is made so that the teleportation happens off-camera. However, at it's maximum zoom out level, the camera sees a region with a width greater than the width of the Small and Medium maps. This makes hiding the teleportation of columns impossible.
There are two solutions I have in mind, but I don't like any of them. Firstly, I could make the camera's zoom out level depend on the map size. Secondly, I could have the "edge" of the map drawn twice, both in the east and west parts of the map. This would mean that you zoom out so much that you can see the same part of the map twice, in opposite corners of the screen. So if you have a hero there, you would see two version of it. What happens if you select it and move it to the center of the map? Do both version move and merge in the middle? Of course, this would make for a very confusing game.
For the time being, zooming out on small maps remains an open problem.
Why do I only use east-west wrapping? Why not south-north wrapping as well? By using a single type of wrapping, we can think of our map as representing a sphere. Well, not exactly, because a sphere's width is maximal at the equator, and then decreases until it approaches zero at the poles. Rather, our wrapping map approximates a cylinder, or a sphere with inaccessible poles. Adding a second, south-north wrapping would make our map correspond to a torus topology.
Wrapping is completely optional, and is a per map option. You can turn it on or off in the Map Editor. Once a map is finished, the wrapping is set. You cannot choose whether you want to use it or not when starting a new game on that map.
Cities produces resources and allow the player to recruit new heroes and units.
There are no Town Screen at the moment. You can interact with the city using a Town Menu.
There are 7 building types that can be built. You can only build (or upgrade) a single building per turn. This limit is per town, not per player. If you capture a city in which a building was already built during the same turn, you have to wait until the next day.
The 7 building types are the following:
* The Village Hall produces 500 Gold per turn. It can be successively upgraded to Town Hall, City Hall and Capitol to increase the Gold production to 1000, 2000 or 4000 per turn. You can build (or capture) as many Capitols as you like, there is no limitation of one Capitol per player.
* The Fort adds defensive Walls which define a Zone of Control of radius 3 around the city. At the end of each turn, all of the map buildings inside a Zone of Control are flagged for the player who owns the city. The Fort can be upgraded to Citadel, which increases creature growth by 50% and the Zone of Control radius to 5. Upgrading to Castle doubles creature growth and increases the Zone of Control radius to 7. Because of the Zone of Control, there has to be a minimum distance of 8 tiles between Cities.
* The Tavern allows you to recruit new heroes. The cost of a hero increases with the number of heroes you already have. It only takes into account how many heroes you have at the moment, not how many you have recruited during the entire game. You can only have a maximum of 8 heroes at any one time.
The other four buildings are creature dwellings, one for each type of unit in the game.
* The Guardhouse produces 14 Pikemen per week
* The Archery Range produces 8 Archers per week
* The Barracks produces 4 Knights per week
* The Monastery produces 2 Priests per week
The game has no concept of city garrison. This means that recruited creatures can only go in the visiting hero's army. You cannot recruit units when there is no visiting hero present in town. Conversely, you cannot recruit new heroes when another hero is visiting the town.
Heroes only have two primary attributes, Attack and Defense. They work in the same way as in most games, by being added to their creatures' Attack and Defense attributes.
There are no Secondary Skills or unique hero specials.
Heroes can be either male of female. The gender is used when selecting their name, 3D model and portrait. All male heroes uses the same portrait and 3D model, same for the female heroes. Each hero gender has a list of names from which the current hero's name is chosen.
From a gameplay perspective, all heroes are identical.
4.1 Movement cost
Heroes can travel 25 worth of movement per turn. The following rules govern the movement cost of entering a tile:
* traveling along a road costs 1 movement point
* with no road, entering a neighbor of equal altitude costs 5 movement points
* with no road, entering a neighbor with a height difference of 1 costs 10 movement points
Since I am using a hexagonal grid, all neighbors can be treated the same. There is no diagonal movement.
There are no ways to traverse bodies of water, so be careful when designing maps. If two players are on different landmasses, they will never be able to interact.
The units have 6 Attributes:
* Min Damage, Max Damage
The heroes' Attack and Defense attributes are added to the attributes of their creatures.
Units act in the order defined by the Speed attribute. I use Heroes III system, not the Initiative system of Heroes V. Between two creatures with the same Speed, the attacker goes first. Two stacks from the same army cannot have the same Speed, because each creature in the game has a different Speed and an army cannot have multiple stacks of the same creature type.
5.1. Damage calculations
I use the classical system from Heroes III and V.
When a creature attacks, a random number in the [Min_Damage, Max_Damage] interval is chosen. This number is multiplied by the stack size to obtain the Base Damage. The Final Damage is obtained by modifying the Base Damage using the attacking creature's Attack and the target creature's Defense. If the Attack is greater, the Base Damage is increase by 5% for each point of difference. If it's smaller, the Base Damage is decreased by 5% for each point of difference.
5.2. Unit types
There are four unit types in the game.
* The Pikeman is the Level One creature of only faction in the game. I initially wanted to give it the Pikeman ability from Heroes IV. In that game, Pikemen used their long spear to attack from 1 tile afar, meaning it can reach to more enemies during its turn and that it can bypass retaliations. It turned out to be a little tricky to implement, but I want to return to it later.
* The Archer is Level Two creature and the ranged unit of the game. It can attack ALL opponents if it's not blocked by an enemy unit. Blocked archers can only fight in hand to hand and deal half damage. There is no range penalty or limit to the number of shots.
* The Knight is the Level Three creature. It has the Cleave ability from Heroes V. If his attack kills at least one unit, he will deal another attack after the target's retaliation.
* The Priest is the Level Four creature. It has the Heal ability. He can heal any friendly unit (or himself) a quantity of Hit Points equal to the base damage he would deal. So Attack and Defense attributes play no role in determining the healing power. The Priest has no limit to the number of times he can use this ability, so he is a pretty powerful unit.
Fight is always to the death, heroes cannot Flee or Surrender. The victorious hero receives an amount of Experience equal to the sum of the hit points of all the creatures in the opposing army. Winning battles and visiting Pillars is the only way to gain Experience.
There is no Morale or Luck in this game. Creatures cannot Wait or Skip their turns, but they can Defend, increasing their Defense by 30% until their next turn.
There are no War Machines or Sieges in the game. Since heroes cannot garrison in cities, attacking a visiting hero will prompt a battle in open field. If victorious, the attacking hero can then capture the city by simply entering it.
This will be a very short section. I have not implemented any AI whatsoever. For this reason, I haven't added neutral monsters to the map. Battles can only happen between heroes belonging to opposing players.
7. USER INTERFACE
The UI turned out to require a lot more work than I would have expected. I can say that it amounts for a significant percentage of the total work I have put in the project.
One of the main difficulties in designing the UI is that it serves as the user's entry point into the application. As such, it is also the main place where I have to catch and deal with user errors. I have to think of all the ways in which the user can send improper or illogical commands to the applications and deal with them here and now. It's important to filter bad commands because, when I write the actual, game part of the code, I want to be able to assume that only normal things can happen.
For example, if the user attempts to merge two stacks of different types, I need the UI system to detect this situation and not send the command to a further system of the game. At the same time, it is desirable to indicate what the problem is to the user.
The previous example is a simple error to detect, but in order to deal with more complex situations, I need to keep track of things like the recently pressed buttons and the order in which they were pressed. Because this was becoming more and more complex, I decided to limit parts of the game in order to get a fully playable demo as soon as possible.
I want to list here a couple of simplifications that I made because of the UI. It wouldn't have been to hard to add these features to the game itself, but it would have been difficult to implement an UI that can handle the extra complexity.
* Towns don't have garrisons. Heroes cannot garrison in towns, unit recruitment can only happen when there is a visiting hero present, and there can be no sieges.
* Heroes can't have more stacks of the same type in their army. Stack splitting can happen only when friendly heroes trade creatures. Creatures recruited from cities automatically go in the appropriate slot.
* The game has no artifacts because there is no UI in place to allow items to be placed, dragged or swapped in the appropriate slot (right hand, helmet, boots etc.)
8. HOW TO USE
After launch, the game will automatically start in Map Editor Mode. You can switch between Map Editor and Game mode by pressing the L key. Notice that Fog of War is applied only in Game Mode. If there are no Heroes or Cities placed on the Map, switching to the Game Mode will turn the entire map invisible.
8.1. Map Editor
The starting map is blank and can be edited using the two menus on the left and right side of the screen.
The menu on the left can be used to modify terrain type, the Altitude Level and the Water Level. You can also place Roads and Rivers. The Terrain Type, Road and River checks are part of a toggle group, this means only a single one of them can be checked at a given time.
* The Terrain Type Toggle Group has seven checks. The first option in the terrain group corresponds to None, you have to turn this on if you don't want to modify the terrain when clicking on tiles. The other six toggles correspond to each of the six terrain types.
* The Elevation Level and Water Level tools each have a slider for selecting one of the seven available levels. The check is used to determine if the tool's effect should be applied.
* The River Toggle Group and Road Toggle Group each have three checks. The --- check is used to ignore the tool's effect. he Yes check is used to place segments, and the No check is used to delete them.
* The Brush Size slider is used to control the number of tiles affected by the tools. All tools in the map use the same brush size.
* The Player Dropdown is used to select the active player. It can be set to Player One, Player Two or Neutral. Newly added Cities and Heroes are configured to belong to the active player, but they can be edited later.
The menu on the right is used to place cities, map buildings, heroes, walls, vegetation and decorative props. It is also used to save and load maps, or to start a new map.
* The Urban Level, Farm Level, Plant Level and Special Level tools are used to decorate the tiles. The slider can be used to select one of four possible levels. The first level corresponds to no props, and the fourth to the maximum level of props. Clicking on tiles will add props. These tools use the brush size, and the placed props serve no gameplay purposes.
* The Orientation Dropdown, Building Dropdown and Resource Dropdown are used to select the type and orientation of placed buildings and resources. Buildings are added by pressing B while hovering a valid tile. Buildings can modified by clicking on them, and they can be deleted by pressing SHIFT+B while hovering their tile. Resources can be placed and deleted by pressing O and SHIFT+O. Heroes can be placed and deleted by pressing U and SHIFT+U.
* The Wall Toggle Group has three checks. The --- check is used to ignore the tool's effect. he Yes check is used to place Walls, and the No check is used to delete them. Walls can be used to block hero movement. To create openings in Walls, have a Road pass through them.
* The Save, Load and New Map buttons each open their respective menus.
* The Grid check can be used to toggle the grid. The grid can only be visualized in the Map Editor. Switching to Game Mode will automatically hide the grid.
8.2. Game Mode
Heroes can be selected by clicking on them. Clicking on a tile will first display the path (if any valid can be found). Clicking on the tile again will issue the movement command. You can right click on Buildings, Cities, Heroes and Resources to read information about them.
You can open the City Menu by left-clicking it or by moving your hero into it. You can open the Hero Menu by left-clicking on a selected hero. Heroes belonging to the same player can meet and trade armies.
A well-known bug sometimes unselects your hero while still displaying the selected hero indicator. If a seemingly-selected hero refuses to move, press Escape and try to the select the hero again.
I must act
posted August 07, 2021 01:32 AM
posted August 09, 2021 01:45 PM
I like the elevation, can't really think of other strategy games that fully utilize it, I think it's one of the better aspects to focus on to see if there's something new there to develop further.
The UI turned out to require a lot more work than I would have expected. I can say that it amounts for a significant percentage of the total work I have put in the project.
this is one of the big things that can always catch solo devs or new teams, and your following points on it are great. UI is definitely something I focus on asap, hand-to-hand from the start with every game, there's just so much it helps with and it makes your life much easier to not have to start changing the game later on.
good luck with the future if you do go further with this, I love reading these types of posts and updates. I'll try to find time to download the demo some coming day and see if I can give some concrete feedback.
Modding the Unmoddable
posted August 11, 2021 05:11 AM
Nice effort, though I'm far too bogged down and depressed to help or try myself.
Never changing = never improving
posted March 08, 2022 08:59 PM
Are You using Unity? I am also creating my TBS game but its not that much similar to Homm, a bit closer to Age of wonders.
King of the Elder Dragons
posted January 16, 2023 12:04 AM
looks great except that haven/knight/castle is only faction, will you keep working on this and eventually add more features?
Torment is blinding. It lies. Its pollution steals my sense. It promises: destroy everything and the pain will cease.
Modding the Unmoddable
posted March 15, 2023 03:20 AM
By reading the features the problem with this game seems to be its to simple and bare-bones.
For an alpha version its probably fine but we don't know in which dorection the developer wanted to go thus hard to give feedback.
For example I think distinct heroes are a core feature of an HOMM-like game, yet all are the same here, and only have ATK and DEF
Never changing = never improving