• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Game Mechanics A Level Coursework

cdgamedev

Member
I do computer science at A Level and have to work on a project from now until the middle of my A2. This gives me about a year to complete the coursework.

However, I have to have completed the analysis by the end of April. I've been told to focus on AI in particular but am unsure what to research.

Questions:
1. What methods of AI can be used? (e.g. Minimax - the only one we've been told about)
2. Do you know of any tutorials - in any language - that are simple to understand and work primarily on AI?

Thanks,
Callum​
 
L

Lerner

Guest
Can you precize your needs? Because:
- Is making a game mandatory to pass your coursework?
- Do you need to apply exact methods, like AI? Do agent-based programs count?
If your work is only intended to work arount AI theory, you don't need GameMaker Studio per se, and could use Prolog / whatever language exists.
 

FrostyCat

Redemption Seeker
1. What methods of AI can be used? (e.g. Minimax - the only one we've been told about)
If the only kind of AI you can think of has to do with just Minimax, you need to get out more.

Game playing with tree searches is just one of many branches of AI, others include reinforcement learning, classification, clustering, natural language processing, etc. It isn't just about games, and each branch has many of algorithms and variations that can be used. Start with one that interests you.

2. Do you know of any tutorials - in any language - that are simple to understand and work primarily on AI?
You can always search online for descriptions on a specific algorithm or branch of AI, but for you I recommend not looking for language-specific tutorials.

Firstly, given the way you asked the question, I have doubts about your ability to resist the temptation to just copy-and-paste the code. Secondly, if you're serious about CS, you have to learn to work from just the bare foundations, for those times when it hasn't been laid down for you. You have no business calling yourself a programmer if your solution to everything is to ask another programmer to wet-nurse you.

Also, unless GM is specifically prescribed for your curriculum, I recommend that you do it in a conventional language (likely Java, C++ or Python for A-levels). Otherwise, your instructor might not mark your final product if he/she isn't familiar with the GMS environment and needs to pay to test your work.
 

cdgamedev

Member
Firstly, given the way you asked the question, I have doubts about your ability to resist the temptation to just copy-and-paste the code. Secondly, if you're serious about CS, you have to learn to work from just the bare foundations, for those times when it hasn't been laid down for you. You have no business calling yourself a programmer if your solution to everything is to ask another programmer to wet-nurse you.
I get this but I'm not going to plagiarise code; mainly because it voids my coursework xD. But all I was doing was asking if anyone had any methods that I could use for AI as most searches I'd tried came back with no results I was looking for - maybe I'm just not phrasing my searches correctly.

Also, unless GM is specifically prescribed for your curriculum, I recommend that you do it in a conventional language (likely Java, C++ or Python for A-levels). Otherwise, your instructor might not mark your final product if he/she isn't familiar with the GMS environment and needs to pay to test your work.
My teacher has taught GameMaker to another one of his classes (a game development vocational course) and is able to understand the code - at least a little - plus, I've been given the go ahead and can use this language. Also, the only reason I'm using it is because it's the only language I feel comfortable coding in as I've been learning it for about 1-2 years already...

Thanks for the reply,
Callum​
 
S

Storyteller

Guest
chase evade intercept
pathfinding
fuzzy logic
neural networks
tree searches (as Cat mentioned)
probability
flocking

I recommend 'AI for Game Developers' from O'reilly

Its a great book. Im currently translating bits of it to GML for a project Im working on.
 

cdgamedev

Member
Can you precize your needs? Because:
- Is making a game mandatory to pass your coursework?
- Do you need to apply exact methods, like AI? Do agent-based programs count?
If your work is only intended to work arount AI theory, you don't need GameMaker Studio per se, and could use Prolog / whatever language exists.
Sorry, missed your reply on my phone last night - stupid phone...

1. I'm looking at making a turnbased game - similar to rebuild but with different aspects such as controllable (turn-based) combat
2. Yes I do have to make the game to pass my coursework - its part of the worked solution... Which is 25 marks of 75 - if I remember correctly...
3. And I'm guessing so, it's what my tutor mentioned to me... And an agent based program would count (but I've submitted my program proposal already and it said I'm making a game and can't change this now)

But no, my work isn't only intended to work around AI theory, its to show off my abilities as a programmer.

Thanks,
Callum​

(Sorry for double post)
 
M

MishMash

Guest
Given that this is A-Level, from my own personal experience, I have found that the actual complexity of the task you are trying to achieve is less important than going through the whole development process and writing the report as a whole. So I would recommend trying to keep the actual problem relatively simple, having feature-creep or having a really complex code base can become a huge time sink if you are not careful. (As you said yourself, the actual game only makes up for 25 of 75 marks). I elected to ignore my teacher and wrote a programming language compiler for my A-level coursework which was rather time consuming, though having said that, I did enjoy doing it, and I did do very well :) However, the nice thing about the compiler was that it was very modular in that I could have submitted something more bare-bones.

The best sort of game to have would be something that you know a simple AI can exist for. This is something that you should be able to implement quite quickly, but you can always build on it if you feel like you have more time.

Regarding the most practical AI methods, this entirely depends on the sort of game you are making. Most game AI is actually very simple, however this is often considered too simple for pure "computer science" applications.

Standard video game AI (Like a boss or a generic enemy) - Most commonly use some form of state machine which is built as a collection of simple conditions and timers that transition between different states such as attacking, defending, dodging, chasing, etc;

Game Tree evaluation - This is a form of perfect AI that can be developed for games with deterministic outcomes (e.g. chess, noughts and crosses). Essentially, you pre-compute every possible move and the match outcomes and you use a heuristic function to get your AI to choose the move that leads it to the best possible outcome. (For example if one move leads you to win 95% of your games no matter what move your opponent makes, choose that one). In practise, this is much more difficult as games like Chess/Go have so many possible moves that you cannot pre-compute it all, so instead you have to be smarter. Though this is a fantastic place to start if you are making a turn based game with a limited number of moves and fixed outcomes for those moves.
Minimax, as you mentioned, is often what is used to actually make these decisions. The Evaluation will aim to maximise the heuristic score of itself and minimise that of the opponent.
I would strongly recommend this path as it is so extensible. The quality of the AI is often dependent on the "look-ahead" of your AI, this is essentially how many moves forward you can predict. You can increase this by doing things like tree pruning where you discard parts of the tree that are unlikely to happen. You know you can discard all of the moves that give yourself a bad score, and you can also discard a number of the moves that give your opponent a bad score too, as whilst there is no guarantee that they will pick a "good move", if they pick a bad move, it doesn't really matter for you anyway as you are still at an advantage.

As far as working out what moves are best, you would need some way of evaluating the current game state. In chess, you could do something simple like giving each piece on the board a value and counting them. More advanced heuristics would look into things like positioning and attack lines, but that is another natural extension of this form of AI.

Greedy AI - This is a form of AI that does not consider the future but consistently chooses the best possible move to make in any given scenario. This AI is often a nice place to start and can create difficult-to-beat behaviours but can be easily countered once you start thinking about the long game. You would most likely evaluate the situation and give a weighting to each possible move. This would be similar to a single-move look-ahead game tree.

These are just a few things. I would definitely take the Game Tree route if possible, though this requires your game to be designed in a way that it is solve-able with a game-tree. You can even extend it to include a state machine where you only use the game tree if the AI is in a certain state.

Regarding GameMaker, it is quite difficult to actually to pull off complex AI because it is difficult to cleanly represent game-states with gamemaker, and without YYC, doing the computation in real-time is going to be somewhat challenging. (Just because GameMaker isn't the fastest, nor the most memory efficient without YYC). It is possible, but this sort of thing is easier in other languages. One thing you can do (which would get you brownie points) is to use networking to connect an "AI" player to your game. This would allow you to implement the AI in a different language, but allow your game to be written in GM (which is alot easier for the game). You can use the MVC (Model-view-controller) design pattern to organise your game so that you implement the Model and View in GameMaker, but you can implement a controller in GM for the local player, and a controller in a different language for the AI.
(I know i'm blurting things out without explaining them, but they are quick to google).

If you have any questions or need any help, feel free to ask :)
 

cdgamedev

Member
Greedy AI - This is a form of AI that does not consider the future but consistently chooses the best possible move to make in any given scenario. This AI is often a nice place to start and can create difficult-to-beat behaviours but can be easily countered once you start thinking about the long game. You would most likely evaluate the situation and give a weighting to each possible move. This would be similar to a single-move look-ahead game tree.
I quite like this idea - especially with the majority of my enemies being zombies and therefore they don't really need to 'think' about the future.

One thing you can do (which would get you brownie points) is to use networking to connect an "AI" player to your game.
This seems awfully difficult for coursework, granted, I'd get higher marks - or alternatively a really frustrated examiner that doesn't understand both languages. I'll stick to what I know for now...

If you have any questions or need any help, feel free to ask :)
Will definitely spam you with questions then ;). But thanks, if I get stuck then I know where to go :).

