BASIC

Author Topic: GLBasic and implementing AI  (Read 2489 times)

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
GLBasic and implementing AI
« on: 2010-Mar-10 »
Hi

I'm working on a clone of Lords Of Chaos, a fantasy turn-based strategy game that was available on the old 8-bit & 16-bit home computers - arguably the best game of its kind from that era. I'm a couple of weeks away from finishing the basic tileset & sprites and then I can start coding the map editor.

I'm not new to programming (Basic, Assembly and web specific languages) or OOP (some Java experience) but I thought I should learn something new. After spending some time considering which language to use I was going to go with C++ but then it occurred to me that I might be making things much harder for myself than necessary. Maybe GLBasic would be more suitable. It does everything I need for the basic game engine and I take it I can call C++ routines from within it if need be. I've decided to try GLBasic first of all to see how that goes. Anyway, more on the game...

The game mechanics will be (relatively) easy to code. In a matter of a few months I'll probably be able to reach the point where the game is playable as a one player experience without any enemy AI. I don't need fancy graphics, real-time physics, fast frame rates, networking, particle engines, etc. Look at a screenshot from the original Atari ST version to see why:-



My game will look very similar, but in 640 x 480 instead. Here's the thing: The enemy AI is everything in this game. It's 95% of why it was fun to play and by far the most advanced thing I'll be doing. For example, I'll need my own special A* pathfinding algorithm, goal driven teamwork, complex state-driven agents and some rudimentary scripting for setting behavioural traits in the map & agent editor. If that sounds ambitious, it is. My question is, can anyone think of a reason why GLBasic wouldn't be a good choice if complex AI needs to be introduced?

No matter which language I use the AI component of the game will be by far the most difficult and timely part. I can't think of any reason why GLBasic would be worse or better than another language in this respect. I guess I'm just fishing for advice here. Can anyone with experience in GLBasic see potential problems arising?

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Re: GLBasic and implementing AI
« Reply #1 on: 2010-Mar-11 »
Incidentally, the FINDPATH() command would be perfect for the A * pathfinding algorithm I need if it only dealt with diagonals as well as the 4 main directions.  :)

MrTAToad

  • Guest
Re: GLBasic and implementing AI
« Reply #2 on: 2010-Mar-11 »
I dont see any real problems, although limiting to 640 x 480 does mean you wont be able to do a iPhone or GP2X version...

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Re: GLBasic and implementing AI
« Reply #3 on: 2010-Mar-11 »
You're right. Talking about a 640 x 480 display was hasty. There is no reason I can't create a 320 x 240 display for GP2X after the PC platform version has been completed. Since yesterday I've actually increased the PC resolution to 800 x 600 because then I can fit in a neat mini-map and other useful things.

After playing with GLBasic all day yesterday I'm convinced GLBasic is right for what I'm trying to do. I also had a lot of fun with it!  :-*

As part of trialling GLBasic I'm going to implement an A * Pathfinding routine that can make use of diagonals with a little math cheating to speed it up. I'll be away for a week so I'll write it & post results on the forum when I get back. I'm guessing it will be a lot slower than the FINDPATH() so it will be interesting to find out just how much slower by comparing results! Alternatively to writing my own routine, if I can figure out how to make use of C++ code embedded in GLBasic I would use something like this: http://www.grinninglizard.com/MicroPather/index.htm