Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Moru

#16
Just in case someone has this problem again.

My daughter wanted to play around with GLBasic and created a project. She is of the younger generation that never had problems with native characters in filenames (åäö for example). We spent a few minutes searching errors and testing old projects before I saw what the name of the project was :-)

So, if you get this error message:

---------------------------
Please create first.
---------------------------
OK   
---------------------------

Make sure that your project name does not contain any funny characters. For safety reasons stay with A-Z,.-_ and numbers. :-)
#17
Seems city/dungeon generators is in right now, saw this on hackernews today. There are some links to other generators in the comments. It's most likey javascript but maybe some ideas can be sparked from the images? :-)

https://news.ycombinator.com/item?id=21362382
#18
GLBasic - en / Re: GLBasic
2019-Oct-16
Great with new server and backup!

Anyone know how much work and costs it would be to set up a humblebundle? Since the steam version is done it could be easy? I often see other game makers on there, like RPG maker and that other popular engine whatever it was called, and they do get quite a few sales if you can depend on the counter they display on the site.
#19
That one looks useful!

I'm usually playing around with this one when I need a color:

http://paletton.com
#20
Good job! Will upgrade directly. And don't feel bad for asking for money every 15 years... :-)

Not superfond of Steam personally since it forces us to buy three copies of everything if we want to do something together in the family. We buy most stuff on GOG.
#21
Use DELETE inside a FOREACH loop.

Type "DELETE" in the editor and press F1 and then ENTER. Gives you the manual with a nice example how to do it:

Code (glbasic) Select

// Make an array of numbers
DIMDATA a[], 3,4,5,  12,13,  6

// Enumerate the numbers
FOREACH num IN a[]
   // throw out numbers bigger than 10, and continue
   IF num>10 THEN DELETE num
   a$=a$ + num + ", "
NEXT
PRINT a$, 0,0

SHOWSCREEN
MOUSEWAIT


#22
Off Topic / Shaders
2019-May-13
Would this be useful as a basis for learning shaders to use in GLBasic?

https://news.ycombinator.com/item?id=19895218
#23
Agh, I have to stop playing around now  :whip:


Code (glbasic) Select
// --------------------------------- //
// Project: Totalistic Cellular Automaton
// Start: Tuesday, May 07, 2019
// IDE Version: 15.004
//
// Simple rules paints a picture. Use arrows to change rules and starting data.

// Idea:
// http://mathworld.wolfram.com/CellularAutomaton.html


GLOBAL color_states% = 3

GLOBAL x_max% = 320
GLOBAL y_max% = 220
GLOBAL zoom = 2

GLOBAL x%,y%

GLOBAL seed% = 380   // The top rule number
GLOBAL rule_number%=1 // decimal representation of rule
GLOBAL rule%[]
DIMDATA rule[],1,0,0,1,2,1,0 // rule converted to array

GLOBAL line_pos%[] // Positions where to change rules
GLOBAL line_dir%[]   // Moving direction
GLOBAL line_rule%[]  // Rule number to run at this line (index into nice_rule[])
GLOBAL nice_rules%[] // Selection of interesting rules

GLOBAL image_data%[]
DIM image_data%[x_max * y_max]

GLOBAL data_grid%[]
DIM data_grid[x_max][y_max]

GLOBAL palette%[]
DIMDATA palette[], 0xFF000000, 0xFF70D0EC, 0xFF435BD9, 0xFF4229C0, 0xFF372454, 0xFF7A7753, 0xFF78D0EC, 0xFF435BD9, 0xFF4229C0

GLOBAL mx, my, b1, b2

SETSCREEN 640, 480, 0
SMOOTHSHADING FALSE // Blocky zoom!

init_lines()
GLOBAL intro = 1

WHILE TRUE
KeyHitUpdate()
buttons()
init_screen()
recreate()
overlay()
SHOWSCREEN
move_lines()
WEND
KEYWAIT
END

FUNCTION buttons:
MOUSESTATE mx, my, b1, b2

LOCAL step_size = 1

