BASIC

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.


Messages - bigsofty

Pages: [1] 2 3 ... 170
1
Beta Tests / Re: Beta test 3D demo 0.1
« on: Yesterday at 02:44 am »
Just tested, works well, really nice work here Snoopy. Very interested how this turns out!  :good:

2
Off Topic / Voxels are the future!
« on: Yesterday at 02:39 am »
This guys kinda mental but the tech on show here is pretty amazing!

<a href="http://www.youtube.com/watch?v=aAgVSTrqNOc" target="_blank">http://www.youtube.com/watch?v=aAgVSTrqNOc</a>



3
Types help keep things modular, I’d say there pretty much essential for keeping control of a project once you get past a certain size of code base too.

4
This is great, thanks Gernot!  :happy:

5
Good luck with your release!  :good:

6
Bug Reports / Re: Many strange Bugs.
« on: 2019-Aug-04 »
Drop a simple, few lines demo, here and we’ll test it on our hardware.

7
Should be faster and work the same on any platform.

8
GLBasic - en / Re: Object raycast 3D
« on: 2019-Aug-03 »
X_COLLISIONRAY() ?

.Edit: I really should stop skimming posts "but not the exact position" :P. So ignore this.

9
These are what I use in my game. Used mainly for speed, rather than just a set seed, should still do though for cross platform stuff.

Code: GLBasic [Select]
INLINE
//================================================================================================//
                                                /***********************************************
                                                 ** Random seed **
                                                 ***********************************************/

//================================================================================================//
        int gRndSeed = 98371;
        void Seed(int seed)
        {
                gRndSeed = seed;
        }

//================================================================================================//
                                                /***********************************************
                                                 ** Random number generator **
                                                 ***********************************************/

//================================================================================================//
        int Rand()
        {
                int k1;
                int ix = gRndSeed;

                k1 = ix / 127773;
                ix = 16807 * (ix - k1 * 127773) - k1 * 2836;
                if (ix < 0)
                        ix += 2147483647;
                gRndSeed = ix;
                return gRndSeed;
        }

        float cRandFloat(float range) // 3 digits after decimal should be plenty for my app.
        {
                int iRange = (range* 1000);
                float result = (float)(Rand()%iRange);
                return result * 0.001f;
        }

ENDINLINE

FUNCTION SetSeed: seed%
        INLINE
                Seed( seed );
        ENDINLINE
        ENDFUNCTION

FUNCTION GetSeed%:
        INLINE
                return gRndSeed;
        ENDINLINE
        ENDFUNCTION


FUNCTION RandInt%: range%
        INLINE
                return Rand()%(range);
        ENDINLINE
        ENDFUNCTION

FUNCTION RandFloat#: range#
        INLINE
                return cRandFloat((float)range);
        ENDINLINE
        ENDFUNCTION

FUNCTION RandFloatRange#: minFloat#, maxFloat#
        INLINE
                return cRandFloat((float)(maxFloat-minFloat))+minFloat;
                ENDINLINE
        ENDFUNCTION

FUNCTION RandIntRange%: minInt%, maxInt%
        INLINE
                return (Rand()%(maxInt-minInt))+minInt;
                ENDINLINE
        ENDFUNCTION

10
GLBasic - en / Re: Playmusic freeze
« on: 2019-Jul-24 »
So the music is streamed of the HD, I never knew that.

11
GLBasic - en / Re: Playmusic freeze
« on: 2019-Jul-22 »
I remember that I had a lot of problems with the playmusic function (especially on mobile) and finally, I used the playsound function.

Moreover, at the time of launching this function, everything slows down (as in my demo with the music of 2001, when the music stops and restarts, the demo slows down).
Nevertheless, it is a bit normal because the music is not loaded in memory, unlike the playsound function.

Erico, you should convert all yours musics to be compatible with the playsound function. Personally, I think this is the best solution at the moment.

Playmusic slows your code down, wow. This is a bit of a concern TBH. Have you tried this recently Snoopy?

12
As long as you don't have tonnes of models, it's usually easier to load the models into your model editor and scale it there.

13
Just a word to the wise, the Steam "Updates History" and the "Recent Updates" for Godot need updating. I think Android support could be an important addition for possible buyers. Also keeping "Updates History" updated should be a priority as it’s the first place buyers look when buying software to see if the app is dead or not.

I don’t mind lending a hand if need be.

BTW there are a few English grammar mistakes in the current Steam ad too.

