Basic4GL Mobile

Getting started with Basic4GL Mobile

This page describes how to create a program in Basic4GL Mobile and get it running on your Android phone or tablet.

Requirements

You will need:

  1. A PC, running Windows 7, 8, or 10, with an OpenGL 3.0 compatible graphics card and drivers.
  2. An Android phone or tablet running Android 4.0 (Kitkat) or later.

Step 1 - Install Basic4GL Mobile on your PC

Click here to download the installer (free version): Download
Windows 7,8,10

Run the file and follow the prompts to install Basic4GL Mobile.

Then run Basic4GL Mobile. You should see the Basic4GL Mobile IDE.

From here you can key in a BASIC program, run it and debug it. You can also view the help files, which explain the Basic4GL BASIC language syntax, and the different commands for computation, sprite graphics etc.

It's a good idea to check everything works, by loading and running a sample program:

  1. Click the "Open" toolbar button or press Control+O on your keyboard.
    This brings up the file dialog, pointing to the Basic4GL Mobile sample programs folder.
  2. Double click the "snakedemo" file to load it into the editor.
  3. Click the "Go" toolbar button or press F5 to run it.

The snake game should popup in a second window:

If you instead get a popup saying "glfwCreateWindow() failed", then it means your graphics card or drivers are not advanced enough.

Updating your drivers may help if you're lucky.

Please note I do plan to make Basic4GL Mobile more compatible with integrated graphics cards (depending on when GLFW adds support for creating windows in software mode - or if I get around to patching it in myself), so keep an eye out for updates.
I apologise to anyone who is unable to use Basic4GL Mobile in the meantime.

You can play snake by left clicking and dragging with your mouse to simulate touching the screen and swiping (actually touching the screen on your PC won't do anything though, even if you have a touch enabled screen).

When you're done, close the window with the mouse or press Esc.

Step 2 - Install the Basic4GL runtime on your phone/tablet

Click here to go to the Google Play store page: Get the
Android App

Or search for "Basic4GL" in the Google Play store.

Install the App, and run it.

The first time it runs not much happens, because there's no BASIC program to run.

The important part is the "Please place 'program.vm' in folder:" message, and the folder to place it in. This is often /storage/emulated/0/basic4gl, but not always, so be sure to check where it is on your phone/tablet.

Step 3 - Create program.vm

"program.vm" is the compiled program ready to be run on the Basic4GL virtual machine.

The Android Basic4GL App needs this, as well as any files that your program uses (like images etc - snakedemo doesn't use any though).

It's easy to create:

  1. In Basic4GL Mobile (on your PC), click "File" and then "Compile for Mobile..."
  2. Select the folder to save it in (the default folder is fine).

Step 4 - Transfer it to your phone/tablet

This is the most complicated step.

Later versions of Basic4GL Mobile and the Basic4GL Android App will connect to each other over the network and synchornise files automatically. But for now you will need a 3rd party application to transfer files over.

You need to transfer:

Other files must be placed at the same path relative to program.vm as they are on your PC, relative to the BASIC source file.

One way is to share the folder on your PC, and use an Android file explorer App that is compatible with Windows file sharing to copy the files over.

Another way is to store your BASIC program (and program.vm) in a cloud storage folder like DropBox, Google Drive or OneDrive, then use a 3rd party Android App to synchronise it with the basic4gl target folder on your phone/tablet.

This webpage describes the cloud storage method, as it is the quickest and easiest method once setup correctly.

You will need to:

  1. Install Dropbox, Google Drive, OneDrive or some other cloud storage folder application on your PC (if you don't already have one) and set up an account.
  2. Copy your BASIC program and any files it uses into your shared folder (or a sub-folder of it).
  3. Install a cloud storage synchronisation App on your phone/tablet.
    I can recommend FolderSync Lite
    I have no association with FolderSync or its author(s), it was just the first App that came up when searching for a cloud storage synchronisation. But it works well, including the Lite version which is free (add supported).
  4. Configure the App to synchronise the cloud storage folder with the basic4gl folder on your phone/tablet, and run the sync.

Here I've configured a one way sync from my Google Drive (Basic4GL/Program sub-folder) to the /storage/emulated/0/basic4gl folder on my tablet.

I strongly recommend a one way sync, as it means that deleting the basic4gl folder on your phone/tablet won't automatically delete all the files from your cloud storage folder (which could happen with a two way sync - be very careful).

The first time the sync runs it may take a little while if you have a lot of image files in sub-folders. But after that re-syncing should be quite fast, as it only needs to transfer the changed files.

Step 5 - Run the Basic4GL App

Exit the synchronisation App on your phone/tablet and run the Basic4GL App.

"snakedemo" should now be running on your phone or tablet.

Streamlining the process

As you're developing a game/program in Basic4GL mobile, you'll want to transfer it across to your phone/tablet often, to see how it runs on a mobile device.

This means recreating program.vm, re-syncing it across and then re-running the Basic4GL App.

You can streamline the process slightly by instructing Basic4GL Mobile to update the program.vm file whenever you run your BASIC program on your PC:

  1. Click "Settings" then "BASIC runtime settings..."
  2. Tick "Create program.vm on compile", and click "OK"

Now to update your BASIC program on your phone/tablet, you need only:

  1. Switch to the synchronisation App, and run a resync.
  2. Exit the synchronisation App and re-launch the Basic4GL App.

Remember!

This process will be streamlined further in a future release.

The PC and Android Apps will be able to network directly with each other and synchronise files without needing a third party App.

Keep an eye out for updates.