Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [ODFAEG] (Open Source Development Framework Adapted for Every Game)  (Read 155774 times)

0 Members and 1 Guest are viewing this topic.

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #105 on: March 05, 2014, 01:26:34 pm »
I've found the bug!!!

The states.transform = getTransform() was in the wrong place :

virtual void draw(RenderTarget& target, RenderStates states) const
    {
         states.texture = &m_tileset;
        states.shader = frameBufferGenerator;
        //Update the frame buffer and draw the current frame.
        frameBufferGenerator->setParameter("depthBuffer", depthBuffer.getTexture());
        frameBufferGenerator->setParameter("frameBuffer", frameBuffer.getTexture());
        frameBufferGenerator->setParameter("texture", Shader::CurrentTexture);
        frameBuffer.setView(view);
        frameBuffer.draw(m_vertices, states);
        frameBuffer.display();
        //Update the depth buffer.
        depthBuffer.setView(view);
        depthBufferGenerator->setParameter("depthBuffer", depthBuffer.getTexture());
        states.shader = depthBufferGenerator;
        depthBuffer.draw(m_vertices, states);
        depthBuffer.display();
        states.shader = nullptr;
        states.transform = getTransform();
        Tile& tile = getFrameBufferTile();      
        target.draw(tile, states);

    }
 

So now to optimizate that I've just to reimplement the cllmap, gridmap and map classes for the 3D. (And I can get rid of the z sorting)
« Last Edit: March 05, 2014, 01:28:24 pm by Lolilolight »

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #106 on: March 05, 2014, 01:39:08 pm »
to optimizate

Well done for your bug.

Now, Nathalie tells me "optimizate" is not defined, did you mean "optimize" :) ?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #107 on: March 05, 2014, 02:08:38 pm »
const_cast<TileMap*>(this)->tile = new Tile (&frameBuffer.getTexture(), frameBuffer.getView()->getPosition(), frameBuffer.getView()->getSize(), subRect, zOrder);

Lolilolight, I really doubt you understand how bad this code is, you really need to use smart pointers (at the moment you have a major memory leak) and learn how to correctly use const_cast. This is just one of the many examples throughout this thread as to why people will most likely not be using your framework.

Even about the z-order sorting, its really not that difficult if you use some of the already built stl containers instead of reinventing the wheel using some crazy shader workaround (hack in my book).

states.transform = getTransform();

Even this is not really the correct way to use the transform, you should be using the *= operator.  :P

And take this from a mainly C# dev, even I can see major issues with your code.  ;)
« Last Edit: March 05, 2014, 02:18:42 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #108 on: March 05, 2014, 03:11:04 pm »
 I've no memory leaks on my PC so, I don't know exactly what you mean...., I can't use smart pointer everywhere because of premature destruction. (With the signal and slot functions)

I do already the * in the odfaeg::transformMatrix class instead of the sf::Transform class (because I need also to have 3D transform) :P

And I've get rid of all the const_cast.

PS : I don't do a z-sorting but I've to do a vector of vector so I prefer reduce the number of std::container used by using a shader.
« Last Edit: March 05, 2014, 03:14:05 pm by Lolilolight »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11016
    • View Profile
    • development blog
    • Email
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #109 on: March 05, 2014, 03:43:56 pm »
I've no memory leaks on my PC so, I don't know exactly what you mean...., I can't use smart pointer everywhere because of premature destruction.
At least you have a fitting nick: Lol ;)

How exactly are you cleaning up your allocation mess, because I can't find any delete anywhere:


Plus, you can ask any C++ programmer and they will tell you, that things like the following are not how you write proper C++ (see here and here):
static Tile& getX()
{
    Tile *tile = new Tile(...);
    return *tile;
}

You should seriously go through the book list provided in that SO thread. It's not like we pull all this advice from thin air, but they come from people that do scientific research on all of these topics, or people that keep shaping the C++ standard or even from the creator of C++ himself. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #110 on: March 05, 2014, 07:40:52 pm »
I have still to change the view right, I'll return a reference of the view instead of a pointer.

For static variables, aren't there destroyed automatically ?

I can't destroy them because there are not linked to an object...
But, I think I'll add a function which'll destroy the static variables when I'll close the appi. (I need some of static variables anyway for the Network, the World, the Pipeline and other objects which have to be unique in the framework)

And, I suppose I have to read some threads a bit.

But I already know that I'had to clean up my code a bit, all that I wanted to have until now was something with works. (And which is amore optimized)
Because my previous code was too slow. --' (And with the networking it was worth)

Even with the STL container it was still a bit too slow. (Because I had too many draw and I have a lot of matrix multiplication to do with the scene node, and then I'll have to implement the particuel system, the network and the rest of the 3D, so I need to have a fast rendering time. ;) )

And faster than what the default SFML functions and opengl pipeline does.

It's not like blender or other opensource projects when they don't care about the rendering time which can be very very long.
And I'm sure that every games use their own pipeline. (Except on PCs which doesn't support shadersof course)

I've played at many f2p games but it was very too slow and sometimes I'had memory leaks too.

So my Pc was very slow at the end of the day. (Because the games consume too much resources)

I've not this problem with ODFAEG. :)

I've not a big game yet but framework is finish soon so, if the root is solid, the rest should be good.
« Last Edit: March 05, 2014, 07:53:27 pm by Lolilolight »

wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #111 on: March 05, 2014, 09:19:20 pm »
For static variables, aren't there destroyed automatically ?
Thats a static function, not a static variable. :-X

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #112 on: March 06, 2014, 11:57:25 am »
I've played at many f2p games but it was very too slow and sometimes I'had memory leaks too.

