Compiling on the Raspberry Pi (GridWars)

BlitzMax Forums/BlitzMax NG/Compiling on the Raspberry Pi (GridWars)

herb_fargus(Posted 2016) [#1]
I've been trying to get Gridwars working on my raspberry pi 3:

I've been using the binary posted by @brucey here: https://github.com/bmx-ng/bmx-ng/releases

and the command i've been using is

./bmk makeapp -t console -r /home/pi/Gridwars/gridwars.bmx

it starts to compile but fails with

Type TImage not found and Identifier 'plot' not found

so I'm not sure what I'm doing wrong. Are there steps to compile a newer raspberry pi version of blitzmax that might work better to compile gridwars or is there something I'm missing? I apologise if this is the wrong place on the forum, I'm new to blitzmax and how it all works.


xlsior(Posted 2016) [#2]
Are you using the sdl graphics driver?


herb_fargus(Posted 2016) [#3]
I'm not sure. Perhaps not. How would I go about using that on the pi?


Brucey(Posted 2016) [#4]
I've just published a new release for the Raspberry Pi at https://github.com/bmx-ng/bmx-ng/releases
That gets it up-to-date with all the latest advances in the compiler, build process and modules.

I've been trying to get Gridwars working on my raspberry pi 3

If it's running on the desktop (eg. Linux Desktop), then it should be (fairly) trivial to get it running on the Pi.

To render graphics you'll probably want to use SDL.GL2SDLMax2D, which is OpenGL ES 2 compatible.
The SDL backend uses its own system driver, timer and events processing, which means you can't use some of BlitzMax's own default modules. In BlitzMax NG I've split up some of the BRL/Pub modules to allow for things like custom backends (like SDL) which have their own timers and events.
Generally, it's just a case of using Framework with the appropriate imports.

Since build times are somewhat slower on the Pi, I'd suggest getting it building and running with NG on the desktop first - the SDL backend works for the desktop too - before you spend too much time on the Pi.


herb_fargus(Posted 2016) [#5]
from the man himself! thanks for the new release and tips! I only ever tested the gridwars binary on my linux pc, haven't really tried compiling it all that much

I gave it a go with the SDL.GL2SDLMax2D on the pi and it got further this time which is a plus, but it still failed compiling, error:

[ 97%] Compiling:vectorfont.bmx.release.raspberrypi.arm.c
[ 97%] Processing:gridparttrail.bmx
Compile Error: Identifier 'GL_LINE_SMOOTH' not found.
[/home/pi/GridWars54/gridparttrail.bmx;285;0]
Build Error: failed to compile (65280) /home/pi/GridWars54/gridparttrail.bmxpi@...

so it still has some openGL references it seems that arent properly addressed so perhaps may require a bit of manual porting to play nice with the pi or maybe theres another fancy mod of yours that I'm missing


Brucey(Posted 2016) [#6]
GL_LINE_SMOOTH is not available in OpenGLES 2.

You could try wrapping the offending code inside a "?not opengles" directive :

...

?not opengles
 Print "I'm not used on an OpenGLES platform"
?

?opengles
 Print "I'm only available on OpenGLES platforms, like Pi, iOS and Android"
?

...



herb_fargus(Posted 2016) [#7]
made some more progress with the ?not opengles directive on all the opengl specific code, then I ran into errors:

first complaining that

Compile Error: Unable to find overload for setcolor(Float,Int,Int). Argument #1 is "Float" but declaration is "Int"

so I changed declarations enough to make those go away then it came up with

Compile Error: Unable to convert from Void to Int.
[/home/pi/GridWars54/control.bmx;1155;0]

There may also be some possibilities with the experimental opengl driver on the raspberry pi which may be simpler than manually porting the game to opengles.


Derron(Posted 2016) [#8]
You should consider using some of the new compiler options

for BMK[.exe]

	-w
		Warn about function argument casting issues rather than error. (NG only)
		With this warning enabled you may have issues with method overloading.

	-x
		Execute built application. (makeapp only)



This would skip erroring out for overload-issues.


@ "void to int"
This means you somewhere have a function like

Function MyFunc()
  return 1
End Function

'instead of

Function MyFunc:int()
  return 1
End Function


With NG "no return value defined" does no longer mean "return integer value if nothing defined". You will have to explicitely define that, else "void" ("nothing") is returned.


bye
Ron