Thanks,
Callum​
 
Here's my two cents, pretty much in line with what the others have said already.

1)
The most common tools in the AI toolbox I would focus on first would be:

Movement : Steering Behaviours (This is moment by moment movement of the AI, perhaps not necessary for games similar to Chess however)
Path Finding : How to get from A to B ( A* path-finding is probably the most commonly used and is worth studying, )
Decision Making : What's the AI's goal and what steps to take to get there? : Finite State Machines are a good starting point, with more complex behaviour using Behaviour Trees and GOAP being used more often now.

2)
I strongly recommend this book:
"Artificial Intelligence for Games" (amazon.com link) by Ian Millington / John Funge (Second Edition)

which covers all of the above and more.
 

cdgamedev

Member
Movement : Steering Behaviours (This is moment by moment movement of the AI, perhaps not necessary for games similar to Chess however)
Good point. Though, I probably need this the most :p

Path Finding : How to get from A to B ( A* path-finding is probably the most commonly used and is worth studying, )
Will look into this. Thanks!

Decision Making : What's the AI's goal and what steps to take to get there? : Finite State Machines are a good starting point, with more complex behaviour using Behaviour Trees and GOAP being used more often now.
Another good point. Probably won't use the more complex methods because I'm new to AI - I've never really made a proper AI before - apart from POINT_TO_PLAYER and MOVE_TO_PLAYER... That's not really AI xD

I strongly recommend this book:
"Artificial Intelligence for Games" (amazon.com link) by Ian Millington / John Funge (Second Edition)
Damn that's expensive... Maybe next month? xD

Thanks,
Callum​
 
Top