Make an algebraic expression solving game.

Hi there!

I am working on a project which involves making an educational game for Kids 11-14. Since I already design stuff in blender I thought to go with blender game engine.

I am looking to make a game where the player has to solve an algebraic expression. Each term of the expression is on a separate block( or crate or something similar). The player has a time limit in which if he/she fails to complete the expression correctly, a truck comes from the side and crushes all the crates. It will be a level game( play one stage, move on to the next one until you get the answer wrong)

Now if this were an animation or a render I would have done it in an hour or so, but I am absolutely new to the Blender game engine and hence have no idea of how to make all this interactive…

I have the following questions-

  1. Lets say I saved 50 expressions for my game to use, how do I make the expressions come up in a random order, or in an order of increasing difficulty?
  2. How to I actually make all this? (Sorry but yeah, no idea about this… I mean I can make all the elements in blender no prob, but how do I make them coordinated like a game?)

Thanks!

Answers
0. python

  1. random.choice of the current difficulty level challenges
  2. python

I would suggest creating a list of things that need to be done in order to achieve your goal.

For example you would need:

  • Math
    [LIST]

  • Equation solver or solutions

  • Character controls

  • Character rig

  • Keyboard movement

  • Camera controls

  • Object grab / placement controls?

  • UI

  • menu?

  • etc
    [/LIST]
    See if the list has anything you are able to do (then do them) or if not break the goals up even further into smaller pieces until you are able or learn further python/bge-api.

I can do python pretty much (have been writing image processing codes in it).

Okay so Menu- done already

  1. Math… Hmmm what about a source data file having all equations? I could then display them sequentially…

  2. Character controls… Done mostly.

Before going into deeper some questions from my side:

How does the player know what the game expect the player to do (e.g. where to place what)?

What do you think the parts of the expressions should look like?
Expression typically consists of terms and operators. You said terms are on a block. Where are the operators?
How do you think the game should determine an expression is solved? How does that look like?

It might be worth to draw one or two sketches on how it should look like. Maybe with a storyboard when happens what (e.g. block is here and player drags it there which triggers the evaluation of the current expression).

Maybe you create the animation first. So you have your assets ready before you start with behavior/logic.

Details on 1)
50 expressions are too much to be hard-coded (in properties or logic bricks). So I suggest to use Python too.

Here you can apply the randomness pretty well. Python comes with a build in random module.

I suggest to store the expressions in a container (e.g. a list). This allows you to sort/randomize the order with the container, or to do a random access. To avoid repetitive expressions, I recommend to remove the coosen expession. So you get two lists a shringkin list of unsolved expressions and a growing list of solved expressions.

This will work with any content - not just expressions. You need to define the python representation of the expression/level anyway.

Here is an example to manage levels:


import random

unsolvedLevels = [1,2,3,4,5,6,7,8,9,10]
solvedLevels = []
currentLevel = None

def pickRandomLevel():
    global currentLevel
    currentLevel = random.choice(unsolvedLevels)

def solveCurrentLevel():
    unsolvedLevels.remove(currentLevel)
    solvedLevels.append(currentLevel)    

Picking by increased difficulty requires you to order the choice by difficulty. The randomness can’t apply unless you declare expressions/levels of equal difficulty. This way you can do a reandom pick within the set of expressions of hte same difficulty.

Here you see that an expression/level is not that simple. You will need some atttributes like difficulty, terms, solve status…

Just what I was looking for… Thanks for your suggestions… I didn’t went that deep…

Yeah seems like I really missed out a few points… Could you suggest a way of writing those expressions?