March 24, 2019, 08:18:54 AM

Author Topic: Qube's 8bit-wars comp entry - Untitled project  (Read 1612 times)

Offline MrmediamanX

  • Full Member
  • ***
  • Posts: 114
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #30 on: February 15, 2019, 03:55:38 PM »
AI? yikes ... my usual method is generally move,attack,stop,reset or rush,retreat,reset.
if it's anything beyond that ... i'm out. 

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1616
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #31 on: February 15, 2019, 04:00:37 PM »
Ooo AI.  I've just gone for a simple fun quirky game I liked on the old Speccy - and re-visited it; so no need for such coding.  Good luck with the problem, I'm sure you'll crack it.
It's only for a small part of the game but I fancied having a crack at it ;D me and my stupid ideas :P. Think I'm on the right track now though as I appear to have had a bit of an early breakthrough thanks to shoving a load of debug info on screen.
Until the next time...

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 1564
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #32 on: February 15, 2019, 04:37:14 PM »
Quote
It's only for a small part of the game but I fancied having a crack at it ;D me and my stupid ideas :P.

That's partly what the competitions are about IMO - to learn new things.
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)

MacOS Mojave, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.

Offline Xerra

  • Sr. Member
  • ****
  • Posts: 482
    • Retro Evolved
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #33 on: February 15, 2019, 04:59:19 PM »
I've got AI at the back of my head constantly, even though I'm a long way from putting other cars on the road in my game. I don't actually have a road for starters - the one I showed before was a tiled dump of the NES original game. In my head I've got rough ideas how the different cars should interact but I wouldn't start until collision detection was in so the road can be the extra weapon.

A state machine is going to probably be the way because they have to lose control for a while, rather than driving along doing whatever they should be doing, and also they need to move with the road so it appears they are accelerating to keep up with the player and do nasty things - unless they're not an enemy, of course.

All sorts of stuff to think about - not looking forward to it but i'm sure it will come together when it's time to start.

Offline DaiHard

  • Jr. Member
  • **
  • Posts: 25
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #34 on: February 15, 2019, 10:59:46 PM »
Sometimes the interesting thing with AI is working out how BADLY you want it to play! It's no fun competing against a perfect opponent -you are bound to lose. I think I first realised that with a moon lander program in the 80's: in the end I think I programmed it to land with something like a 10% safety margin, giving me JUST enough scope to beat it, if I played accurately...

:-)

D

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1616
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #35 on: February 16, 2019, 05:44:47 AM »
I'm making some good progress and 60% of the time the AI is making good choices. This leads me to believe there are some tiny logic bugs in my game code which build up and sometimes result in a bigger error outcome. I think as things stand now I need to somehow visually output every choice made by the code so I can see where it's failing ( knowing my luck it's a stupid mistake )

OK... As a small part of the game I'm doing you can play a custom Speccy version of Puyo Puyo and it's you vs the computer. It's probably not the easiest of AI's to code if you've never really done this sort of thing but I do love a challenge ;D

The basic idea of Puyo Puyo is to match four or more blobs of the same colour together and also make chains ( 4+ the same colour explode, board falls down and creates more 4+ blobs, etc etc ).

Currently the AI side looks for the best match across the columns ( including rotations of your two pieces ) + takes into account the effect of such action, i.e. the knock on effect of creating chains. If you watch the YouTube video you'll see that there are quite a few things for the AI to decide, eg, position, rotation and knock on effect. I also assume that greater AI's would use the upcoming colour combinations to work out the best scenario but all I'm after is a pretty decent CPU player and not some master wizard who never makes a mistake.

But as it's not always accurate there is definitely a bug or bugs somewhere in the logic. It's driving me absolutely nuts but I'm determined to sort it. I'm giving it the weekend to sort out but if by Sunday evening I've not figured out what's wrong then this side will be ditched, but I will come back to it after the comp as I refuse to fail :P

As said in a previous post, coding AI is not my thing but as it's a weak area of mine I thought I'd dive into a challenge ( as I like to do with the comps ) and it's been good to take a task and break it down into as simple as possible logic steps. Should've picked something like connect-4 / tic-tac-toe but that would have been a cop out.

I probably shouldn't be spending this amount of time on a small part of my game but I'm like a dog with a bone when I start things :P
Until the next time...

Offline 3DzForMe

  • Sr. Member
  • ****
  • Posts: 440
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #36 on: February 16, 2019, 04:03:09 PM »
@Qube
Quote
Although there are some Spectrum games that do colour clash as per the video above. I wanted to do the other method which turns out was harder to do but luckily managed to get it sorted. Faking this stuff is madness on modern tech :P

Colour clash test 2 - The correct way, go speccy go ;D
Wow, you're attention to detail with the colour clash is such great attention to detail, kudos.

@col...
Quote
Ahh the good ole days :))
I'm sure that description was as confusing as hell itself so here's a loading screen on Youtube showing the data being loaded sequentially straight into the screen memory location.
Its funny how the old grey matter works (or doesn't) I was genuinly thinking of invoking a screen loader of a similar nature to the Hobbit (but a lot faster... real time tape loading was defo for the eighties. Yep, blowing the 'authenticity' of the spectrum out of the window.) Maybe I could make up for it by prompting 'Select your tape players volume' inside a randomizer, so every time you try to load the game, you need a different number. Too much?

@Qube
Quote
I probably shouldn't be spending this amount of time on a small part of my game but I'm like a dog with a bone when I start things :P
I'm sure it comes from coding on the Speccy, gives you tendencies to go that extra mile ;)

happy coding ;)

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1616
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #37 on: February 16, 2019, 07:35:21 PM »
Quote
Wow, you're attention to detail with the colour clash is such great attention to detail, kudos.
Quote
I'm sure it comes from coding on the Speccy, gives you tendencies to go that extra mile ;)
I like to add new challenges when doing a comp entry to push myself to do new things ;D
Until the next time...

