Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3279408
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:35:21+00:00 2026-05-17T19:35:21+00:00

I originally asked this question on programmers.stackexchange.com, because I figured the answers would be

  • 0

I originally asked this question on programmers.stackexchange.com, because I figured the answers would be too subjective for stackoverflow. However, in the comments Muad’Dib pointed this out:

this would probably be a better fit for StackOverflow … This is a direct programming problem-related question and discusses programming solutions. One solution may be equal to another where the choice between them is subjective, but the discussion of the overall problem itself is not as some solutions are clearly not applicable. So this question does have one or a few good answers, whereas questions such as “Which is the best text editor?” does not…

So, after pondering the situation a little more (and looking at a few patterns that don’t seem to fit), here is my dilemma:

The Set Up

I’m designing a simple combat strategy game.

  1. Two combatants attack each other for a certain amount of time.
  2. The winner is the one with the most health after the time is up.
  3. There is no direct intervention by the players during the fight. Players define some strategies for their combatant before the fight, and the “AI” (term used loosely) determines what the combatants will do.
  4. The fight consists of an arbitrary timer that “ticks” seconds, and a combatants’ attack speed (among other things) determines how often they do something.
  5. Besides the combatant objects, there is also a “weather” object that can have some random environmental effects on the combatant’s abilities.
  6. The whole thing just loops through each second, environmental effects and attacks are determined and executed, it’s all logged, and the log is displayed to the user afterward as a play-by-play.

The Problem

I’m not sure what design pattern would best allow me to accomplish the above. I’m looking for a pattern that will allow me to increase the complexity of the “fight” down the road. Probably by adding more objects to the fight (more combatants, maybe a new environment object, etc.)

At first I thought the Observer pattern would work. I would have a fight object that represents the “observee/subject”. It tracks a timer, and as the timer increments, it updates all of the participant observer objects. However, a lot of a defender combatants’ parameters can affect actions of an attacker combatant, so the “observers” in that scenario need to be aware of each other, so I’m not sure if it’s the right approach.

Finally, I’m not trying to nail a design pattern perfectly. Maybe there is no “best fit.” I’m just looking for a solid base to build upon.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:35:21+00:00Added an answer on May 17, 2026 at 7:35 pm

    If you really wanted to use a pattern here I would consider a command pattern.
    For example you can just que up a string of commands “fight moves” to execute over a period a time. You would also be able to easily cancel commands based on what the opponent is doing quite easily and generically. You can easilly add to moves/ strategies to this as your develop your game down the road.

    But this isnt a pattern for the entire game, it’s more a solution for one aspect of it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost
I originally asked this question on RefactorMyCode , but got no responses there... Basically
I originally asked this question , but in finding an answer, discovered that my
This question originally asked which is the best method for uploading files via SFTP
This question originally asked (wrongly) what does | mean in Python, when the actual
I originally asked this question on ServerFault and haven't got any response and I
I originally asked this question on Super User but was told that it might
I have already asked this question on SuperUser but it was suggested there that
I need to get execution time in milliseconds. Note : I originally asked this
(The original question was asked there : http://www.ogre3d.org/phpBB2/viewtopic.php?t=44832 ) Someone asked : While I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.