14
GLBasic - en / Re: How to compile "Fluids" ?
« on: 2019-Jul-11 »
No problem Qedo, its actually a very insightful example on how to manipulate GLB arrays via inline C. I just wish I knew why the first part behaves as it did.  :blink:

15
GLBasic - en / Re: How to compile "Fluids" ?
« on: 2019-Jul-09 »
This fixes it, although I have no idea why...  :D

I was writing a bit of test code to see have a look at how GLB uses 2D arrays in C and it seemed to make ALL the code compile?!? It seems like this code needs to have an existing GLB 2D array already defined?

Maybe Gernot could clear up this little mystery?

Anyways...

Code: GLBasic [Select]
// --------------------------------- //
// Project: Fluids
// Start: Saturday, March 24, 2007
// IDE Version: 4.136

TYPE poo
        x
        y
        ENDTYPE

GLOBAL screenx, screeny, tst[] AS poo

LOCAL gridsize, mx, my, b1, b2
        gridsize=4
               
        DIM tst[10][10]

        GETSCREENSIZE screenx, screeny
        SetGrid(screenx/gridsize, screeny/gridsize)

        LOCAL x,y
        WHILE TRUE
                MOUSESTATE mx, my, b1, b2
                SetBorders()
                Smooth()

                IF b1
                        SetColor(mx/gridsize, my/gridsize, 255,0,0)
                        SetColor((screenx-mx)/gridsize, my/gridsize, 0,255,0)
                        SetColor(mx/gridsize, (screeny-my)/gridsize, 0,0,255)
                        SetColor((screenx-mx)/gridsize, (screeny-my)/gridsize, 255,200,64)
                ENDIF

                DRAWRECT 0,0,640,480,RGB(255,255,255)
                ShowGrid()
                PRINT "X", mx, my

                SHOWSCREEN
        WEND
END



// ----------------------------------
// This is so I'm out of MAIN rountine - I need global stuff before
// ----------------------------------
FUNCTION endmainfoo:
ENDFUNCTION

