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 - Roose Bolton of the Dreadfort

Pages: 1 [2] 3 4 ... 8
16
SFML projects / Simple Easy Particle Engine
« on: February 25, 2013, 01:03:14 pm »
Hey All,

Been working on my game for about a month now and the other night decided I wanted a particle system in it. I didn't want to follow the usual route of 'effectors and emitters' but instead just wrote my own functions inside the particle manager eg 'Explode', 'Shrapnel', 'Afterburner' and its very easy to add more of your own particle effects.

I decided it could help some people so I decided to release it as it might be helpful to someone..

haven't released fully yet still cleaning up the code but will be released this week!

this is a video of the effects below, it just uses a simple sf::circleshape and a colour and this is what the outcome looks like.. note its only using 3 effects (afterburner, explode, supernova) I am not a designer so I am sure people can make even cooler stuff...

The system also uses some OpenGL shaders for glowing etc.



Cheers!

17
General / Re: Fading/Scale over time..
« on: February 23, 2013, 05:51:41 pm »
Cheers Nexus.

so;

mSubtract = mLifeTime/255;

.....

loop{

mAlpha -= mLifeSubtract * 255;

}

 

Thats what your saying yeah? But there is only 60 frames in a second.. so this will only be called 60 times meaning it wont get all the way.. I am missing something

18
General / Fading/Scale over time..
« on: February 23, 2013, 05:35:30 pm »
Okay I am trying to make an object fade over a certain time;

so say I want it to fade over 1 second, if I want to find out how much to remove each frame, whats the algorithm for it?

Alpha is 255 so say I want it to fade over 1 second I can do 1/255 to give me how much to subtract.. but my framerate is set to 60.. so only 60 frames are called a second not 255..

Cheers guys.

19
General / Re: What IDE should I use?
« on: February 20, 2013, 04:53:43 pm »
Visual Studio.. just love it.

Some very cool features... although that being said I still don't know what half the buttons do.

20
General / Re: What is this called?
« on: February 18, 2013, 05:07:31 pm »
Oh.. I believe he may have just used a texture.....

who would have known such elegance and beauty could be created through a simple sprite... amazing... ha

21
General / What is this called?
« on: February 18, 2013, 04:56:12 pm »
So I am making a particle engine for my game.. all is going fine.

I was looking at some video's for ideas and saw this one



Notice how the particles have a 'glow' about them.. what is this called in OpenGL? Is it possible with SFML or will I have to start doing raw OpenGL code?

Thanks !

22
General / Re: [SOLVED]Assigning a direction to bullets from a vector
« on: February 13, 2013, 01:43:45 pm »
Quote
The STL container can of course be no local variable, otherwise it would be destroyed at the end of the scope. It is rather a member variable of the surrounding class (but not allocated with new).

If you insert objects into an STL container except std::array, they are stored dynamically (on the freestore/heap), independently of the STL container's own storage class. In modern C++, using directly new and delete to manage memory is almost always a mistake. One should prefer RAII instead.

Okay. So how do you go about destroying the bullets? using the Erase function in the std::vector?

23
General / Re: [SOLVED]Assigning a direction to bullets from a vector
« on: February 13, 2013, 01:23:46 pm »
So in your opinion, creating and destroying hundreds and hundreds of bullets realtime on the stack is okay?
Not on the stack, but yes. Today's computers can handle complex 3D physic simulations. The creation of a few bullets per frame can't be an issue, unless you do something terribly wrong.

It is of course recommended to model bullets as light-weight entities, maybe even pure logic occupying only a few bytes (like position + velocity).

Not just that, but the larger your game gets, and if you keep calling objects everytime you need them (spawning bullets, entities, explosions etc) on the stack.. im sure eventually you will hit stack overflow.
Who says I put them on the stack? You want bullets to outlive the local scope, so you need dynamic storage anyway. Just insert the objects into STL containers. Don't make life more complicated than necessary with pools, they have very specific use cases and should certainly not be the standard approach.

Well he declares them as local objects, so they will be managed on the stack, or am I wrong? How does putting them into an stl container change the fact of what memory they are allocated on?

If he uses new/delete etc, then they will be handled on the heap.

I am just going by past experiences, when declaring bullets over and over (hundreds and hundreds) I get performance hits over having a pool of bullets which there is none. Although I think the objects where quite large...

Cheers for tip Nexus..