IF KeyHit(42)>0 OR KeyHit(54)>0
step_size=10
ELSE
step_size=1
ENDIF
IF KeyHit(57)=2 // Space
DEBUG seed + ","
ENDIF
IF KeyHit(200)>0 THEN seed=seed+step_size
IF KeyHit(208)>0 THEN seed=seed-step_size
IF KeyHit(203)=2 THEN seed=seed-step_size
IF KeyHit(205)=2 THEN seed=seed+step_size

IF KeyHit(78)=2
INC line_rule[0], 1
IF line_rule[0] > LEN(nice_rules[])-1 THEN line_rule[0] = LEN(nice_rules[])-1
ENDIF
IF KeyHit(74)=2
DEC line_rule[0], 1
IF line_rule[0] < 0 THEN line_rule[0] = 0
ENDIF

ENDFUNCTION

FUNCTION recreate:
FOR y = 1 TO y_max-1
IF y = 1 THEN make_rule(seed)

FOR i = 0 TO LEN(line_pos[])-1
IF y = line_pos[i]
make_rule(nice_rules[line_rule[i]])
ENDIF
NEXT


FOR x = 1 TO x_max-2
set(x,y,decide_sum(x,y))
NEXT
NEXT

// Convert data to sprite:
MEM2SPRITE(image_data%[], 1, x_max, y_max)
//DRAWSPRITE 1, 0, 30
STRETCHSPRITE 1, 0, 30, x_max*zoom, y_max*zoom

ENDFUNCTION

FUNCTION move_lines:
IF intro = 1
//380, 38

FOR i = 0 TO LEN(line_pos[])-1
IF line_pos[i] >= y_max-1 OR line_pos[i] <= 1
line_dir[i] = -line_dir[i]
INC line_rule[i], 1
IF line_rule[i] > LEN(nice_rules[])-1 THEN line_rule[i] = 0
ENDIF
INC line_pos[i], line_dir[i]
NEXT
IF KeyHit(57) THEN intro = 0
ELSE
line_pos[0] = my
ENDIF
ENDFUNCTION

FUNCTION init_lines:
DIMDATA line_pos[], 3 // y_max/4 //, y_max/4*3
DIMDATA line_dir[], 1, -1
DIMDATA nice_rules[], 38, 3,10,12,21,24,28,30,31,34,38,43,46,48,49,52,57,65,66,75,83,84,86,92,93,95,96,97,100,102,105,106,109,110,111,113,114,115,128,129,136,137,138,140,141,145,146,147,150,164,170,172,173,177,183,186,194,205,210,219,220,221,224,237,302,308,357,384,422,439,443,497,600,646,804,807,843,844,845,858,867,870,885,888,893,924,925,947
DIMDATA line_rule[], 1, LEN(nice_rules[])/3
ENDFUNCTION

FUNCTION init_screen:
FOR x = 0 TO x_max-1
set (x, 0, 0)
NEXT
set(x_max/2, 0, 1)
ENDFUNCTION


// Foreground layer / instructions
FUNCTION overlay:
IF intro = 1
PRINT "Press SPACE", 50, 10
ELSE
LOCAL str$
PRINT "Change rule with arrowkeys, hold shift for faster change.", 0, 0
PRINT "Mouse Y move up and down, + and - on numpad changes rule.", 0, 10

PRINT "Rules: " + seed + " and " + nice_rules[line_rule[0]], 0, 20
str$=""
FOREACH a IN rule[]
str$ = str$ + a
NEXT
PRINT str$, 0, 30
ENDIF
ENDFUNCTION


FUNCTION decide_sum: x, y
LOCAL sum = 0
LOCAL result = 0

y = y - 1
FOR x1 = x-1 TO x+1
sum = sum + get(x1,y)
NEXT

IF sum >= 0 AND sum < BOUNDS(rule[], 0)
result = rule[sum]
ENDIF

RETURN result
ENDFUNCTION

FUNCTION get: x, y
IF x >= 0 AND x < x_max AND y >= 0 AND y < y_max
RETURN data_grid[x][y]
ELSE
RETURN 0
ENDIF
ENDFUNCTION

FUNCTION set: x, y, color
image_data%[x + y*x_max] = palette[color]
data_grid%[x][y] = color
ENDFUNCTION

FUNCTION make_rule: n%
rule_number% = n%
//rule = dec_to_base(n, color_states)
dec_to_base(n, color_states)
ENDFUNCTION