So my Pc was very slow at the end of the day. (Because the games consume too much resources)

I've not this problem with ODFAEG. :)

Mate, when you close an application, pretty much any major OS will cleanup all resources used by the process.. That doesn't make a lot of sense (except perhaps if you're saying the memory was a bit too fragmented?)..

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #113 on: March 06, 2014, 10:11:26 pm »
Quote
(except perhaps if you're saying the memory was a bit too fragmented?)..

Yes.

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #114 on: March 07, 2014, 02:19:38 pm »
Hi guys.

Finally I don't think I'll launch a release yet, I'll finish all the functionnalities so I'll be able to show you exemple of very different game genres created with ODFAEG. (Because apparently this is what interest you)

It'll be useless to launch a realease which do the same things that existing library.

The framework is maybe a bit more complexe and I don't use 3 kind of matrix but 4. (base changement matrix, projection matrix, view matrix and transformation matrix.)

The base changement matrix is used to pass from one landmark to another. (Example : 2D to 2D isometric landmark.)

The projection matrix is used to pass from view coordinates to eyes coordinates. (Example : 3D view coordinates to perspective projection coordinates.)

The view matrix is used to pass from world coordinates to view coordinates.

And the transformation matrix is used to apply transformations to each objects.

But hopefully I've implemented some classes which already do all the job for you.
Actually I'm finishing to work out the 3D view class and my own pipeline. (To be able to render semi-transparent object with a depth test)

So It become very easy to display sem-transparent objects with the framework, you have just to put the faces of the objects into the pipeline when you update the current frame and draw everything which only one draw.

I'll finish this part so, I've not so many things to implement what's only remain is :

-The networking. (I've already a system which movement prediction but I've to rework the code a bit and put it to the framework)

-The particule system. (I'll re-use the thor classes which seems to be fine. :) )

And the rest is the 3D part, I just need to implement a terrain generator. (I'll certainly do an heightmap and a raytracing to select objects (I've already done one in another project.))

A shader to render shadows and lights.

A 3D objects loaders and normally that's all.

The last complicate thing that I've to do is bones animations. (Fof example when I move the hand of the caracter, the glove moves with it.)

But it should be and I'll be able to launch the final release in 2016 I hope because I'll resume classes soon.

I'll update the git-hub repository this evening because I've made some changement in the 3D part and I've added the own framework pipeline.

I've clean up the code a bit to get rid of the bad code. (By making the Entity class copiable, it's not a problem because this lass is not heavy.)












Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #115 on: March 08, 2014, 03:39:02 pm »
Hi guys, I've updated the git-hub repository yesterday with the tilemap class and now I'm working on adapting the EntityManager to store 3D entities.

3D entity managers and bounding volumes'll have the advantages to allow to store and manage collisions with 3D and 2D entities. (For 2D entities, the depth of the gridMap'll cells and the bounding volumes'll be 0)

But unlikely the 2D entity managers, I can't store the z component of 3D objects in the stl container because the z component of all objects vertices is not the same.
Most of all, I need the opengl z interpolation of the pixels between the objects vertices.
So I need to do a test per pixel and not per entity like in 2D.

So ODFAEG'll provides two ways to manage the rasterisation.

-The first one is to activate the opengl depth test and alpha test if you have transparent objects. (But it'll not work with semi-transparent objects because if the alpha component of an object's pixel is less greater than an other object's opaque pixel wich is behind the semi-transparent pixel object's, the opaque pixel'll be hidden by the opengl depth test or we should see throw the semi-transparent pixel)
I had to find a solution so and this solution is to draw all visible objects on a framebuffer texture by applying a shader on this rendertexture which'll do the depthtest, the alpha test and the alpha blending.
Then I create a tile which the texture of the rendertexture and I draw it.

-The second method is to use the TileMap class of ODFAEG to render 3D visible objects.

Once I'll have finished that, I'll create a particule system, the network and then 3D terrain and 3D objects management and that'll be ok for the last release.





Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #116 on: March 08, 2014, 05:36:57 pm »
will you make a 3D game to use all those features? =)

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #117 on: March 08, 2014, 06:15:41 pm »
Quote
will you make a 3D game to use all those features? =)

Yes exactly, I've pretty finished the 2D part so now I need 3D features and I'll make a 3D FPS to test the 3D features.

And then finish my 2D hack and slash in 3D iso, and  my full 2D small games of course. ^^




Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #118 on: March 11, 2014, 01:25:14 pm »
Hi guys, actually I need to rewrite all the SFML classes of the graphic module to display also 3D Shapes, 3D Tiles, etc...

I'll probably add ellipsoïd and curves but it's not a priority.

For 3D text I don't know, I've to look into the 2D sfml Font and text classes to see if I can implement that functionnality. (It's one of the rare things that I've never tried but it'll be very interesting to learn. ^^)
« Last Edit: March 11, 2014, 01:27:06 pm by Lolilolight »

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: [ODFAEG] (Open Source Development Framework Adapted for Every Game)
« Reply #119 on: March 16, 2014, 04:36:30 pm »
Hi, I'll update the git-hub soon, I've tested ODFAEG on linux and it seems to work. ;)

My tilemap system seems to also works, so, I'll add a new functionality which'll choose the most optimized way to render the current frame depending on which functionalities that the hardware support. (But most of all on  recent PC it'll be the ODFAEG Tilemap and 3D ODFAEG support classes which'll be used. ^^)

I need to have big f2p games on linux like it's the case for windows. (Because I prefer linux. ^^)


 

anything