ASCII roguelikegame

Heya, I am a newbie working on an ascii roguelike, but I have not figured out how one can make BOT players move at the same time as players. Not after a player has moved, but also even if he stands still? Cause that would mean that two things is running at the same time, doesn't it?

I read that maybe it has to be done using threading?
If so I guess I assume it will be hard for me as a newcomer to create.

But I appreciate any thoughts on this!
What game are you trying to create?
Threading means 2 things running separately in their own time, not necessarily at the same time.

If you want them to move in the same CPU cycle, you'll need to create your code so they can do that. I'm not exactly sure it can be done as easy as I describe but the general idea is:
1
2
3
4
5
Pseudo code
playersNewLocation=1,1;
MonsterNewLocation=2,1;
movePlayers && moveMonsters;
or movePlayersandMonsters;


In general the CPU does one thing at a time. I think your talking about creating the illusion that it's happening at the same time such as...
1
2
3
Move players;
Move Monsters;
Update Screen;


Last edited on
Thanks for your input.
I am just building a simple bomberman game in console for learning the basics.
Creating the illusion that it is happening at the same time was the idea I worked on.
But I thought it would look boring as for the reason that Move players would mean that the "BOT" has to wait for player
GETCH(); before they will be able to execute their movement. Which means that a BOT would never move unless player has moved. Which makes it a bit ugly/boring!

Is there any solution to this that is not too complicated?
Even if the solution is complicated I'd gladly listen and give it a try to learn.
Last edited on
could use the non-standard kbhit function found in conio.h.

http://www.cprogramming.com/fod/kbhit.html

There is also PeekConsoleInput.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms684344(v=vs.85).aspx
Topic archived. No new replies allowed.