Help with a turn based game
Hey everybody. Im making a Turn-Based game. Ive pretty much finished the game lookwise but I need to insert all the cammands. I ran into a problem with the turn based stuff. The problem being i dont know what to do. :crazy: By that I mean, how would I be able to make it where I can only go so far and the same for the computer/other person. Also has would I make it so the computer can go around walls and things instead of threw them? Also can someone tell me how I can make it so when its Player A's turn, Player B cant move if you click and vise versa. Thanks in advance!
Re: Help with a turn based game
"By that I mean, how would I be able to make it where I can only go so far and the same for the computer/other person."
Assign a counter to count the number of moves for player 1. Use a second counter to do the same for player 2.
"Also has would I make it so the computer can go around walls and things instead of threw them?"
Create collision sensors - invisible sprites that border your main object (top, bottom, left and right sensors). Test to see if a sensor is colliding with a wall then do the appropriate action, e.g. if top sensor hits a horizontal wall, then restrict movement to only left, right or down.
" Also can someone tell me how I can make it so when its Player A's turn, Player B cant move if you click and vise versa."
Set all the actions for each player's turn as a group of events. When it's player 1's turn, activate the group 'Player 1', deactivate group 'Player 2'. Do the opposite when it's player 2's turn.
Re: Help with a turn based game
Thanks for the info, it really helped me out. But about the first one, how would I make it stops at each panel when you use the arrow keys and tap a direction, Ex: Player A is on a panel and theres 5 panels to the right of him. How would I make it so he moves onto the 1st panel stops then if you decide to push it again he goes to the second panel stops and so on. Im trying to do it by making the hero a path movement and making a node at each box but I dont know how to make him reverse by doing that is there a easier way? Thanks in advance
Re: Help with a turn based game
Oh, I knew i was forgetting something, i meant to say this before, how do you make the computer "smart" as in it will try to go to the enemy and attack it instead of going where you make it go? Thanks in advance.
Re: Help with a turn based game
"how would I make it stops at each panel when you use the arrow keys and tap a direction, Ex: Player A is on a panel and theres 5 panels to the right of him. How would I make it so he moves onto the 1st panel stops then if you decide to push it again he goes to the second panel stops and so on."
Use a counter or a flag.
Set the initial value to 1. When a direction key is pressed and the value of the flag = 1, set value to zero and move once. When all direction keys are not pressed, set the value back to 1.
"how do you make the computer "smart" as in it will try to go to the enemy and attack it instead of going where you make it go?"
Pretty much same idea as described in this thread, only make it turn-based as discussed earlier:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=215256#Post2152 56
On a very basic level, Turn-Based gameplay is just Real-Time slowed down . . .
Re: Help with a turn based game
1. Use a grid movement. There are some examples of that kind of movement on my website, using fast loop. Look at the Site Map.
Marv
Re: Help with a turn based game
Not to be rude or anything but I think you're asking us to explain how to make all of the gameplay... which isn't really what you should be doing. You should be asking more specific things and figuring out the general stuff on your own.
So far you've basically asked:
- how to set up turns
- how to move the player
- how to move the enemy
- how to create pathfinding
- how to make enemy AI
I mean, short of asking us how to attack and deal damage and determine a winner... you've basically asked how to make a turnbased game.
I know you're learning or whatever but you really should at least attempt some of this stuff on your own. If you don't know how to use MMF, you need to learn that first. The rest of this stuff is just experimentation with the knowledge you have. Like how to declare a turn... well you'd want to most likely use a flag or something to determine whose turn it is. This is stuff you should know if you actually spent some time learning the program.
I think people here are being a bit too nice. But maybe I'm just in a bad mood? :P
Re: Help with a turn based game
well about what the person said above i was kind of thinking that as well, however I have given it a few days of thougt before coming here. I was about to quit this project before I remembered about this place. I did ask for a lot of help but I just couldnt grasp it myself -.- and after searching around a while I found out a lot of people are also having trouble with the AI (giving the cpu a brain) which I still need trouble with, besides the things ive mentioned I have the game finished already which i posted originally. So, maybe I am asking to much, idk Ive never used this before. But the forum is for help with what you dont understand right?
Re: Help with a turn based game
Can someone explain how to make the computer think for itself? Ex: go up to the enemy and attack it instead of following a path you make. I dont think I can figure it out. Thanks in advance
Re: Help with a turn based game
thebeast250...how much experience with MMF2 have you had before?
Try making a realtime game, because as someone said above, turn based is just real time at a very, very, very, slow rate.
Try making an enemy that looks for the player and travels around the map hunting the player.
Try usign a giant invisible circle around the player (and when the enemy is over the circle, it "looks in the direction" of the player, using a bouncing ball movement)
Get the enemy to be "stopped" and then "go" when it touches the circle.
Use flag on/flag off to accomplish this:
Quote:
+ Enemy overlaps player LineOfSight [the circle]
== Enemy flag 1 on
+ Flag 1 on
== Enemy movement "on"
== Enemy look in direction of Player
Use a "negation" to work out the opposite.
You need to experiment yourself -- MMF2 has many hundreds of ways of accomplishing the same thing.
My above example will teach you about flags and about making an "intelligent" enemy -- one that will only chase the player when it can "see" the player, as against if you used JUST a bouncing ball/LookInDirectionOf (which would eternally chase the player)
Now, once you have succeeded in creating a good Real Time enemy, slow things down to a stop.
Use a single counter to work out whose turn it is:
Quote:
+ If Counter = 0
== Activate Group "Player Turn"
+If counter = 1
== Activate Group "Enemy Turn"
+ Player clicks "End Turn" button
== Set counter to 1
Stuff like that. Get that working, first, then take another step.
Don't do this all at once.
Pathfinding is one of the hardest things to program, so take it very slowly.
Use the "sensors" around the player to check if it is touching anything. Eg:
Quote:
+Always
== Set SensorLeft to -32,0 from Player
[For a left facing , 32x32 active object]
+Player presses Left key
+[NEGATE]SensorLeft overlapping ActiveWall
+Player AltValue "Moves Left" >= 1
== AltValue "MovesLeft" sub 1
== Set player position X to Player Position X-32
Those conditions above will make sure the player never goes outside of the Walled area and will only move if it has enough moves left.
Put that together, now, with four sensors, a counter and an end-turn button.
You have a player that can only move if it has enough move points left and has been restricted to the game screen (if you have the relevant active objects positioned about the place)
The wall condition also allows walls to be placed inside the map, making a maze that the player has to walk around.
So go away and try that, and then come back and with a little more knowledge, ask again.
I'm not being mean, just giving you a reality check like Konidias did. You need to get some practice under your belt and then attempt bigger things.
Start with Real time, then move onto turn based. Learn about flags, group activation, counters, checking alterable values and all that sort of stuff, and keep on trying.
Re: Help with a turn based game
Well, experience wise id say im a little above average probably around that level. I like the thing with the circle, it worked out. But how would I be able to stop it, like slice it up into moving one square at a time? I know how flags work pretty well, and I got the whos turn it is down. I pretty much got the sensors down too. I've already made "Real time games" and I got bored with them, I actually know my stuff with this program pretty well. Its just with making the enemy movements think for itself 1 square at a time I can't handle. Do you think you can help me out with that, its the last thing I need to completing the game, the enemy movements.
Re: Help with a turn based game
I just thought of a good example of what i Nedd. Have you guys heard or played mummy maze? Thats exatly what I need minus the walls and stuff. How you move and he moves after only a certain amount. Thats what I need
Re: Help with a turn based game
Since you have the basics of MMF2 down, the programming part should be easy enough. I find flow charts help when working out AI.
Start by listing the actions you want an enemy to be able to do along with any conditions that apply, and then list all checks that need to be made.
Try drawing a flow chart (or several) of what you want a single enemy to do, and then start programming each decision little by little, testing as you go.
Do some research - play a few strategy games, and while you're playing them, think about what decisions the CPU is making, what checks need to be done etc. so you understand what's going on behind the screen.
As the others have said, you really need to figure this out for yourself, it's the only way to really learn how to do it, it's what I did. :P
Re: Help with a turn based game
First mistake you made - you focused on graphics before even completing an engine.
You should make a basic engine FIRST, work out gameplay, AI, rules etc. THEN focus on graphics once you know whats going on.
Things you should research:
- Pathfinding
- AI (general subject, search the internet for game AI)
- Fastloops, counters, etc
Re: Help with a turn based game
OK then theBeast250, try this...
When it is the enemies turn, get it to "shoot" a 1x1 active in each of the four cardinal directions (North, East South West).
Then do coding:
Code:
+If EnemySightBobbleLeft collides Player
== Enemy position = Enemy-32
(Change 32 to the size of each tile you have)
also:
Code:
+ If EnemySightBobbleLeft collides wiht Wall
== Destroy
If I'm right, this should work almost perfectly to find the player if the player can be 'seen'.
Try this and then post back. Good luck! ;)
Re: Help with a turn based game
Quote:
Originally Posted by Graeme2408
Since you have the basics of MMF2 down, the programming part should be easy enough. I find flow charts help when working out AI.
Start by listing the actions you want an enemy to be able to do along with any conditions that apply, and then list all checks that need to be made.
Try drawing a flow chart (or several) of what you want a single enemy to do, and then start programming each decision little by little, testing as you go.
Do some research - play a few strategy games, and while you're playing them, think about what decisions the CPU is making, what checks need to be done etc. so you understand what's going on behind the screen.
As the others have said, you really need to figure this out for yourself, it's the only way to really learn how to do it, it's what I did. :P
What he said.
Enemy AI is literally just flow charts. You're just checking for conditions and then having actions performed depending on those conditions.
Is player near?
Yes. Then initiate follow movement pattern.
No. Then play idle animation.
Most things don't even need a flow chart, it's really just "if this is happening, do this". You just have to break it down into pieces and build it up. You can't expect to write an entire enemy AI in a few minutes and then have it work perfectly and also make you pancakes and become your best friend... It's going to take testing and experimenting and it's not just something people can tell you how to do.
That's why AI is like the hardest thing to program. It's not easy to make a program "think".
Re: Help with a turn based game
Well, I tried the thing with the shooting the arrows and I guess it was a setp towards the right direction, but it didnt help if he was say 2 square to the left and 1 square up. Even if i made more directions he would go diagonal on the squares instead of along each one... and with the flow charts. I would probably have to severely shorten or make the game much easier because at one point theres 4 different enemys on one map and setting them all up with that would take way too long. and to set every setting for every enemy will probably be too much for me to do. Maybe I should just give up?
Re: Help with a turn based game
Quote:
Originally Posted by thebeast250
Maybe I should just give up?
Don't 'give up'. Maybe, take a break. Work on a new game for a week and then brainstorm up some ideas.
The more you work with MMF2, the more you learn about it and think of new ways to do things.
Don't get depressed, as I have said before, this is perhaps one of the hardest things to program in a game, so what you are attempting to do is quite advanced.
Try to get one enemy working perfectly, then just clone the event data and replace it with your new enemy as neccessary.
Take a break for a few days, or a week and then go back to it.
Don't. Give. Up. :)