// ------------------------------------------------------------- //
// ---  dec_to_base  ---
// ------------------------------------------------------------- //
// Convert decimal to any base system
// Returns array with LSB first
//
FUNCTION dec_to_base: num%, base%
LOCAL a%[]
DIM a%[0]

WHILE (num>0)
DIMPUSH a[], MOD(num, base)
num = INTEGER(num / base)
WEND
rule = a
//RETURN a
ENDFUNCTION



// ------------------------------------------------------------- //
// ---  KeyHitUpdate  ---
// ------------------------------------------------------------- //
//
// Update keyboard state, call every screen refresh
//
GLOBAL gKeyDown[], gKeyState[]
FUNCTION KeyHitUpdate:
LOCAL  k, i

    // First Time call, init
    IF BOUNDS(gKeyDown[],0)=0
        DIM gKeyDown[256]
        DIM gKeyState[256]
    ENDIF

    // For each key
    FOR i=0 TO 255
        k = KEY(i)
        // Key is pressed
        IF k
            IF gKeyDown[i]
                gKeyState[i]=1
            ELSE
                gKeyDown[i]=1
                gKeyState[i]=2
            ENDIF
        ELSE
            // Key is not pressed

            // Has key been pressed before?
            IF gKeyDown[i]
                gKeyDown[i] = 0
                gKeyState[i] = -1
            ELSE
                gKeyState[i]=0
            ENDIF
        ENDIF
    NEXT
ENDFUNCTION

// ------------------------------------------------------------- //
// ---  KeyHit  ---
// ------------------------------------------------------------- //
// Returns:
//  0 = not pressed
//  2 = just pressed (only triggers on keydown)
//  1 = pressed
// -1 = release event (only triggers on keyup)
//
// nkey = key scancode to check
FUNCTION KeyHit: nkey
    RETURN gKeyState[nkey]
ENDFUNCTION



Fun competition :-)
#24
Off Topic / Re: 80ties
2019-May-03
The old computers are coming back as emulators now. People start realising high resolution and gigantic downloads don't make a good game. The harsh limits of old systems can even increase the creativity in ways a modern system can't. There is a new genre coming, the "Fantasy computer". For example the TIC-80 (https://tic.computer/). They often come as a dev-system where you make everything, all programmed inside the emulator. With grafic editor, map editor, music, sound and ofcourse code. Fun to play around with to see if a concept works and then fire up GLBasic to make something proper out of it :-)
#25
I never even thought of getting a mac, expensive, planned obsolete early and locked down so I can't do what I want. I'm using windows computers that are 15 years old and they work just fine as long as you keep a good firewall and stay away from stupid links. What I see at work, the iPhones are dwindling in usage over time, the Huaweis are taking over. Last time I was waiting for a flight there was ringtones from Huaweis everywhere :-)

So maybe we can safely forget about iPhones soon, the owners are known for buying more but even those are moving over to other platforms now so that behaviour will also change.
#26
Yes, GLBasic is great! The reason the big guys don't use BASIC as a language is largely because of the (undeservedly) bad reputation it has.
#27
Threads used to be possible in GLBasic. Does it not work any more?

http://www.glbasic.com/forum/index.php?topic=3642.msg26493#msg26493

The attachment seems to be missing from that post though. I might be able to dig out my copy of it somewhere but not sure it's the same version.

Edit: Found something that seems to be the right file but haven't tried it, attached below. It was made for GLBasic 5 according to the project header.
#28
Off Topic / Re: Article
2019-Mar-29
Nice, seems you are on a roll :-)

I'm one of those that can't understand why touch games are so popular, you can directly see what has been converted from mobile to PC.
#29
Off Topic / Re: Hacker News
2019-Mar-23
Same problem with that one, very strange.
#30
Off Topic / Re: Hacker News
2019-Mar-22
We tried a bunch of emulators but they are all having some trouble with typing, is it normal that the spectrum misses keys all the time? Print becomes prnt and such. In general we wanted to just use the games for a stepping stone to learning GLBasic and general game programming for our daughter. It looks very nice so far and the explanations after the code is perfekt for understanding what we need to transfer into GLBasic. But we wanted to first try it on the emulator ofcourse :-)