Fantasy computer

kimstudio

Active Member
Licensed User
Longtime User
These days I checked some fantasy computers like PICO-8 and TIC80, which is quite fun to play with for making tinay games in old style...
No method for me to pay PICO-8 but TIC80 is free. All the game source code are available to learn.
Mainly LUA is used as programming language but some are using vintage BASIC too. I am thinking whether it is possbile to make one with B4X and use B4 basic as programming language that can run on multi platforms. I assume it will need a B4 BASIC interpreter and I am not sure the performance.
Just some thoughts, any comments?

PICO-8
TIC80
 

JohnC

Expert
Licensed User
Longtime User
If I understand you correctly and you want to make an app that allows users to write BASIC programs, then you may want to look at this:

 

agraham

Expert
Licensed User
Longtime User
Version 3 is deprecated - use version 4. You can use just the interpreter as a library if you don't need the full suite.
 

agraham

Expert
Licensed User
Longtime User
B4 basic as programming language that can run on multi platforms. I assume it will need a B4 BASIC interpreter and I am not sure the performance.
There is a pure Java version version of my Basic interpreter which will run under B4J and should therefore work on Linux. Performance of both B4A and B4J versions is very good for an interpreter as they have been optimised over many years.
 

ilan

Expert
Licensed User
Longtime User
Pico-8 looks really awesome.
i love retro games and i really like the idea of Pico-8.

just bought Voxatron for 19.99$ which also includes Pico-8.
Will try it out later :)

Will see if we can use b4x to make games for those platforms. looks really interesting
 

kimstudio

Active Member
Licensed User
Longtime User
@JohnC, thanks for the 'exactly what I mean' direction!

I tried @agraham 's excellent BasicIDE before now I know there is an interpreter ready.

@ilan: PICO-8 can be only programmed in LUA I think. What I mean is we make a PICO-8 like fantasy computer using B4X and use basic as programming lanauge. It will not be a small project, and I can not see huge values other than purely for fun :) as there are already many similar properietary/free projects available. Especially the PICO-8 is already No.1 so it captures all the resources and It's very nice to put all the game resource into a png file using steganographic for sharing.

For script language, the functions are relatively simple (but LUA is very powerful):
spr(), map() for sprites and map display
sfx(), music() for sound
input processing, some peek/poke to process memory, etc.

The IDE will need more effort to make, but it can be done later after the engine ready.
 

kimstudio

Active Member
Licensed User
Longtime User
@agraham your basic interpreter works like a dream! ? (will only use it for my own leisure time fun)
A simple experiment and it seems the feasiblity test is almost done.

fc.png
 

ilan

Expert
Licensed User
Longtime User
What I mean is we make a PICO-8 like fantasy computer using B4X and use basic as programming lanauge. It will not be a small project, and I can not see huge values other than purely for fun :) as there are already many similar properietary/free projects available.
i have started long time ago with such a project but left it.
i really would like todo something like this. create a simple ide via b4x that can make games like platformers and other simple 2d games.

i will have a look at pico-8 and get the idea how such tool should look like and maybe get back to my old project.

1646725504381.png
 

Magma

Expert
Licensed User
Longtime User
Old days in vb6 was a library that giving you feature for running vbscripts at exe-runtime into your vb6 project.. and more specific return a string or number result into a variable (can't remember the lib)...

Is there a way to run b4j command,script in plain text at a standalone exe ? Or at least some of b4j commands (the standard)
 

Magma

Expert
Licensed User
Longtime User
Isn't post #4 above enough for you?
Sorry asking.. because I didn't test the lib.. is the same set of b4j commands.. and the result too?

Of course I will check it ! Saw it but didn't test it... hope tomorrow find the time..

The true is.. I am reading and answering from my phone now...
 

JohnC

Expert
Licensed User
Longtime User

kimstudio

Active Member
Licensed User
Longtime User
Catching up with some new experiments.

@agraham I think the performance will be generally very nice for sprite based games. For heavy computation like demoscene it could be several times slower than orignial B4J, of course the interpreter is not made for this.

I am trying to remake the PICO-8 donut effect, where is the bottleneck to improve the speed? I am thinking maybe due to many string to number conversions in the interpreter?

bxd.png


I already made sin/cos tables, but I think those sin/cos calculations will not impact a lot.

code:
a = 1
b = 1
r1 = 1
r2 = 2
k1 = 80
k2 = 5

c1 = bx_rgb(0, 0, 0)

dim cosj(51)
dim sinj(51)
dim cosi(51)
dim sini(51)
for j = 0 to 50 
    cosj(j) = cos(j*0.12566)
    sinj(j) = sin(j*0.12566)
    sini(j) = sinj(j)
    cosi(j) = cosj(j)
next

sub update
    a = a + 0.00628
    b = b + 0.00324
end sub

sub draw
    bx_cls(c1)
    ca = cos(a)
    sa = sin(a)
    cb = cos(b)
    sb = sin(b)
    for j = 0 to 50
        ct = cosj(j)
        st = sinj(j)
        for i = 0 to 50
            sp=sini(i)
            cp=cosi(i)
            ox=r2+r1*ct
            oy=r1*st
            sasp=sa*sp
            oyca=oy*ca
            x = ox*(cb*cp+sasp*sb)-oyca*sb
            y = ox*(sb*cp-sasp*cb)+oyca*cb
            k1oz= k1/(k2+ca*ox*sp+sa*oy)
            xp=96+k1oz*x
            yp=72-k1oz*y
            l=cp*ct*sb-ca*ct*sp-sa*st+cb*(ca*st-ct*sasp)
            ci = 128 + l*64 
            bx_pset(int(xp),int(yp),bx_rgb(ci,ci,ci))
        next
    next
end sub
 
Top