24
General / Re: [SOLVED]Assigning a direction to bullets from a vector
« on: February 13, 2013, 12:27:52 pm »
creating new bullets everytime the button is pressed isn't a good way to go about it is?
Yes, it's a good way. It's the most intuitive way, and unless you have a strong reason against it, you should always keep things simple.

I have always been taught to use a 'BulletManager' that has a pool of say 200 bullets which are allocated when the level loads, it then assigns them to whatever entity is firing a bullet... then once the bullet hits a wall or a target it goes back to inactive and can then be reassigned to another shooting entity....
This implies a lot of complexity for probably no gain. It is a phenomenon among game developers that they use "managers" and "engines" for everything and believe that things are terribly object-oriented and magically improve.

Seriously, the additional complexity only pays off if the time to create and destroy bullets is significantly high in relation to other program parts. Unless you can prove it is (by measuring), avoid premature optimization and keep your code simple and understandable.

So in your opinion, creating and destroying hundreds and hundreds of bullets realtime on the stack is okay?

Heh, I always thought it caused performance issues... perhaps I was doing something wrong.

Not just that, but the larger your game gets, and if you keep calling objects everytime you need them (spawning bullets, entities, explosions etc) on the stack.. im sure eventually you will hit stack overflow.

25
General / Re: [SOLVED]Assigning a direction to bullets from a vector
« on: February 13, 2013, 11:35:46 am »
creating new bullets everytime the button is pressed isn't a good way to go about it is?

I have always been taught to use a 'BulletManager' that has a pool of say 200 bullets which are allocated when the level loads, it then assigns them to whatever entity is firing a bullet... then once the bullet hits a wall or a target it goes back to inactive and can then be reassigned to another shooting entity....


26
General / Re: Trying to implement DeWITTER's game loop.
« on: February 13, 2013, 11:32:55 am »
Okay, but limiting framerate is an okay way to go about it?

27
General / Re: Trying to implement DeWITTER's game loop.
« on: February 12, 2013, 03:20:33 pm »
Question..

Why not just use

App.setFramerateLimit(60);
 

Whats the difference between using that and implementing this?

28
General / Re: Simple c++ Question...
« on: January 30, 2013, 12:40:15 am »
It doesn't make much sense to declare the base class member variables private and then try to access them through class functions. Just declare them as protected and you can access them directly within the derived class.

IMHO this-> shouldn't be used for calling member functions if it's not mandatory, because if you handle the scopes correctly (no globals etc.), then it's clear that if you call a function without any prefix, that you're calling the function of the current class. ;)

Yeah it looks tidier with out it anyway ;)

When WOULD this-> be mantatory???

29
General / Simple c++ Question...
« on: January 30, 2013, 12:22:06 am »
Okay.

Say I have a base class which has some physics objects in its private members so;

NOTE - THIS IS A MINIMAL EXAMPLE.

BaseObject Header:
class BaseObject
{
        BaseObject();
        ~BaseObject();

        b2Body& GetBody();
        b2BodyDef& GetBodyDef();
        b2FixtureDef& GetFixtureDef();
        b2PolygonShape& GetPolygon();
        b2World& GetWorld();

private:
        b2Body* mBody;
        b2BodyDef mBodyDef;
        b2FixtureDef mFixtureDef;
        b2PolygonShape mPolygon;
        b2World *mWorld;
};
 

and I have a class that inherits it so;

DerivedObject Header:
class DerivedObject: public BaseObject
{

public:
        DerivedObject(void);
        ~DerivedObject(void);

private:


};
 

DerivedObject code:
DerivedObject ::DerivedObject ()
        : BaseObject()
{

this->GetBody() = this->GetWorld().CreateBody(this->GetBodyDef());

}
 

Now, as with Box2d, it requires lots of initiating the variables. C++ does not allow me to use them as I use above, it gives errors like 'no operator matches =' and 'const this' errors, but I don't know how else to do it? I don't want to make them all public in the BaseClass.. is there any syntax to get around this?

I have use Protected, and that works perfectly and is not accessible to the outside world, but is there any syntax to be able to use the above logic with private get/setters?

30
General discussions / Re: Unofficial Nightly Builds
« on: January 21, 2013, 05:03:21 pm »
I love you!

Fuck CMAKE.

All-together now!

..


.. no one?

Pages: 1 [2] 3 4 ... 8