Card Game - AI Woes

0 favourites
  • 12 posts
From the Asset Store
Template for trading card game, fully documented in comments and video
  • Hello everyone,

    This is my first post so please be patient with me. I have been using C2 for the past few months and have leaned heaps in this time toying with many different kinds of projects (platformers, smups, adventure games etc) and have decided to do my first full app to completion on a card game I play with my kids. I am planning on publishing this to IOS to begin with if I can get it to work...

    The rules are simple, the first player who discards their entire hand wins. There are 4 players (1 human, 3 AI), and you discard numeric values, each player discards the same value +/- 1 as the player previous. The twist is you can lie about your discard. So you can put an Ace down and say it was a 5 etc (up to 4 cards at a time). But if you get caught lying you pick up the entire discard pile.

    To allow this to happen in the interface I have your hand where you select the card/s to discard, but before you click 'DONE' you must click one of the icons in the row at the bottom of the screen (should be clear when you see it). I haven't done the tutorial so sorry if it doesn't make sense at the moment.

    What I've done so far which works.<img src="smileys/smiley1.gif" border="0" align="middle" />

      - shuffle and deal cards
      • reorder hand
      • player hand browsing
      • player card selection and discard
      • assign face value to each card

    What I can't get to work.<img src="smileys/smiley19.gif" border="0" align="middle" />

      - compare AI hands to discard and take appropriate yet random course of action. e.g. place their cards down or call 'CHEAT'(it freezes at the moment but I did have this kinda working a while back but I don't know what I did to kill it...)

    I have been stuck at this stage for a week or so and I don't know how many different ways I can try but I've tried more than I care to recall.

    Also, I don't know how to attach a capx so if you would like to lend a hand (also let me know how to get you the file) please let me know. None of the art assets are done so it is very poor in aesthetics right now.

    Thanks for taking the time to read this post.

    Brett

  • Worked out how to get my public folder back into Dropbox. <img src="smileys/smiley36.gif" border="0" align="middle" />

    Here is the link to the capx.

    dl.dropbox.com/u/31121080/Cheat%20-%20Stuck.capx

    Thanks again!

    Brett

  • Ah man. I wanted to look into this. But you have a custom plugin. I try to just help Vanilla C2 projects as it becomes too difficult to download every plugin people are using.

  • Hi IsometricRobot, is there a way to save without the plugin?

  • I'm sure you could make a temporary copy of your project and just remove the plugin from the second copy. It looks like the plugin is some Font plugin that I get the warning about. the game may not work properly, but that should not really affect the section in question.

  • I know what the plugin is, SpriteFont. All my text is done this way as I don't want font issues with the app. :(

  • Will try to get a capx done without the plugin for testing purposes.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Alrighty, a no-plugin version has replaced the SpriteFont capx. The same link should work with the updated file. <img src="smileys/smiley20.gif" border="0" align="middle" />

    Brett

  • Hmm,

    I have never had much luck using Blank Sub-Events to regulate OR events into a focused action.

    perhaps you can drop the or statement condition down to the sub event while providing a simple event to trigger when that check is performed (like a Boolean).

    Condition NPC1TurnToCheck = True   - Action Set text Player 1 is considering your move.

    Action wait 2.0

    Sub condition (the or statements) - action Set text Player 1 says Cheat!

    Action set call_cheat to 1

    Action set Player_Cheat to 0

  • Thanks so much for your help IsometricRobot!

    It didn't fix my issue but I managed to halve my AI code after your suggestion twigged an idea.

    Subsequently I found the freezing issue which had nothing to do with the AI, lol. I must have dragged a condition to the front of the script which stopped progression when the player 1's turn was up.

    It happens with mouse driven interfaces I suppose, I'm so used to typing all my JavaScripts at work I didn't think that the issue could have been put down to an accident like this.

    Now I can start debugging the AI without the script freezing! Thanks so much again, I'll remove the capx from Dropbox now because I should be OK from here on!!!

    Brett

  • Glad I could help in some round about way :D

  • I think the link is broken <img src="smileys/smiley19.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)