Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: Making A Turn-based Tactics Advanced Wars-like Game  (Read 4253 times)

bahihs

  • Bay Watcher
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #15 on: May 25, 2015, 05:40:24 pm »

Hmm... hm. About the commander, one thing that seems to be universal in these sorts of games is that the player can see from the perspective of all their units. Changing that would make your game unique and fresh in comparison. Which brings to mind a day-night cycle and weathers...  hm.

Not quite sure if you misunderstood what I mean by commander (did you take a look at the link?), each unit consists of ~1000 individuals (represented only by a number), by commander I meant that 1 of these individuals per unit, would be "special", in that if he ever dies, there would be some sort of repercussion (most likely a morale hit).

I think what you're talking about is the general, i.e the guy who is leading all the units. The problem with changing FOV to be based only on the general's view, is you cannot interact with units you can't see. For example, consider some cavalry hiding in the woods. In game terms, "hiding" would be represented by not drawing that unit on the screen. However, you'd only make the unit disappear for the enemy, not for yourself. If you did the latter, how would you give any additional orders?

In real life, orders were given in several different ways: flags, drums, trumpets, messengers etc, so that the above problem is avoided (or at least reduced). Furthermore, generals had to keep track of where their units were, using their memory, communication networks, maps, detailed plans etc. on a constant basis. While I could simulate this by keeping hidden units invisible on the map (by not drawing them, but still allowing them to take orders) it becomes more of an annoyance than a feature, where you are flicking the mouse across the screen trying to find your invisible unit, rather than strategizing.

This could work, if the movement system was overhauled into a coordinate system, where the player must enter the coordinates he wants his troops to move to (maybe using waypoints for the above case). But since the game is turn based, this seems overly tedious and I prefer the simple mouse-based GUI that I currently have.

However, there is another way to implement what you're suggesting, and its something I've planned to add: we simply decrease the probability of being able to control a unit at the start of the turn, varying this probability relative to the unit's distance from the general and to the terrain it stands on (hiding in forests, on top of a hill). This feature is already half-in in the form of morale; morale works by picking a random number from 1-100 and if that number is greater than the unit's current morale, that unit cannot do anything this turn. Right now its a little wonky because the probability is linear (ideally it should be logarithmic) but it is not hard to generalize this, and have other factors influence it.

I've been on the fence about this particular feature (limiting control based on general's FOV) but I think, as you stated, it would make the game a little more interesting, fresh and new.
Logged

bahihs

  • Bay Watcher
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #16 on: May 25, 2015, 06:58:42 pm »

I've finally updated the code. There are some substantial updates:

  • Organized the terrain/map generation, so that maps could be generated based on archetypes (desert, forest, plains and tundra)
  • Half implemented the terrain system, so that terrain will affect the power multiplier; terrain does not yet affect movement but I'm working on it. Terrain details also show up on the message panel
  • Redid the combat system. Now the game calculates the outcome of a battle (in terms of casualties) by simulating mini-battles per individuals in the unit. Added a defense stat which plays a prominent role in the combat system.
  • Discovered you can control loops using "break" and "continue" and optimized several costly for-loops. Game purrs along like a happy kitten now.
  • Some general bugfixes

The game is in a mostly playable state now. I played some practice hotseat matches against myself, and the current code generates a few units on each side to play with. Already the game is quite tactical, rewarding flanking and encirclement and focusing on proper placement of your units. With the addition of terrain, maintaining the high ground becomes crucial. The maps are quite beautiful and the battles are quick and decisive, as I hoped for. 

Next up is a major addition to the game: an interface for unit deployment before the start of combat. This should solve the current issue of units being stuck in mountains, due to static placement. I actually don't know what I'm going to do for the interface, I've been thinking about something like a "deploy zone" on the map where units can be placed. But I'll have to do some research. Before that I'm going to further clean up the map code and comment everything in greater detail (its getting pretty long now and its time to get organized).

Once that's done, I'm going to focus on the movement system and field of view with regards to terrain. Then units will be able to hide in trees, and get hampered by hills. After that...well, I think it about it when I get there. 
« Last Edit: May 25, 2015, 07:01:13 pm by bahihs »
Logged

Antsan

  • Bay Watcher
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #17 on: May 28, 2015, 10:13:49 am »

PTW

