I am programming a lot of turn based game, all text, but how do you program real time combat in games, like an rts, or a shooter, where everything is not input based


closed as not a real question by Jesse Dorsey Jul 18 '12 at 22:46

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    \$\begingroup\$ With a big loop... you should be more specific in your question. \$\endgroup\$ – Valkea Apr 4 '12 at 16:50
  • 2
    \$\begingroup\$ Do some research. This is a VERY broad topic. \$\endgroup\$ – notlesh Apr 4 '12 at 17:15

Real Time games are just Turn Based games where the turns go by really fast. Also a "turn" doesn't pause to wait for input, instead either polling keyboard/gamepad/mouse states or getting the information via events.

The game loop is your friend. Here is a more detailed explanation of some of the basic concepts and techniques involved.

As a side note, making a real time text based game is going to be difficult due to the nature of the console window. I'd recommend reading up on some basic graphics/input handling so you have a good platform to work from. SDL is a good choice if you want to dive in and Lazy Foo' has some excellent tutorials on the matter. As a bonus, the game loop structure is used in a number of the tutorials so you'll have some actual implementation to experiment with.

  • \$\begingroup\$ MUDs / text-based adventures are good examples of real-time text loops. \$\endgroup\$ – Kzqai Jun 28 '18 at 5:07

Event handling in OOP or a loop if you're using a more traditional language.

  • \$\begingroup\$ Well even an event handling system needs a loop as far as I know ;) \$\endgroup\$ – Valkea Apr 4 '12 at 17:15
  • \$\begingroup\$ yes, that's correct, I guess I was trying to add a tiny bit of detail to the generality here.... \$\endgroup\$ – Philip Apr 4 '12 at 17:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.