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

Topics - r0ber7

#1
Hi,

I'm running the latest Steam version. But somehow I still had to install Linux platform manually. When I do and try to compile some code with SETFONT in it, I get this during the linking:

: undefined reference to `__GLBASIC__::SETFONT(int, double, int)'

What's up with that?
#2
So I've decided to try and make my own folder for the Compilers/platform folder, so I can compile 64bit programs.
Right now I've only copied over the 32bit folder, changed its name, and added the -m64 flag to the g++ compiling options. Of course it throws an error, this one:

Code (glbasic) Select

gpc_temp46.cpp:1: sorry, unimplemented: 64-bit mode not compiled in


So now I have to look for a Windows g++ compiler with 64bit mode compiled in, which will work with the rest as well. Any tips?  ;)
#3
Does anyone know what this is? And why it is preventing me from compiling for Mac? I tried downloading the Mac.zip from both the v15 and v16 urls, but both give me this error.  :(

Running Windows 10.

Code (glbasic) Select

compile+link:
/cygdrive/q/Compiler/platform/Mac/Bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: table of contents for archive: /cygdrive/Q/Compiler/platform/Mac/lib/libGLBasicMac.a is out of date; rerun ranlib(1) (can't load from it)
/cygdrive/q/Compiler/platform/Mac/Bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: table of contents for archive: /cygdrive/Q/Compiler/platform/Mac/OSX/Lib/libSDL_mixer.a is out of date; rerun ranlib(1) (can't load from it)
/cygdrive/q/Compiler/platform/Mac/Bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: table of contents for archive: /cygdrive/Q/Compiler/platform/Mac/OSX/Lib/libSDLmain.a is out of date; rerun ranlib(1) (can't load from it)
/cygdrive/q/Compiler/platform/Mac/Bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: table of contents for archive: /cygdrive/Q/Compiler/platform/Mac/lib/libCxImageMac.a is out of date; rerun ranlib(1) (can't load from it)
/cygdrive/q/Compiler/platform/Mac/Bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: table of contents for archive: /cygdrive/Q/Compiler/platform/Mac/OSX/Lib/libstdc++-static.a is out of date; rerun ranlib(1) (can't load from it)
/cygdrive/q/Compiler/platform/Mac/Bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: table of contents for archive: /cygdrive/Q/Compiler/platform/Mac/OSX/Lib/libstdc++.a is out of date; rerun ranlib(1) (can't load from it)
/cygdrive/q/Compiler/platform/Mac/Bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: table of contents for archive: /cygdrive/Q/Compiler/platform/Mac/OSX/Lib/libgcc.a is out of date; rerun ranlib(1) (can't load from it)
collect2: ld returned 1 exit status
#4
I want to do a NETWEBGET$ to my server. I have tried changing the port to 443, but nothing is coming through. Does NETWEBGET$ allow HTTPS connections? Is there another command in GLBASIC which allows me to communicate with a server using HTTPS?

Before, using a http server and the same code, I had no problems. I hope I do not have to downgrade my server.  :|
#5
I'm trying to run a Mac build of my game. The compiler throws this error:

Code (glbasic) Select
compile+link:
/cygdrive/q/Compiler/platform/Mac/Bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: can't locate framework for: -framework OpenGL
collect2: ld returned 1 exit status
*** FATAL ERROR - Please post this output in the forum[/td]


Where is it looking for the framework? Any ideas on how to solve this?
#6
Hi again,

I'm currently looking into getting a Windows dual-boot running on my Macbook, so I can develop in GLBasic 15 in a more convenient way. I'm currently using CrossOver to run GLBasic, and while it works fine, it does not allow me to use the debugger. So I decided to install a Windows version just to run GLBasic.

Now, I have two versions available to me: Windows 7, and Windows 10. Which one would be better to run GLBasic v15? I don't care about anything else, I just want to develop and compile my game on it. What are your thoughts?

Thanks!  <3
#7
Hi,

Question: could I use X_LOADSHADER to load a shader that would change over time, giving a day/night cycle effect? I've tried setting up shaders before but didn't get them working correctly. I saw Hemlos knows a lot about it. Just wondering if it's worth the effort.

http://www.glbasic.com/forum/index.php?topic=1089.15

http://www.glbasic.com/forum/index.php?topic=10525.msg92970#msg92970
#8
Code (glbasic) Select
> open ~/RWI/Hello_world.app/
LSOpenURLsWithRole() failed with error -10810 for the file /Users/r0ber7/RWI/Hello_world.app.


This is from the Mac commandline. I have compiled this:

Code (glbasic) Select

// Auf Back-Buffer schreiben / Write to back buffer
PRINT "Hello GLBasic World !", 0, 100;
// Back Buffer anzeigen      / Show back buffer
SHOWSCREEN
// Auf Maustaste warten      / Wait for mousekey
MOUSEWAIT


I had hoped upgrading to El Capitan would save this problem, but it hasn't. Any ideas on how to tackle this?

:giveup:

#9
Alright. I have this huge project of a game I'm working on, you may remember it. ;-)

So I know that somewhere along the line during the playing of a level, things get slowed down. If I leave a level playing for 15 minutes I see a drop in framerate. This leads me to conclude that somewhere, an array is not being cleaned up, or what I don't know.

All I know is, the memory usage grows and grows. In GLBasic IDE, how would I go about debugging this? I have never really used the debugging tools, only the DEBUG command. What is this continue, next step, etc. about? Can it help me find out what is causing the memory growth?

I'm on a gigantic bug hunt which started a month ago. Any help will be greatly appreciated. :)
#10
Hi. I have a question regarding types and references. Suppose I have a type:

Code (glbasic) Select

TYPE example
  var1%
  var2$
ENDTYPE


Then I create an instance of it:

Code (glbasic) Select

LOCAL instance AS example
instance.var1 = 1
instance.var2 = "testing dum dee dum"


Now here's my problem. Suppose I want a copy of this instance. If I do this:

Code (glbasic) Select

LOCAL instance2 AS example
instance2 = instance


This will be the same reference, and as soon as I remove instance from memory, accessing instance2 will give me an uncaught reference error.
So, the only way I figured out I can create a copy is by doing this:

Code (glbasic) Select

LOCAL instance2 AS example
instance2.var1 = instance.var1
instance2.var2 = instance.var2


But, for larger types, this way of cloning an instance can get very laborious very quickly. Is there a cleaner way to create clones of objects?
I want to know this because I have set up enemy spawn points in my game, so a clean cloning of enemy data would save me some time. :-)
#11
Hey guys,

I started a vanilla Minecraft server (1.7). Here is our map:

http://psyview.nl/map/

The server address is: mc.psyview.nl

We're just getting started, so the world is completely new.

1G RAM
3 CPUs (Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz)

I want to expand the RAM and CPU but the VPS costs money, so that's for the future.
If you want to play, leave your username here and I will put you on the whitelist. :)

Happy holidays to all!
#12
Hey there.

During my browsing I found this article on implementing realistic behaviour of game characters.

http://www.red3d.com/cwr/steer/gdc99/

It seems interesting for game development, so I thought I'd post it here. It'd be especially useful for top-down style games, but can also be adapted to other styles with some modifications in logic.
#13
2D-snippets / Rope physics
2013-Oct-22
In an attempt to create more interesting enemies for my game, I decided to figure out how ropes work. Not only could I use that code to, well, hang ropes around the place, I could also make snakes move around. It would also make creating endbosses more interesting and less time-consuming.

Anyway, here's the code. You can download the entire project as a zip file from here.

Code (glbasic) Select

// --------------------------------- //
// Project: Ropes
// Start: Tuesday, October 22, 2013
// IDE Version: 10.283
// Robert van Engelen
// www.driewielerdigital.com


// IDENTITY
GLOBAL rope AS p_rope
GLOBAL mx, my, b1, b2

MOUSESTATE mx, my, b1, b2
rope.init( 20, mx, my)

WHILE 1
MOUSESTATE mx, my, b1, b2
rope.play( mx, my)
rope.draw()
WEND


// TYPE
TYPE p_rope

// STATE
str1_x[] // points
str1_y[]
str2_x[]
str2_y[]
vec_x1 // vectors
vec_x2
vec_y1
vec_y2
at_x1 // points to attach both sides of rope to
at_y1
at_x2
at_y2
segments_n = 10
gravity = 0.0


txt$ // text to print

// BEHAVIOUR
FUNCTION init : n1, px, py, grav1=1.7, attach_x1=0, attach_y1=0, attach_x2=0, attach_y2=0

self.segments_n = n1
self.gravity = grav1

LOCAL i
LOCAL n = self.segments_n

DIM self.str1_x[n+1]
DIM self.str1_y[n+1]
DIM self.str2_x[n+1]
DIM self.str2_y[n+1]

// initialize points
FOR i=0 TO n-1
self.str1_x[i] = px
self.str1_y[i] = py
//INC self.str1_x[i], 0
INC self.str1_y[i], i*1
NEXT

self.at_x1 = attach_x1
self.at_y1 = attach_y1
self.at_x2 = attach_x2
self.at_y2 = attach_y2

ENDFUNCTION

FUNCTION play : px, py

LOCAL i, n=self.segments_n, normal_length = 3
LOCAL vec_x1, vec_x2, vec_y1, vec_y2, mag1, mag2, ext1, ext2, xv, yv

// set the new top x and y
self.str1_x[0] = px
self.str1_y[0] = py

FOR i=0 TO n-1

STDOUT "I: "+i+"\n"

IF i > 0
vec_x1 = self.str1_x[i-1] - self.str1_x[i]
vec_y1 = self.str1_y[i-1] - self.str1_y[i]
mag1 = SQR( POW(vec_x1, 2) + POW(vec_y1, 2) ) // get the length between two points
ext1 = mag1 - normal_length


STDOUT "ext1: "+ext1+" = "+mag1+"-"+normal_length+"\n"
ENDIF

vec_x2 = self.str2_x[i+1] - self.str2_x[i]
vec_y2 = self.str2_y[i+1] - self.str2_y[i]
mag2 = SQR( POW(vec_x2, 2) + POW(vec_y2, 2) ) // get the length between two points
ext2 = mag2 - normal_length

STDOUT "ext2: "+ext2+" = "+mag2+"-"+normal_length+"\n"

//          xv = (X_Vector1 / Magnitude1 * Extension1) + (X_Vector2 / Magnitude2 * Extension2)
//          yv = (Y_Vector1 / Magnitude1 * Extension1) + (Y_Vector2 / Magnitude2 * Extension2) + Gravity

xv = ( vec_x1 / mag1 * ext1 ) + ( vec_x2 / mag2 * ext2 )
yv = ( vec_y1 / mag1 * ext1 ) + ( vec_y2 / mag2 * ext2 ) + self.gravity

IF vec_x1 = 0 //OR vec_x2 = 0
xv = 0
ENDIF
IF vec_y1 = 0 OR vec_y2 = 0
yv = 0
ENDIF

STDOUT "xv: "+xv+"=("+vec_x1+"/"+mag1+"*"+ext1+"), yv:"+yv+"\n"

self.str2_x[i] = self.str1_x[i] + ( xv*0.5 )
self.str2_y[i] = self.str1_y[i] + ( yv*0.5 )


NEXT

FOR i=0 TO n-1
self.str1_x[i] = self.str2_x[i]
self.str1_y[i] = self.str2_y[i]
NEXT


self.str1_x[n-1] = self.str1_x[n-2]
self.str1_y[n-1] = self.str1_y[n-2]

ENDFUNCTION

// draw stuff
FUNCTION draw :

LOCAL n=self.segments_n

ALPHAMODE -0.6

FOR i=0 TO n-2
DRAWRECT self.str1_x[i]+96, self.str1_y[i], 8, 8, RGB(255,0,0)
DRAWRECT self.str2_x[i]+98, self.str2_y[i], 4, 4, RGB(255,255,0)
NEXT



SHOWSCREEN

ENDFUNCTION

ENDTYPE
#15
Hi,

I was thinking: could you use INLINE C++ to control the OpenGL shaders?
I found some code:

http://r3dux.org/2013/08/a-simple-c-opengl-shader-loader/

Could that be of any use? I'm not very good in C++ (yet).
#16
While coding my physics engine, I found I needed an algorithm to calculate the closest distance between two lines. After some searching I found this, which I've converted into GLBasic.

This code will work in 2D and 3D. For 2D calculations, just enter zero for all z values. :)

Code (glbasic) Select


TYPE point
    x
    y
    z
ENDTYPE

TYPE geo_line
     x1
     y1
     z1
     x2
     y2
     z2
ENDTYPE


TYPE geometry

///*
//*
//* http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm
//*
//* Original C++ Copyright Notice
//* ===================
//* Copyright 2001, softSurfer (www.softsurfer.com)
//* this code may be freely used AND modified FOR any purpose
//* providing that this copyright notice is included with it.
//* SoftSurfer makes no warranty FOR this code, AND cannot be held
//* liable FOR any real OR imagined damage resulting from its use.
//* Users of this code must verify correctness FOR their application.
//*/
FUNCTION norm : c1 AS point

LOCAL nrm = SQR(dot(c1, c1))
//console.out("geometry.norm> "+nrm+"\n")
    RETURN nrm

ENDFUNCTION

FUNCTION dot : c1 AS point, c2 AS point

LOCAL dp = (c1.x * c2.x + c1.y * c2.y + c1.z * c2.z)
//console.out("geometry.dot> "+dp+"\n")
    RETURN dp

ENDFUNCTION

FUNCTION linesegments_shortest_distance : line1 AS geo_line, line2 AS geo_line

    LOCAL EPS = 0.00000001

    LOCAL delta21 AS point
    delta21.x = line1.x2 - line1.x1
    delta21.y = line1.y2 - line1.y1
    delta21.x = line1.z2 - line1.z1

    LOCAL delta41 AS point
    delta41.x = line2.x2 - line2.x1
    delta41.y = line2.y2 - line2.y1
    delta41.z = line2.z2 - line2.z1

    LOCAL delta13 AS point
    delta13.x = line1.x1 - line2.x1
    delta13.y = line1.y1 - line2.y1
    delta13.z = line1.z1 - line2.z1

    LOCAL a = dot(delta21, delta21)
    LOCAL b = dot(delta21, delta41)
    LOCAL c = dot(delta41, delta41)
    LOCAL d = dot(delta21, delta13)
    LOCAL e = dot(delta41, delta13)
    LOCAL D = a * c - b * b

     LOCAL sc, sN, sD = D
     LOCAL tc, tN, tD = D

    IF D < EPS
   
        sN = 0.0
        sD = 1.0
        tN = e
        tD = c
   
    ELSE
   
        sN = (b * e - c * d)
        tN = (a * e - b * d)
        IF sN < 0.0
       
            sN = 0.0
            tN = e
            tD = c
       
        ELSEIF sN > sD
       
            sN = sD
            tN = e + b
            tD = c
        ENDIF
    ENDIF

    IF tN < 0.0
   
        tN = 0.0

        IF -d < 0.0
            sN = 0.0
        ELSEIF -d > a
            sN = sD
        ELSE
       
            sN = -d
            sD = a
        ENDIF
    ELSEIF tN > tD
        tN = tD
        IF (-d + b) < 0.0
            sN = 0
        ELSEIF (-d + b) > a
            sN = sD
        ELSE
       
            sN = (-d + b)
            sD = a
        ENDIF
    ENDIF

    IF ABS(sN) < EPS
    sc = 0.0
    ELSE
    sc = sN / sD
    ENDIF
   
    IF ABS(tN) < EPS
    tc = 0.0
    ELSE
    tc = tN / tD
    ENDIF

    LOCAL dP AS point
    dP.x = delta13.x + (sc * delta21.x) - (tc * delta41.x)
    dP.y = delta13.y + (sc * delta21.y) - (tc * delta41.y)
    dP.z = delta13.z + (sc * delta21.z) - (tc * delta41.z)

// shortest distance between two line segments

LOCAL sdist = SQR(dot(dP, dP))
//console.out("geometry.linesegments_shortest_distance> "+sdist+"\n")
    RETURN sdist
   
ENDFUNCTION
#17
I've built my own script to compile on Linux. Some time ago I switched from Ubuntu to Sabayon (a Gentoo flavour). When I try to run my compilation script, it throws a bunch of errors relating to g++. After some digging I think it's because the g++ version on my system differs from the one used by GLBasic to compile. So, which version do I need? Knowing this would save me a lot of compilation time.
#18
Consider this.



To check collision between two spheres, I calculate the distance between the two centers of those spheres. If that distance is smaller than the sum of the radiuses plus the velocity of the objects (r + r + xs), collision = true.

My question is about collision with the ground. I have an array with x&y locations for the ground. I know the position of a, I know the position of b, I know the length of r, I know the velocity of the object along the vector, so I know point c too.

How do I check if b,c intersects with d,e? I've read about the dot product, but I don't really understand how I would implement that. I'm fairly new to vectors, and I hope someone here can help me.

I've based this on this article, which I only understand somewhat.
http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/

Cheers.
#19
I have a type called config_type, which handles configuration files. It contains a PROTOTYPE which calls a function that generates config info.

Code (glbasic) Select

PROTOTYPE configtype_generate :

TYPE config_type
cfg_generate AS configtype_generate
ENDTYPE


I also have a server type, which (surprisingly) contains server info. It also contains a config_type, and a function which can be used to generate a config.

Code (glbasic) Select

TYPE server_type
       conf AS config_type

       FUNCTION srv_gen_cfg_in_servertype :
           // generate server config here
           // function is within server type
       ENDFUNCTION

      FUNCTION init :
          self.conf.cfg_generate = ?????
      ENDFUNCTION

ENDTYPE


Finally, I have a function that is not within the server type which can also generate a server config:

Code (glbasic) Select

FUNCTION srv_gen_cfg_not_in_servertype :
     // also generate config stuff, but this function is not in the server type
ENDFUNCTION


My question is about the assignment of the prototype in server_type.init():

If I set self.conf.cfg_generate = self.srv_gen_cfg_in_servertype, it fails.
But if I set self.conf.cfg_generate = srv_gen_cfg_not_in_servertype it works.

So, if I want to generate a config for the server type, I have to use a function from outside the server type to make the prototype assignment work. My question boils down to this.
Is there a way to set up a prototype within a type to be assigned to a function within another type?
This would make my code cleaner, since right now I'm using srv_gen_cfg_not_in_servertype() which needs a GLOBAL server_type to work with. This works fine, but it's not exactly OO. I know GLBasic has limited OO capabilities, I was just wondering if it is possible. :)

#20
Off Topic / Coding humor
2013-Mar-14