tank game

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 1528 Views - Last Post: 28 January 2018 - 10:35 PM Rate Topic: -----

#1 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

tank game

Posted 14 January 2018 - 06:45 PM

I am doing a side project with the text I am reading and working on the exercises. I am working on a text based tank game. I would like just some input on my combat routine.
				if (board[m][n] == board[i][j])
				{
					int att = rand() % 6 + 1;
					int def = rand() % 6 + 1;

					if (att > def)
					{
						russian_tank--;
					}
					if (def >= att)
					{
						american_tank--;
					}
					if (russian_tank == 0)
					{
						cout << "American Tank Wins" << endl;
					}
					if (american_tank == 0)
					{
						cout << "Russian Tank Wins" << endl;
					}
				}



Is This A Good Question/Topic? 0
  • +

Replies To: tank game

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14685
  • View blog
  • Posts: 58,690
  • Joined: 12-June 08

Re: tank game

Posted 14 January 2018 - 06:59 PM

I dont get the game logic there.. Be it the if statement or why if one only one is attacking, but loses they are penalized.
Was This Post Helpful? 0
  • +
  • -

#3 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: tank game

Posted 14 January 2018 - 07:07 PM

I am using a RISK based type of combat. if the American wins then the Russian is decremented by one point, it has a hit point value. I just want some input on how to make my combat routine more accurate. I am thinking about adding a attack value and defense value to each opponent.
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12491
  • View blog
  • Posts: 45,626
  • Joined: 27-December 08

Re: tank game

Posted 14 January 2018 - 07:24 PM

Quote

I just want some input on how to make my combat routine more accurate.


What is inaccurate about the code you posted? Can you define precisely what you mean by "more accurate?"


Quote

I am thinking about adding a attack value and defense value to each opponent.


You're familiar with Object-Oriented Programming, correct?
Was This Post Helpful? 0
  • +
  • -

#5 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: tank game

Posted 14 January 2018 - 07:27 PM

well I want it to be more like the old board games using tanks, like panzer blitz.
Was This Post Helpful? 0
  • +
  • -

#6 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12491
  • View blog
  • Posts: 45,626
  • Joined: 27-December 08

Re: tank game

Posted 14 January 2018 - 07:34 PM

Quote

I just want some input on how to make my combat routine more accurate.


And your definition of accuracy:

Quote

well I want it to be more like the old board games using tanks, like panzer blitz.



You are basically asking us to architect an implementation for a game like panzer blitz. This really isn't a fair thing to ask, as you are asking us to do all of the work...
Was This Post Helpful? 0
  • +
  • -

#7 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: tank game

Posted 14 January 2018 - 07:41 PM

I don't want you to do all the work. I just want to know if panzer blitz is a good way to tackle my combat routine. I have also googled text based tank games but did not get any good posts.

I don't want you to do all the work. I just want to know if panzer blitz is a good way to tackle my combat routine. I have also googled text based tank games but did not get any good posts.

sorry I double posted
Was This Post Helpful? 0
  • +
  • -

#8 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12491
  • View blog
  • Posts: 45,626
  • Joined: 27-December 08

Re: tank game

Posted 14 January 2018 - 07:43 PM

Iíve never played panzer blitz, so I donít know. I do think it would be helpful for you to define the rules of the game precisely before writing code. Then, on paper/a whiteboard/etc., work on the high-level architecture of the game, such as the classes, what they model, how they interact, etc. Do all of this before writing any code.

Honestly, I think this project is going to end up like your previous threads. It seems too big compared to where you are at as a programmer.
Was This Post Helpful? 1
  • +
  • -

#9 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: tank game

Posted 14 January 2018 - 07:47 PM

I am going to work on my game. I am going to keep it as simple as possible.
Was This Post Helpful? 0
  • +
  • -

#10 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 934
  • View blog
  • Posts: 3,740
  • Joined: 13-June 14

Re: tank game

Posted 15 January 2018 - 01:18 AM

View Postpbivens85, on 15 January 2018 - 02:41 AM, said:

I have also googled text based tank games but did not get any good posts.


You're going about it the wrong way. There isn't always going to be a tutorial, etc. on the very specific thing you want to do. It's your job, as a programmer, to break the problem down into manageable pieces and think about how to implement them using the facilities provided by the language and its libraries.
Was This Post Helpful? 2
  • +
  • -

#11 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: tank game

Posted 16 January 2018 - 04:32 PM

I am going back to my exercises in my book. I really need the practice.
Was This Post Helpful? 0
  • +
  • -

#12 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 934
  • View blog
  • Posts: 3,740
  • Joined: 13-June 14

Re: tank game

Posted 17 January 2018 - 02:11 AM

That seems sensible. Really, stick to doing those for now. Of course, we're happy to help you when you find you're stuck with them, but make sure you do have a good go before asking for help.
Was This Post Helpful? 0
  • +
  • -

#13 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: tank game

Posted 20 January 2018 - 08:53 PM

well I have figured out my combat algorithm. I am pretty much done with my text based tank game.
Was This Post Helpful? 1
  • +
  • -

#14 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: tank game

Posted 21 January 2018 - 01:25 PM

is there anyway I can post my game, I am very proud that I have finished my game.
Was This Post Helpful? 0
  • +
  • -

#15 andrewsw   User is offline

  • head thrashing
  • member icon

Reputation: 6667
  • View blog
  • Posts: 27,299
  • Joined: 12-December 12

Re: tank game

Posted 21 January 2018 - 01:31 PM

There is a Share Your Project forum.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2