|
Post by angros47 on Jun 21, 2012 15:23:02 GMT -5
I don't need to rewrite the engine in freebasic: freebasic can use a dll written in c/c++ with no issues. My question is... should your commands be implemented in the library, or in the Basic4GL runtime?
Also, don't forget that I'm working also on openb3d: and, since the interface is similar, openb3d too could be used in the new basic4gl, if you like the idea (so, basic4gl would have the same features of languages like blitz3d or darkbasic, and would become a nice quick game making tool)
|
|
|
Post by Darkjester on Jun 25, 2012 4:08:25 GMT -5
yea i understand not what i mean but i suppose i just misinterpretted what you meant. the idea was to put the sprite engine (the commands dont matter, preferably a mirror of the original commands to try and retain backwards compatibility) but its not necissary ive had to make several changes to the dialect just to make it function with SDL. Also everyone else im really wanting to know the interest level here ive put quite a bit of time into this, and i can finish it pretty darn soon but only if there use to be made of it, i am literally 2 weeks away from a final release of beta level code, but as i said i want to know people are going to use this. my current build which i havent updated to the git yet, now uses SDL_image for image handling. SDL_TTF for using ttf, a partial text engine using SDL screenshots here in a few days if i have time and people want to see, working on a "screen" function, and finally the last thing is the ability to compile exe's once again as well as utilize DLL's. so pretty darn close to a release.
|
|
|
Post by matthew on Jun 25, 2012 7:33:28 GMT -5
Well I for one am going to use it. :-D
I could make a post about the new release on my blog and make a few tweets, that could generate a little more interest. There are also a few other forums that I use which I could post some links on.
|
|
|
Post by Darkjester on Jun 25, 2012 15:56:56 GMT -5
Well I for one am going to use it. :-D I could make a post about the new release on my blog and make a few tweets, that could generate a little more interest. There are also a few other forums that I use which I could post some links on. Sounds like a plan Matthew 
|
|
|
Post by shadow008 on Jun 25, 2012 18:39:35 GMT -5
Well, I planned on picking up programming in about a month or so, so I'm interested in this.... Not sure what else to say here, mostly because I haven't followed this thread enough to know the changes that are happening. But regardless, it has piqued my interest.
|
|
|
Post by Darkjester on Jun 25, 2012 19:02:15 GMT -5
I think it will be right up your alley shadow, im always open to ideas and suggestions, here again this is "our" basic4gl not "mine"
|
|
|
Post by shadow008 on Jun 28, 2012 9:51:02 GMT -5
Honestly, Dynamic Memory is my only suggestion.
...Again, short of words here...
|
|
|
Post by Darkjester on Jun 29, 2012 16:24:21 GMT -5
dynamic memory is in the works already, but its pretty complex, but i think i may have a work around
|
|
|
Post by Darkjester on Jul 4, 2012 11:03:33 GMT -5
|
|
|
Post by angros47 on Jul 15, 2012 15:00:35 GMT -5
A new version: www16.zippyshare.com/v/16352680/file.htmlI finally implemented hardware accelerated pixel perfect collisions. For every sprite you can set a "type" (using SprSetType); for example, 1 for player, 2 for environment, 3 for enemies, 4 for bullets... The command CheckCollision(type1, type2) will tell you if any of the sprite of type 1 collides with any of the sprite of type 2 (it will return the number of overlapping pixels, so you'll even know if sprites are really colliding or just touching). The collision test requires stencils (so, you must enable them when you set the opengl environment, otherwise it won't work). Also, only collisions that occur on the visible screen are detected (sprites need to be rendered, to be tested).
|
|
|
Post by angros47 on Jul 17, 2012 14:48:02 GMT -5
Whoops! Looks like my solution does not work if opengl version is lower than 1.5 (because queries aren't supported).
I wrote an alternative version, but it's much slower. Oh, well, it should be just a fall-back solution, right?
Here is the code:
int Global::CheckCollision (int type1, int type2){
glClear(GL_COLOR_BUFFER_BIT); glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
//glPushAttrib (GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GEQUAL,.7);
glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluOrtho2D (0, 1, 1, 0); // Top left corner is (0, 0). Bottom right is (1, 1). glMatrixMode (GL_MODELVIEW); glLoadIdentity ();
// Apply camera transformations float m1 [16], m2 [16];
// Scale in window dimensions glScalef (1.0f / Global::width, 1.0f / Global::height, 1); Scale (Global::width, Global::height, 1); CopyMatrix (m1, matrix);
// Camera scale and rotation glTranslatef (Global::width / 2,Global:: height / 2, 0); Translate (-Global::width / 2, -Global::height / 2, 0); MatrixTimesMatrix (matrix, m1, m2);
glRotatef (-Global::camAngle, 0, 0, 1); RotateZ (Global::camAngle); MatrixTimesMatrix (matrix, m2, m1);
float camInv [16]; CopyMatrix (camInv, m1); // Parallax settings float dist = Global::height / (2 * tan (Global::fov * M_PI / 360)); // Effective distance of screen
int CollisionType=type1;
for (int i=1;i<=2;i++){ list<Sprite*>::iterator it;
for(it=Sprite::sprite_list.begin();it!=Sprite::sprite_list.end();it++){
Sprite* cursor=*it;
if (cursor->ZOrder < 0) break;
// Sprite must be visible. // Must also be in front of camera (if parallax mode). if ((cursor->collision_type==CollisionType)&&cursor->visible&&(!cursor->parallax||cursor->ZOrder >= Global::camZ - dist + 0.0001)){ glPushMatrix ();
// Build rest of camera matrix. if (cursor->parallax) { float parallaxFactor = dist / ((cursor->ZOrder - Global::camZ) + dist);
// Update camera matrix glScalef (parallaxFactor, parallaxFactor, 1); Scale (1.0f / parallaxFactor, 1.0f / parallaxFactor, 1); MatrixTimesMatrix (matrix, camInv, m1);
glTranslatef (-Global::width / 2, -Global::height / 2, 1); Translate (Global::width / 2, Global::height / 2, 1); MatrixTimesMatrix (matrix, m1, m2); } else { glTranslatef (-Global::width / 2, -Global::height / 2, 1); Translate (Global::width / 2, Global::height / 2, 1); MatrixTimesMatrix (matrix, camInv, m2); }
glTranslatef (-Global::camX, -Global::camY, 0); Translate (Global::camX, Global::camY, 0); MatrixTimesMatrix (matrix, m2, m1);
// Render sprite if (cursor->solid) { glDisable (GL_BLEND); } else { glEnable (GL_BLEND); glBlendFunc(cursor->srcBlend, cursor->dstBlend); } cursor->Render (m1); glPopMatrix (); }
} CollisionType=type2; if (i==1){ glReadPixels(0,0, Global::width, Global::height, GL_ALPHA, GL_BYTE, collision_buffer_1); glClear(GL_COLOR_BUFFER_BIT); } }
glReadPixels(0,0, Global::width, Global::height, GL_ALPHA, GL_BYTE, collision_buffer_2);
int occ=0;
char* c1=collision_buffer_1; char* c2=collision_buffer_2;
for (int y=0; y<Global::height; y++){ for (int x=0; x<Global::width; x++){ if (*c1 & *c2) occ++; c1++;c2++; } }
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDisable(GL_ALPHA_TEST); glDisable(GL_STENCIL_TEST);
return (int)occ;
}
Of course, you need to add lines:
collision_buffer_1=new char[width*height]; collision_buffer_2=new char[width*height];
in Graphics(), and fix global.h
|
|
|
Post by Darkjester on Jul 17, 2012 18:42:51 GMT -5
Angros you should start a new thread for your sprite engine.
|
|
|
Post by DJLinux on Jul 29, 2012 6:19:36 GMT -5
Only as info Next week i'm back from hell. (what a f u c k) May be i can share "hot code" with you all.
Joshy
|
|
|
Post by Darkjester on Jul 29, 2012 22:37:14 GMT -5
Only as info Next week i'm back from hell. (what a f u c k) May be i can share "hot code" with you all. Joshy Hot code? please elaborate  No this has not dried up, progress has just slowed due to some time constraints and code complexity and lack of help. Also tom I need some help with the standalone component (the exe generation) i know how it works, but the way you have written it uses some headers i assume come with borland compilers.
|
|
|
Post by b4gluser53 on Aug 1, 2012 20:35:16 GMT -5
How soon will new version will ready to test drive OR Downloaded? Just asking though? What will the basic different between two version?
|
|