R0J0hound's Forum Posts

  • One more:

  • mercuryus

    Updated it with a small change and now it takes about a second less time. Now instead of loop{save->minimax->restore} it does save->loop{minimax->peek}->discard.

    With algorithmic code like this you can implement it in JavaScript and get a 10x speed increase.

  • Depending on what movement behavior the target uses they can have an expresion to get velocityX and velocityY, or Speed and angleOfMotion. You can convert the latter to vx,vy with:

    vx = speed * cos(angleOfMotion)

    vy = speed * sin(angleOfMotion)

  • mercuryus

    Well I finally took a crack at it and it appears to be working. I wanted to go for a simpler game so I went for checkers instead of chess, and even then I didn't add all the rules. Mainly it lacks kinging and any winning conditions.

    https://dl.dropboxusercontent.com/u/542 ... imax2.capx

    Not exactly simple but it only has 85 events total. The minimax algo takes up about 12 of them. The rest are for things such as generating move lists, moving pieces and saving and loading the board state from a stack.

    It is a tad slow on my machine with 8.5 seconds for a minimax depth of 3. Rest assured it isn't the function object that is slowing it down. The main culprit is the save and restore functions and the generate moves function in the minimax function. It can be made faster i'm sure, but I'm done with it right now.

    -cheers

  • Vx and vy are the x and y velocities of the target.

    Instead of atan2(y,x) you can use angle(0,0,x,y)

  • spacedoubt

    Haha, quite an idea but it hasn't given as much pain as that printer did.

    newt

    Interesting, but I couldn't use anything from the imac with that. Maybe the flatscreen but it's hardwired in and I don't like the imac case that much. Interesting stuff to mess with none the less.

  • AnD4D

    Are the objects created and destroyed at runtime?

    You could do this if the first 4 instances are controllable and the last 4 are ghost.

    Sprite Boolean "ghost" is set

    --- sprite set x to sprite(sprite.iid-4).x+400

    Or if you just want each instance with ghost set to be at an offset you could do

    Global otherx=0

    Repeat 4 times

    ---Sprite is ghost

    ---pick sprite instance loopindex

    ------set otherx to sprite.x

    ---sprite is not ghost

    ---pick sprite instance loopindex

    ------sprite set x to otherx+400

    Of course with that example there are 8 instances.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What have you done so far? First would be a way to score the board, so the algo can know what is good or bad. One simple idea would be to add 1 for each white piece and -1 for each black. So then you could loop over all the possible player moves and pick the move with the best score for that player. You could look more moves ahead so the cpu chooses a better move, but the computation time will exponentially increase.

    You can actually impliment the algorithm exactly like in wikipedia. The tricky bit will be generating the list of moves from the game state. I did a chess game and didn't get to ai since I'd need to vastly rewrite it.

  • Impressive. I should log in more...

    Maybe if I write an automation script to log me in everyday. But why stop there, I could also make it reply to a random topic with some random Chinese proverbs. Either that or pm newt everyday with a random name of a cheese and see if I can sway his eating habits...

  • So my brother acquired an old g4 imac and I've been tinkering with it. It has osx 10.1 so I can literally find no software for it. Not to mention browsing with internet explorer is painful since most sites don't load right. I may add that I won't be putting any money into it since it only cost 6$.

    So my question is what could be done with it? Or what would you do with it?

    So far I've:

    * Booted into the bios and amused myself programming in FORTH and trying to boot from usb and cd.

    * Tried using Linux on it. Driver support is atrocious and coaxing linux to a working state, is too tedious for my liking.

    * Found I could install an apple compiler suite that predates Xcode. So if I was so inclined I can now make apps, that would only work there, from what I can tell.

    Now it's serving as a decorative paper weight, and I'm looking for uses or ideas for it's fate.

  • From the manual a common expression is .asjson and there is also the common action "set from json".

    I haven't used it myself yet but I believe it can be used to clone object state.

  • If the balls are the same size you can do this:

    dropbox.com/scl/fi/1n2mi7y4ov2513xayqcjb/collisionPoint.gif

    Or if they're different sizes:

    dropbox.com/scl/fi/nzja3lar83s14648l9gbq/collisionPoint2.gif

  • One thing you can do is incorporate dt in the move forward action. The frame time can fluctuate from frame to frame and dt is the current frame time.

    So instead of 1.3 use 1.3*60*dt.

  • Here is a way I did it in a project I did:

    https://dl.dropboxusercontent.com/u/542 ... _menu.capx

    Have a day job: yes, 10 hours

    Occupation: ...

    Average time spent developing in a week: ~5 hours.