// ----------------------------------
// GLOBAL stuff
// ----------------------------------
INLINE
        // http://mvb.saic.com/freeware/freewarev40/mesa/include/gl/gl.h

        } // end namespace __GLBASIC__ - see manual for INLINE

        // some constants - for more see:
        // http://mvb.saic.com/freeware/freewarev40/mesa/include/gl/gl.h
        extern "C"
        {
                // some of the GL constants
                enum CONSTANTS{
                GL_VERTEX_ARRAY                 = 0x8074,
                GL_NORMAL_ARRAY                 = 0x8075,
                GL_COLOR_ARRAY                  = 0x8076,
                GL_INDEX_ARRAY                  = 0x8077,

                GL_FLOAT                                = 0x1406,
                GL_DOUBLE                               = 0x140A,
                GL_UNSIGNED_INT                 = 0x1405,

                GL_TRIANGLE_STRIP               = 0x0005,

                GL_COLOR_MATERIAL               = 0x0B57,
                GL_DITHER                               = 0x0BD0,
                GL_SMOOTH                               = 0x1D01,
                GL_FLAT                                 = 0x1D00,

                GL_CULL_FACE                    = 0x0B44
                };
                // the functions are all >>extern "C" __stdcall<<
                extern void __stdcall glColorPointer(int size, int typ, int stride, const void *ptr );
                extern void __stdcall glVertexPointer(int size, int typ, int stride, const void *ptr );
                extern void __stdcall glDrawArrays( int mode, int first, int count );
                extern void __stdcall glDrawElements( int mode, int count, int typ, const void *indices );
                extern void __stdcall glEnable( int cap );
                extern void __stdcall glDisable( int cap );
                extern void __stdcall glShadeModel( int model );
                extern void __stdcall glEnableClientState( int cap );
                extern void __stdcall glDisableClientState( int cap );
        }

        // restore the namespace
        namespace __GLBASIC__
        {

        // this is a point. Color in 3float format is the fastest for
        // gfx card
        struct cPOD
        {
                float x,y;
                float vx,vy;
                float col[3]; // rgb values
        };
        // 2 arrays for the background mesh
        // a pointer to the current one
        DGArray<cPOD> gcPODs1, gcPODs2, *pCurPODs;
        // an array of mesh indices for faaaast drawing
        DGArray<unsigned int>  gIndices;



ENDINLINE


// ----------------------------------
// Set the grid size
// ----------------------------------
FUNCTION SetGrid: w,h
INLINE
        DIM(gIndices, w*h*2);
        DIM(gcPODs1, w, h);

        int j=0;
        for (int y=0; y<h; ++y)
                for (int x=0; x<w; ++x)
                {
                        gcPODs1(x,y).x = x*screenx/w;
                        gcPODs1(x,y).y = y*screeny/h;
                        gIndices(j++) =  y*w +x;
                        gIndices(j++) = (y+1)*w +x;
                }
        gcPODs2 = gcPODs1;
        pCurPODs = &gcPODs1;

ENDINLINE
ENDFUNCTION


// ----------------------------------
// Draw the whole background grid
// ----------------------------------
FUNCTION ShowGrid:
        // Disable texturing
        X_SETTEXTURE -1, -1
INLINE

        int width = BOUNDS(gcPODs1, 0);
        int height= BOUNDS(gcPODs1, 1);

        // change rendering context to what we need
        glEnable(GL_COLOR_MATERIAL);
        glEnable(GL_DITHER);
        glShadeModel(GL_SMOOTH);
        glDisable(GL_CULL_FACE);

        // vertex arrays & color array
        glEnableClientState(GL_VERTEX_ARRAY);
        glEnableClientState(GL_COLOR_ARRAY);

        // set the data pointers
        glVertexPointer(2, GL_FLOAT, sizeof(cPOD), (void*)&(*pCurPODs)(0,0).x);
        glColorPointer (3, GL_FLOAT, sizeof(cPOD), (void*)&(*pCurPODs)(0,0).col[0]);

        // for each "line" of the mesh
        for(int i = 0; i < height - 1; ++i)
        {
                // whee
                glDrawElements(GL_TRIANGLE_STRIP, width * 2, GL_UNSIGNED_INT, &gIndices(i * width * 2));
        }

        // restore what GLBasic would not do automatically
        glShadeModel(GL_FLAT);
        glDisable(GL_DITHER);
        glDisable(GL_COLOR_MATERIAL);
        glDisableClientState(GL_VERTEX_ARRAY);
        glDisableClientState(GL_COLOR_ARRAY);
ENDINLINE
ENDFUNCTION


// ----------------------------------
// Set the color of a grid point
// ----------------------------------
FUNCTION SetColor: x,y,r,g,b
INLINE
        (*pCurPODs)(x,y).col[0]=r;
        (*pCurPODs)(x,y).col[1]=g;
        (*pCurPODs)(x,y).col[2]=b;
ENDINLINE
ENDFUNCTION


// ----------------------------------
// Smooth the mesh
// ----------------------------------
FUNCTION Smooth:
INLINE
        int width = BOUNDS(gcPODs1, 0);
        int height= BOUNDS(gcPODs1, 1);
        DGArray<cPOD>* pOther=&gcPODs1;
        if(pOther == pCurPODs)
                pOther = &gcPODs2;

        for (int x=0; x<width-1; ++x)
        for (int y=0; y<height-1;++y)
        {
                cPOD& p1=(*pCurPODs)(x,y);
                cPOD& p2=(*pCurPODs)(MIN(width-1,x+1),y);
                cPOD& p3=(*pCurPODs)(MAX(0,x-1),y);
                cPOD& p4=(*pCurPODs)(x,MIN(height-1,y+1));
                cPOD& p5=(*pCurPODs)(x,MAX(0,y-1));

                cPOD& r= (*pOther)(x,y);

                r.col[0] = (p1.col[0]*1.05 + p2.col[0] + p3.col[0]+p4.col[0]+p5.col[0])/5.1;
                r.col[1] = (p1.col[1]*1.05 + p2.col[1] + p3.col[1]+p4.col[1]+p5.col[1])/5.1;
                r.col[2] = (p1.col[2]*1.05 + p2.col[2] + p3.col[2]+p4.col[2]+p5.col[2])/5.1;
        }
        pCurPODs=pOther;
ENDINLINE
ENDFUNCTION


// ----------------------------------
// Set border pixels to black
// ----------------------------------
FUNCTION SetBorders:
INLINE
        int width = BOUNDS(gcPODs1, 0);
        int height= BOUNDS(gcPODs1, 1);
        for(int i=0; i<width; ++i)
        {
                SetColor(i,0,0,0,0);
                SetColor(i,height-1,0,0,0);
        }
        for(int i=0; i<height; ++i)
        {
                SetColor(0,i,0,0,0);
                SetColor(width-1,i,0,0,0);
        }
ENDINLINE
ENDFUNCTION






 

Pages: [1] 2 3 ... 170