DarkElvenAngel
Posts: 2559
Joined: Tue Mar 20, 2018 9:53 pm

Need some insight on game project

Tue Feb 07, 2023 4:20 pm

Hello Everyone,

Recently I've testing battles between a Hero and a monster. For the most part this works and I'm getting very useful information about how well each hero is against each monster. I'm not sure if I want to make this into a game in it's own right the goal is to play test rules and encounters.

What I've done is created a class for Entities and then sub-classed for Hero's and Monster's, Then I have a class for Variants these can be applied to a Monster to buff stats. I've made a class for Equipment as well. And currently using Python I've created all the objects in dictionaries. This was all fine and worked until I wanted to restrict some Hero's from using an item, And how to add magic spells into the mix.

I'm not sure if I have too many classes or not enough, I'm not even sure classes are the right approach. I chose Python to start with because I could get something working quickly and test ideas fast.

What I have working:
  • A Hero can have it's stats adjusted with equipment.
  • A Monster can be modified to a Variant.
  • A one on one battle can be played out for each Hero and each Monster and Variant there of. This give stats on how effective the Hero is against each monster with a choose set of items.
What isn't working:
  • Magic not sure where to start.
  • Ranged combat.
  • Item restrictions.
  • Play field.
Goal:
The goal of the project is to create scenarios where a single or group of Heroes is place into a situation with a Group or single Monster to see how that could play out, this information is useful to know if the scenarios is too difficult or easy based on what Heroes and equipment is in use.

I'm using Python currently however I thinking in more general programming terms for this project so switching languages is a possibility.

Thanks for any input you may have,

ZenoArrow
Posts: 10
Joined: Sun Jan 15, 2012 2:59 pm

Re: Need some insight on game project

Thu Feb 09, 2023 11:38 pm

Sounds like you've made a good start.

With regards to "Magic not sure where to start." and "Ranged combat.", I would suggest magic is usually a form of ranged combat, so if you get ranged combat working the changes to get magic working will be easier to achieve.

I'm not sure which ranged combat weapons you had in mind, but let's say for example that your hero can fire an arrow. As the arrow moves through the air, you'll want to check if it has collided with something. If the arrow collides with a monster, the monster would receive damage and the arrow could disappear.

When programming computer games, there is the concept of the game loop. I'm assuming you're already familiar with this concept, but in case anyone isn't familiar, the high level description goes something like this:

1. Handle character inputs.
2. Update game state.
3. Display updates on screen.
4. Go back to 1.

This loop would run on a timer. For example, let's say you want to your game to run at 60 frames per second, this means that steps 1 to 3 need to fit within 1/60th of a second, or around 16.667 ms (1 second = 1000ms, 1000ms / 60 = 16.6666...). How you split this 16.67ms between the 3 steps depends on how much action you want to have on screen, but if you found steps 1 to 3 were completed before 16.67ms had been reached, you could wait until 16.67ms before going back to step 1. You don't have to worry about the exact timing of this game loop when you're starting out, but it's a good idea to start thinking about this, especially for action games.

Let's look at what you'd need to give the hero the ability to fire arrows. In step 1, you need to know if the player has pressed the "fire an arrow" button, and if they have create a new arrow object (set the starting coordinates, set the arrow speed (the distance travelled on screen in one frame of action), set the direction the arrow would fly), and store this in a list of game objects. In step 2, you update the state of all the game objects in your game (updating the x and y coordinates if this is a 2D game), including the arrow created previously. If the tip of the arrow has collided with another object (e.g. by checking the x and y coordinates and seeing if it is within the x and y range for a monster. For this range, think of a box around the monster and the minimum X coordinate / maximum X coordinate / minimum Y coordinate / maximum Y coordinate for that box, this is often called a "hitbox"), then you know to update the stats for the game objects that have interacted (e.g. removing the arrow from the game object list and adding damage to the stats to the monster). After updating the game objects, the next step (step 3) is to display the new game state on screen.

I hope this helps. There are even easier ways to create games than creating a game engine from scratch in Python (such as using a ready-made game engine designed to help with making games, such as Godot), but if you will undoubtedly learn new skills no matter which path you take. I'd also like to say that the approach I suggested above is just one way to achieve ranged combat, so the advice I've given is more of a guideline of one way to achieve this than a set of rules you have to follow. Best of luck!

DarkElvenAngel
Posts: 2559
Joined: Tue Mar 20, 2018 9:53 pm

Re: Need some insight on game project

Fri Feb 10, 2023 3:16 am

Thank you for the advice!!

Most helpful, I'm sure I can put this to good use. I might be going about things in a backwards way trying to sort out mechanics before ever starting on visuals? I'm looking to do a 2D top down tile map game to match a physical game board, if that makes sense? I haven't decided if I want console text output, a GUI window or maybe a web page interface.

Range combat would be line of sight and that's where I'm really having the break down right now. I haven't got a map or array to work from I'm not sure what that should be. I would think an array of tiles with properties like if the space is occupied what side(s) has a wall, door, secret door. If I include some logic or method to the Entity class(Hero/Monster) that could return who it can see I just to apply that to the combat functions. Once I have that then getting fancy with range becomes possible as well. Magic will have some spells that can deal damage, or heal, I also want to grant buffs with magic that would last a turn or until damage was taken, cause a status effect. Some monsters can use magic too and they have other effects. I'm not sure how to take all that and go to a class. I would start with the two simplest examples damage and heal then I can add more complexity.