Offline Derron

  • Hero Member
  • *****
  • Posts: 1685
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #38 on: February 16, 2019, 07:41:33 PM »
Regarding that bug and how to tackle it:
- instead of "random" use a mersenne twister pseudo random generator for everyting "not an effect" - so which blob colors are selected for new "blobs", for moves of the AI.
- let both players be played by the AI
- on game start set a fixed "seed"

That way you can play the same game over and over and see what happens if you change something (from that moment on the game might differ). This works as with mersenne PRNG and a fixed seed the random numbers are known in advance - and will always be the same on each restart. So if everything is based on this random numbers it will "play the same game". Nice to checkout stuff.


bye
Ron

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1616
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #39 on: February 16, 2019, 09:01:17 PM »
Regarding that bug and how to tackle it:
- instead of "random" use a mersenne twister pseudo random generator for everyting "not an effect" - so which blob colors are selected for new "blobs", for moves of the AI.
- let both players be played by the AI
- on game start set a fixed "seed"

That way you can play the same game over and over and see what happens if you change something (from that moment on the game might differ). This works as with mersenne PRNG and a fixed seed the random numbers are known in advance - and will always be the same on each restart. So if everything is based on this random numbers it will "play the same game". Nice to checkout stuff.
Yeah, I just went for the easy route of putting numbers into an array so the game always plays the same and makes the same mistakes / errors so I can pin down the issue and know when it's fixed :)
Until the next time...

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1616
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #40 on: February 17, 2019, 04:54:11 PM »
Woohoo, got the AI to work \o/ - Plays a pretty decent game so that's me done on that side ;D

Until the next time...

Offline Rick Nasher

  • Hero Member
  • *****
  • Posts: 660
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #41 on: February 18, 2019, 03:07:07 PM »
Good to hear, but don't get ahead of your powers for you might turn into Dark Helmet.   ;)
_______________________________________
 B3D + physics + shaders + X-platform = AGK!
:D ..ALIENBREED *LIVES* (thanks to Qube).. :D
_______________________________________

Offline chessish

  • Jr. Member
  • **
  • Posts: 7
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #42 on: February 18, 2019, 03:11:48 PM »
Looks good!
keep up the good work

Offline therevills

  • Sr. Member
  • ****
  • Posts: 460
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #43 on: February 22, 2019, 11:46:24 PM »
Woohoo, got the AI to work \o/ - Plays a pretty decent game so that's me done on that side ;D

Screenshot or it didnt happen  :P

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1616
Re: Qube's 8bit-wars comp entry - Untitled project
« Reply #44 on: February 23, 2019, 04:47:01 AM »
Screenshot or it didnt happen  :P
Lol a screen shot won't show the AI in action :P - Also my Speccy version-ish of Puyo-Puyo won't win any graphical awards as I'm aiming to keep all the graphics very basic on purpose. As it's just a small part of the overall game planned I don't think it'll be worth posting any screen shots of it as it's so basic looking compared to the other entrants screen shots and I don't want to give a false impression of the overall game ;D
Until the next time...