For movement and terrain: If I remember that right (I'm too lazy to go looking now) you're having problems with the pathfinding with variable-movement-cost terrain, right?
If that's the case, you should take a look at the A* pathfinding algorithm, or if that's too complex try Dijkstra's algorithm. No matter which one you choose, handling variable movement costs is kind of the point of both of these.
Logged
Taste my Paci-Fist

bahihs

  • Bay Watcher
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #18 on: May 30, 2015, 04:26:32 pm »

PTW

For movement and terrain: If I remember that right (I'm too lazy to go looking now) you're having problems with the pathfinding with variable-movement-cost terrain, right?
If that's the case, you should take a look at the A* pathfinding algorithm, or if that's too complex try Dijkstra's algorithm. No matter which one you choose, handling variable movement costs is kind of the point of both of these.

Yeah I think, based on what advice I gotten here and elsewhere, I'm going to have to build my own pathfinding algorithm (i.e implement manually A* or Dijkstra) since the built-in pathfinding doesn't seem to account for variable movement cost. That's going to be a mini-project in itself, but should be interesting.

In other news, the deployment system is finished. You can now move your units around within a specified area (first 5 rows of the map), before the battle begins. This is mostly inspired by the total war system of deployment and I think it works well here too (not to mention it was much easier to program than I thought). Units will still be stuck in mountains but you can easily move them out and place them where you wish before the game starts.

I still haven't cleaned up or commented the code however so I'm not going to put it up just yet (maybe next update). Next up is the revision of the movement system which is going to require an overhaul of the path-finding mechanism. After that...I don't know. There are a lot of "fluff stuff" to add, like different units, a main menu, other menu's etc. But where should I start?

Perhaps a more experienced person here can guide me.

Honestly though I'm surprised I came this far, when I started I had to look things up every 2 minutes and now its every 10 minutes :P
Logged

bahihs

  • Bay Watcher
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #19 on: June 01, 2015, 11:12:01 am »

Alright some good and bad news. This project will be put on indefinite hiatus. I have kind of lost track of where I wanted to go with this game. In anycase, it fulfilled its purpose, I learned a great deal of python in a very short time.

However, having gotten a taste of game development, I'd like to give a shot at some other games I've wanted to make. My next project will be a text-based, turn-based fighting game. I'll have a development thread for it here as well once I have some of the groundwork done.

Look forward to it!
Logged

FallacyofUrist

  • Bay Watcher
  • Blatant furry. Also a hypnotist.
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #20 on: June 01, 2015, 02:13:19 pm »

I would rather not see this thing die. In my experience, hiatus is death.
Logged
FoU has some twisted role ideas. Screw second-guessing this mechanical garbage spaghetti, I'm basing everything on reads and visible daytime behaviour.

Would you like to play a game of Mafia? The subforum is always open to new players.

bahihs

  • Bay Watcher
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #21 on: June 01, 2015, 02:41:22 pm »

I would rather not see this thing die. In my experience, hiatus is death.

Hmm...I didn't realize anyone was actually following this with the intention of eventually playing it (honestly thought people were just following to offer advice). And actually, there is a great deal I can still learn from this project (AI, various algorithms, OO-programming).

You've given me incentive to reconsider, I've spent a lot of time on this so far and it would seem a bit wasteful to discard it.

Logged

FallacyofUrist

  • Bay Watcher
  • Blatant furry. Also a hypnotist.
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #22 on: June 01, 2015, 05:37:41 pm »

It's certainly something I would desire to play.
Logged
FoU has some twisted role ideas. Screw second-guessing this mechanical garbage spaghetti, I'm basing everything on reads and visible daytime behaviour.

Would you like to play a game of Mafia? The subforum is always open to new players.

Wysthric

  • Bay Watcher
  • I'm actually Korbac! :)
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #23 on: June 03, 2015, 06:29:58 pm »

Yeah, I'd love to play this. Seems like an ASCII adaption of both the Advance Wars and the Total War series.

Logged
I'm Korbac. Not sure what happened to that account.

bahihs

  • Bay Watcher
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #24 on: June 03, 2015, 07:09:09 pm »

Yeah, I'd love to play this. Seems like an ASCII adaption of both the Advance Wars and the Total War series.


It's certainly something I would desire to play.

Yup, its something I'd like play as well. So I may as well finish it. That said, I've begun to rework the pathfinding code. I managed to get it so that it takes terrain into account. Unfortunately it lags when the map is large due to having the pathfinder iterate over all "special tiles". Some optimization will have to be done, I'll see what I can do, but worst case scenario I'll leave it unfinished (the pathfinding is very fast without taking terrain into account and works just fine) and move on to something else.

Field of view is also in the works, I have the "Strategos" unit (i.e General) for each side have a vision circle which is affected by certain terrain (trees, mountains). However it's tricky getting every unit to have these circles. I did manage to get both generals to display their circles at the same time so I definitely know multiple FOV's are possible.

Once that is done, I'm going to leave what I should focus on next up to you guys. At that point all the ground mechanics are in place and it can start becoming more of a game.

It'll probably be between these options:

  • Create an executable and upload the entire game as a file so that it can be run without compiling
  • Build a better gui with popup menus containing all unit info instead of the info being on the bottom of the screen (kind of like advanced wars unit details menu)
  • Create a (simple) AI to play against (would allow for a single player quick battle mode)
  • Create a way to play multiplayer (probably LAN)

I'll be doing all of this eventually but it's matter of which one to do first, that I leave to you guys.
Logged

FallacyofUrist

  • Bay Watcher
  • Blatant furry. Also a hypnotist.
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #25 on: June 03, 2015, 07:23:05 pm »

I'd start with the multiplayer mode.
Logged
FoU has some twisted role ideas. Screw second-guessing this mechanical garbage spaghetti, I'm basing everything on reads and visible daytime behaviour.

Would you like to play a game of Mafia? The subforum is always open to new players.

bahihs

  • Bay Watcher
    • View Profile
Re: Making A Turn-based Tactics Advanced Wars-like Game
« Reply #26 on: June 08, 2015, 02:16:30 pm »

I'd start with the multiplayer mode.

Was afraid you'd say that lol. I don't know anything about networking, should be fun.

Anyway, I managed to finish the pathfinding stuff (it actually works fast now!) and the FOV stuff without having to write my own algorithms (I'm so proud of my laziness), it's actually pretty fast as well.

Then disaster struck and I started playing around with indentation in VIM and accidentally set line-wrapping, destroying EVERYTHING. I'm about 1/3 of the finished from cleaning up the code (it does look very pretty now though) and I'm probably gonna take this opportunity to comment everything and then post an updated version (might have to upload a file or something, as its too large to fit in a single post).

PROGRESS!
Logged
Pages: 1 [2]