Charas-Project
Game Creation => Requests => RPG Maker Programming => Topic started by: Thiamor on January 11, 2011, 03:44:32 AM
-
Anyone know of any way whatsoever, to make a simple AI in RPG Maker 2003? I wanted to add 'card games' into my game, and you click the Cards you see on the ground and play the game. I know images will need to be uploaded, but I need some help.
-
AI, jeez... That seems pretty tough, nevermind in rm2k3. The only thing I can think of is a ton of conditional branches. :/
You'd have to plan out exactly how the AI will react to every situation.
-
If you want an actual AI - I can't think of any easy way.
You could always do a substitute AI that bases its' choices simply on chance (randomly). But it all depends on the card game your making since their choices must be playable.
-
Thanks Prpl_Mage for your advice
-
Old topic, but interesting.
I programmed a tic-tac-toe game in high school. The AI was controlled as follows, which each number down being decreasing priority.
1) win the game by getting three in a row
2) prevent the player from winning when it sees the player has two in a row.
3) take the middle square, if it's open
4) take any other square chosen randomly
At the beginning of the game, it was mostly getting down to that 4th option since the first three didn't apply, but near the end the others would kick in to help the AI win and try to stop the player from winning. These were all checked using copious amounts if if: then statements. I honestly can't imagine it being too much less ugly in RPGMaker with conditional branches.
I don't know the rules to your game, but I assume the same basic ideas apply. Unless there is a specific strategy that the AI should follow, random movement is a good fallback to prevent the player from being able to predict their moves.
-
Making a card game would be extremely difficult. However, it's more than possible,
and you'd have a lot of fun stuff to play around with!
-
RPG maker 2k/3 is probably not a good option to make a card game with. If you programmed it in rmxp or some maker with some custom scripting capabilities you could use a minmax algorithm. What a minmax algorithm does is it starts with the current player, and goes through every move they could possibly make, then for every move that could be made, it calculates every possible move that the other player could do. It does this for several iterations (depending on how fast you want the computer to decide a move). At the end, it applies a simple heuristic function to see which set of moves would be the most beneficial, then the computer selects the first move in the sequence. So if you would like to try scripting, google minmax or alpha beta pruning (same thing, more complicated but more efficient).
If you want to use rm2k/3 or event based coding, you can try creating a neural network. Its really a lot less complicated than the name suggests. I'll attach a picture of what a neural network looks like, and try to explain it. Neural networks were inspired by the way neurons work. Basically instead of having a super complicated event, you would break it down into many smaller (and simpler) events. Each of the first level events will be activated if some condition is met. For example, if its a health or point based card game, one of the triggers could be if the other player has more health of points than you. These events should check for everything that you want the strategy based off of. If the condition is met, have it set a switch, boolean, or whatever they're called in rpg maker to true, else set them equal to false.
Then you'll have second level events that check to see which of the first level events were triggered. Second level events will be triggered by any combination of first level events that you want. Each event will have only one possible output which will be the move to do. It could be lay your most powerful card, or lay a card that will do a certain action, or whatever you would like it. If more than one second level event is triggered (so there are multiple moves possible), choose one at random if possible. Also, always have a failsafe move in case none of the second level events are triggered.
(http://smig.usgs.gov/SMIG/features_0902/tualatin_ann.fig3.gif)
-
nice thanks, good information man. :bend:
-
Do you keep making different accounts or something?