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

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 - DarkRoku12

Pages: 1 2 [3] 4 5 ... 14
31
SFML projects / Zalaz Engine: Particle Lab
« on: October 27, 2016, 02:44:27 am »
Hello SFML users, long time ago i started a game engine with SFML as it core.
Its only can be scripted with Lua.

The engine have been developed to work with the Lua C-API and the Luajit's FFI (the user can switch APIs at runtime -if wanted- without change any code or logic). So games can achieve native speed with Luajit's ffi.

I need to finish the docs, and finish the others editors.

Later i will make a post of the engine with all its features (it have a LOT of them).

But in this one i want to show the ParticleLab, a tool made using only the engine (entirely in Lua) that will help you in the development of the Particle System you want for your game. (Yes, is done with the engine, for the engine).

I have made so far only one demo video of the ParticleLab:


The power of the Particle System of the engine is great, you can emulate the great Thor example of Fireworks.


Or even a moving galaxy for a space shooter game:


You only code in Lua, and the editor is for make your the life easier in the process of modify-update the script.

32
General / Re: Build android application, undefined references.
« on: October 27, 2016, 02:22:14 am »
check my signature, hope you get what you need.

33
Network / Re: Incompatible packets with sf::Packet blocking program
« on: October 25, 2016, 10:03:56 pm »
It's your job to ensure that sf::Packet only receives compatible data. I know it's not ideal, sf::Packet suffers from many design issues and it will hopefully be improved in the future, but that will not happen before SFML 3.

So Laurent, while we wait, you recommend better to use other posibles alternatives like SFNUL from binary1248?

34
The first question is answered here.
2) OpenGL is a 3D graphics API, so its just 2D without depth. 3D involves volume. (A more complete answer can be given by a more expert openGL user or just google it)
3) Its far better to move the view.
4) Depends on the size (mb) of the assets.
5) Share when you can share, duplicate when you really need two instances of the same object.




35
Network / Re: std::vector of sockets [c++]
« on: October 17, 2016, 05:41:41 am »
(will change in SFML 3)

Sorry for detract the thread but, ¿Any hints/plans about when SFML 3 will be released?

36
General / Re: Drawing sprites from another thread
« on: October 17, 2016, 05:28:35 am »
Two threads cannot be using the same openGL context at the *same* time.
See sf::Window::setActive

Tips:
1) Remember to use threads ONLY if you REALLY needs them.
2) Remember to take a look about Synchronization and Parallel programming.
3) Implement what you are doing without threads first when it have no-bugs then implement threads, so when you face a bug its more probable that multithreading is causing the bug and not your base algorithm.


37
General / Re: Visual Studio Debug/Release Issues
« on: October 17, 2016, 05:19:19 am »
1) Use the same framerate limit on the two versions.
2) Use a delta-time based counter, not a generic frame counter.
3)If you want to show code, show a more appropriate code, the two snippets of code show us *nothing*.

38
General / Re: many function arguments
« on: October 13, 2016, 06:33:29 pm »
its depends on the compiler and the processor.

x86 have 4 register: EAX EBX ECX EDX (32 bits registers), a compiler can push directly parameters to the stack.

push [constant]|[register]|[memory adress]
push [constant]|[register]|[memory adress]
call _myFunctionName
 

Often the values pushed are not constant so the compiler needs to use the 4 32-bits registers.
If your function have a lot of arguments the compiler needs to move some data between register.

But if yuro processor supports and your compiler use SIMD extensions you can have 4 more 32-bits register (XMM registers).

If you have 8 arguments better you pack few in structs or something.

But don't worry how many arguments you are passing, it is unprobable that you notice the performance hit if any.

But 8 arguments are kinda ugly in my opinion.


And for those questions go to a general C++ forum.
This forum is to discuss about SFML related things.

39
General / Re: TileMap Collision. Help please!!
« on: October 13, 2016, 06:11:11 pm »
Please use the code tags when posting code please.

Before colliding severals objects you need to first understand the collision theory.

Hint: Start first with two objects, both AABB, google AABB vs AABB collision, and using ::getGlobalBounds provided by the SFML api you can achieve this.

Then try with more objects.

If you will done advance physics better use Box2D.

40
Graphics / Re: Why sprites?
« on: October 13, 2016, 05:33:17 am »
RectangleShape have few more methods.

But i think sf::Sprite its more intuitive.

41
Graphics / Re: Segmentation Fault with vector<Sprite>
« on: October 12, 2016, 11:38:39 pm »
If you for some reason need to declare a vector inside a function (and don't want to create it again and again) use the 'static' keyword.

But first you must follow the Laurent's advice:

Quote
Please please don't try to write random stuff, learn how to use std::vector and C++ properly.

42
SFML projects / Re: Zeran's Folly
« on: October 12, 2016, 03:42:10 am »
Such a great game!
Amazing moving and physics. :o

43
your problem is here:


       if (phase = 0)
         {
            Entity enemy {...}; //--> HERE
            ents.push_back(&enemy);
            phase = 1;
        } //--> Entity is destroyed here, so the pointer to enemy is not valid anymore.
 

  std::list<Entity*> ents; //--> You have a list of pointers, so your pointers need to be VALID.
 


        for (Entity* e : ents) {
            window.draw(e->rect); //--> Here your are drawing NULL pointers as a sf::RectangleShape
        }
 


Solution:
       if (phase = 0)
         {
            Entity *enemy = new Entity {...}; //--> The entity will be allocated on the heap.
            ents.push_back(enemy);
            phase = 1;
        }
 

Remember to destroy the pointers when you don't need them.
Or try to use RAII in some way.

44
Graphics / Re: White box glitch when creating multiple objects in a loop
« on: October 11, 2016, 12:24:05 am »
I know about the white box drawing error when you load things wrong, and I fixed that in previous programs. But I can't figure out how to prevent this from happening when I create multiple objects in a loop and add them to a list. Here is my code:

relevant parts of main.cpp

//  Creating a vector that contains all the platforms
vector<Platform> platforms;

//  An array of all the platforms in level 1 - x, y, width and height (in pixels)
int level1[] = {100, 600, 8, 1};

//  Looping through all the ints in the level list, and creating platforms
for (unsigned i = 0; i < (sizeof(level1)/4) - 1; i += 4) {
    platforms.push_back(Platform("brick.png", level1[i], level1[i + 1], level1[i + 2], level1[i + 3]));
}


 

Quoted from sf::Sprite::setTexture

Quote
The texture argument refers to a texture that must exist as long as the sprite uses it. Indeed, the sprite doesn't store its own copy of the texture, but rather keeps a pointer to the one that you passed to this function. If the source texture is destroyed and the sprite tries to use it, the behavior is undefined.

When you store elements on an std::vector<T> and the .capacity() is exceeded is likely the vector will reallocate the memory (invalidating pointers)

So you have severals options:

For textures you can pack then in a std::list (check the image), or use a vector of pointers (std::vector<T*>)

If want to know if a STL containers invalidate references/pointers are invalidate you can check it on http://en.cppreference.com

int level1[] = {100, 600, 8, 1};
 

If you can use c++11 better use std::array and its .size() method.  ;D

45
DotNet / Re: Is SFML stable for commercial use?
« on: October 07, 2016, 06:37:27 pm »
SFML has its bugs, personally i'm making a game engine in top of SFML, i haven't found a bug that affects me.
(Not tested the Network library) but graphics, sounds, window, systems works great.

SFML has a good community and the project is mature.

SFML is not perfect, but yes its reliable for commercial products.

Pages: 1 2 [3] 4 5 ... 14