I've looked at some tutorials mostly python, I'm not keen on how they mix the rendering into the Entity classes I will want to port this code to another language and having game logic and rendering as separate as possible makes more sense to me.

I've also start the basic idea of equipment going into an inventory. The current code will simple adjust the attack and defend values when a weapon or armour item is used. The new code I'm working on will equip equipment into inventory slots and the attack and defend values accessed via a getter function. This way I can remove a shield if a two handed weapon is equipped for example. The old code I can just use armour pieces multiple times and that's clearly no good.

Daniel Gessel
Posts: 593
Joined: Sun Dec 03, 2017 1:47 am
Location: Boston area, MA, USA

Re: Need some insight on game project

Fri Feb 10, 2023 5:23 am

Can you share a little more? It sounds like it's a classic RPG game. Are you thinking turn based or realtime? Are you planning for gameplay to be dynamic, physics inspired, or more logical and abstract, with or without randomness?

Put another way, how continuous is the game world going to be? You might have the classic text adventure model, with discrete locations and no notion of position within a location. Or you could have a VR simulation, where combat is defined by physics based body movement and hits are use relatively precise geometry (the same or cut-down versions of the geometry used to render). Ranged combat at one end might be being able to attack an adjacent location, at the other end, it's a physics simulation of an arrow in flight.

Maybe it's a grid? Good for paper+pencil or board games.

DarkElvenAngel
Posts: 2559
Joined: Tue Mar 20, 2018 9:53 pm

Re: Need some insight on game project

Fri Feb 10, 2023 1:40 pm

More information is better I thought I mentioned turn based but maybe I erased it, I'm going for a classic RPG style. My idea for the game is to have a fixed gameboard and based on the players and abilities generate some dungeon for them to play through. I'm drawing inspiration from the HeroQuest companion app that lets the players play without the game master. It's an interesting idea but you can't have it do your own adventures and it has a limited pool of monsters to pull from. It also lacks the ability to adjust the difficulty if the heroes are having a rough time or to easy of a time. So this is where my game fits in.

Once I sort out combat, I want to make the basic dungeon layout based off a physical game board, I hare a few suitable ones. I want to see if I can make the game playable on the computer first then later try to incorporate the physical game play aspect.

Daniel Gessel
Posts: 593
Joined: Sun Dec 03, 2017 1:47 am
Location: Boston area, MA, USA

Re: Need some insight on game project

Fri Feb 10, 2023 7:08 pm

DarkElvenAngel wrote:
Fri Feb 10, 2023 1:40 pm
More information is better I thought I mentioned turn based but maybe I erased it, I'm going for a classic RPG style. My idea for the game is to have a fixed gameboard and based on the players and abilities generate some dungeon for them to play through. I'm drawing inspiration from the HeroQuest companion app that lets the players play without the game master. It's an interesting idea but you can't have it do your own adventures and it has a limited pool of monsters to pull from. It also lacks the ability to adjust the difficulty if the heroes are having a rough time or to easy of a time. So this is where my game fits in.

Once I sort out combat, I want to make the basic dungeon layout based off a physical game board, I hare a few suitable ones. I want to see if I can make the game playable on the computer first then later try to incorporate the physical game play aspect.
Ah - that all sounds fun! "gameplay first" makes more sense than "graphics first" for turn based - more on the tactical/logic problem side than the twitch videogame side.

Visibility is key for ranged combat (adjacency for hand-to-hand). I find keeping it simple is hard on a grid because of edges - maybe fractional visibility could work, especially if you have a Pi companion to do the math?

On the other hand "zone" combat (even just 2 zones, ranged and hand-to-hand - a turn to engage ranged monsters, for example) can give a feel of space without all the geometry calcs.

Arkham Horror (the last game I played alot) uses a board, but it's "location based" not "geometry based" - so board "structure" would drive some decisions...

DarkElvenAngel
Posts: 2559
Joined: Tue Mar 20, 2018 9:53 pm

Re: Need some insight on game project

Sat Feb 11, 2023 2:05 am

I hope to make it fun, I've started to look more into range combat and movement I'm going to need a path finding algorithm. A* is suppose to be one of the best, Dijkstra's is not bad. Hopefully one of these will be useful. For the first trials I will use unlimited line of sight so long as there isn't a wall in the way I can attempt to hit it. The combat system doesn't have a separate hit chance roll, it's based off of what the attack number is and if the rolls would do damage or not. This is something I want to change and test out.

One restriction I like in the battle rules is that you cannot use a ranged weapons in melee combat.

DarkElvenAngel
Posts: 2559
Joined: Tue Mar 20, 2018 9:53 pm

Re: Need some insight on game project

Sat Feb 18, 2023 7:10 pm

I've got some more fun work to do I found a way to generate the dungeons at least the steps I need to take.
  1. Place Rooms
  2. Create Delaunay Triangulation
  3. Choose Random edges
  4. Path find hallways
Since I want to work off a fixed game board some of this will be easy to do. I have been working on the project in bits and I've got the random treasure searching working perfectly. I'll need to have rooms that would fixed treasure in them this could be pulled from another list separate from the random treasures that could also have traps or monsters.

I'm having trouble visualising what I'm doing, I want wall to be part of the cell in the array. so that a door isn't it's own cell it's plus I have a fixed layout for rooms and corridors.

Return to “Gaming”