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.


Topics - vicer1234

Pages: [1]
1
Graphics / slow frame rate
« on: June 19, 2011, 02:49:03 pm »
Hi,
I tried to implement the water ripple effect using the image manipulation similar to shown in link http://www.youtube.com/watch?v=fdVLPoJtDgA&feature=channel_video_title
The strange thing in it is, when i use a large image like 800X600 or 1024X768 etc the processing becomes very slow.

It happens like its consuming lot of CPU!!! but I dont get the idea why is it happening since the CPU can handle good amount of
calculations at a time. If the pixels numbers are like 1024*768 = 786432 then also it can process it faster!!!!
Then why is it very slow in rendering?????

All suggestions are welcome

2
General discussions / Executable error
« on: June 18, 2011, 12:49:42 pm »
Hi,
      I have used sfml 1.6 and created a demo. But when i try to run the executable which is generated in release mode, in some other system for testing. It shows the error
            MSVCP100.DLL IS MISSING

I even tried to keep the msvcp100.dll inside the executable folder but still it does not run...

what can be the reason for it....as i have to make this demo running in other systems too

all suggestions are welcome

3
General / SFML and OPENGL co-ordinate
« on: June 09, 2011, 08:22:31 pm »
Hi,
     using Sprite.SetPosition(10,10) will set the sprite at 10,10 from the left top corner.

But in the same window if i use glVertex2f(10.0,10.0)  it will get placed in some other position with reference to the centre of the screen (Opengl)


How to related it, like taking the SFML co-ordinate as reference the Opengl prmitives should also be drawn at the same place. eg

Sprite.SetPosition(10.0, 10.0);   and glVertex2f(10.0,10.0) at the same place

How to make it happen???

All suggestions are welcome

4
General / Time based grid movement
« on: June 09, 2011, 02:05:12 am »
Hi,
      I am trying to make a grid based game. I have a 100x100 grid, where i can control my player to move across one slot using key.
The player movement is working well and I can move across the grid ONE FRAME AT A TIME.

The main problem is with AI player movement. I am using A* algorithm to get the path for the AI component. What i am doing at present is:

1) I give the AI player position and the goal position to the A* algorithm and generate the path. ( this calculation is Inside the game Update function )
           The output of the A* algorithm is a string which gives the grid locations.
2) Then inside the draw function when I use a for loop to draw for each grid location, the AI player reaches the goal in split of a second..just within one frame


what i want is that the ai player should move slowly towards the goal ...so that there is a perfect competition between the user and ai to reach the goal.

How to control the movement of  AI player so that its playable enough?????


All suggestions are welcome......

5
General / Application gets slow/stuck
« on: June 08, 2011, 03:50:30 am »
Hi,
     I am making a game with couple of level. each level is represented in terms of states, like we can push and pop each state.

Each level have common functions like
Initialise()->HandleEvents->Update()->Draw()

In one level i am having couple of sprite and I am using sfml functions like Sprite->Move(x,y)  etc to manipulate the entities.

In this level i tried to call function from my particle engine. In the particle engine i have tried to display the particle using opengl primitives. It will look like
Code: [Select]

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 1.f, 500.f);
std::list<Particle>::iterator iter;
for( iter = mL_Particle.begin(); iter != mL_Particle.end(); ++iter)
{
if((iter)->m_Energy > 0)
{
//if the particle is still alive, then draw
glPushMatrix();
glTranslatef((iter)->m_ParticlePosition.x, (iter)->m_ParticlePosition.y, -400.0f);
std::cout<<(iter)->m_ParticlePosition.y<<std::endl;
glRotatef((iter)->m_Angle,0,0,1);
//glScalef(1.0f, 1.0f, 1.0f);
glColor4ub((iter)->m_Color.r, (iter)->m_Color.g, (iter)->m_Color.b, (iter)->m_Color.a);
glBegin(GL_QUADS);
glTexCoord2f(texCoords.Left,  texCoords.Top); glVertex2f(-halfWidth, -halfHeight);
glTexCoord2f(texCoords.Left,  texCoords.Bottom); glVertex2f(-halfWidth, halfHeight);
glTexCoord2f(texCoords.Right, texCoords.Bottom); glVertex2f(halfWidth, halfHeight);
glTexCoord2f(texCoords.Right, texCoords.Top); glVertex2f(halfWidth, -halfHeight);
glEnd();
glColor4ub(255, 255, 255, 255);
glPopMatrix();
}

}


Couple of problem is happening:
1) The positioning of the particle is not correct.Since in the particle case its using the Opengl co-ordinate with origin at centre of the screen.
2) It gets slow and frame rate decreases ..I dont know why this is happening...Is it because i am using one draw() for smfl related case and another draw() is getting called  for Opengl.????

Everything runs smooth and when i click a button to generate a particle effect it get slower and slower!!!!!


All suggestions are welcome

6
General / Sine wave movement
« on: June 07, 2011, 08:54:07 pm »
Hi,

           I want to move the sprite in a sine wave pattern. For that i am trying
is for example if the screen resolution is (800,600), i am taking :

X = 800 and then generate Y = Sin(X) and gradually decreasing the X--;

For the movement i am  doing

Code: [Select]

Sprite->Move(-X * GetFrameTime(), Y);


But the problem is that the movement is not smooth and the sprite flickers while moving.
How can i get a smooth sine wave movement with high steep along Y axis as for the present values the upward movement is very small.
I tried to scale the Y value with some factor like 10.0, but still its very jerky movement.

All suggestions are welcome

7
General discussions / Random number generator
« on: June 07, 2011, 01:39:13 pm »
Hi,
  I am trying to get random number generated by using sf::Randomizer
but every time i am getting the same number. when i run the program.

my code is
Code: [Select]

Randomizer1(float min,float max)
{
sf::Randomizer::SetSeed((unsigned int)time(NULL));
float value = sf::Randomizer::Random(min, max);

return value;
}


Random(int min, int max)
{
srand((unsigned)time(0));
int val = min + rand() % max;

return val;
}



its first i will use Random() then Randomizer like this
Code: [Select]

int min = Random(1, 5);
int max = Random(6,10);
float result = Randomizer1((float) min, (float) max);


Why is it happening??....i am trying to build a particle engine. For that i am using this function to get random values for the velocity/energy etc for each particle.


All suggestions are welcome

8
General / SFML CPU usage
« on: May 19, 2011, 07:05:40 pm »
Hi,
         I am just running a simple code:

Code: [Select]

int main(int argc, char* argv[])
{
sf::RenderWindow Game(sf::VideoMode(800, 600, 32), "Box2d");
while(Game.IsOpened())
{
while(Game.GetEvent(Event))
{
if(Event.Type == sf::Event::Closed)
Game.Close();
}

Game.Clear(sf::Color(127, 149, 237));
Game.Display();

}
}



when i check the CPU usage in task manager it is around 45-50%.
Why so much high percentage usage, am i doing something wrong?

9
Graphics / freezing effect
« on: May 17, 2011, 12:37:26 am »
Hi,
    I am making a 2d game in which i want to implement a gun, which has the effect to make the character appear like frozen.

I am having doubt about how to show this effect. Do i have to keep a track to check what type of bullet is been used,when hit by a frozen type, the animation shows that the character is freezing?

In order to implement it programmatically like a simulation effect, how should i approach it.??

All suggestions are welcome

10
Graphics / SetCenter()
« on: May 16, 2011, 12:32:56 pm »
HI,
       I have a doubt about SetCenter() function.

Like if i use
Code: [Select]

sf::Shape Box = sf::Shape::Rectangle(0, 0, 32, 32, sf::Color(0, 0, 0, 200));
        Box.SetCenter(16, 16);


here it means a rectangle of 32 width and 32 height. its center is 16,16 ??

Code: [Select]

           (0,0) ---------------
                 |              |
                 |   (16,16)    |               is this figure correct representation
                 |              |                      of default  Shape::Rectangle
                 ---------------  (32,32)


I am confused with the Setcenter() of SFML. Does it sets the center of the rectangle at (16,16) but then whats the center by default(0,0)???

By default How can (0,0) be the center of a rectangle of Rectangle(0, 0, 32, 32, sf::Color(0, 0, 0, 200));???
 (0,0) is the Origin of the screen co-ordinate !!!!!


The doubt basically comes up because I am using Box2d with SFML. Since its co-ordinate system is different from SFML, I am trying to  use SetCenter() to place the body correctly.

11
Graphics / Pixel value from Image
« on: May 10, 2011, 02:55:10 am »
HI,
         I am trying to get the pixel value from  a .TGA file.
After reading the value it is stored in a buffer array. then the buffer array is manipulated to get the desired effect.

It is used for the 2d water ripple effect.

My problem is when I use
                      Image.GetPixel(i,j);
it returns value that is not numeric for eg: it sends value as r='L' g = '£'  b='A'

as a result i am not able to retrieve the numeric value of each pixel. So i cannot store proper value in BUFFER.

And i cannot use  the function     Image.SetPixel(i,j, sf::color( r,g,b))

since the value of (r,g,b)  cannot be properly set since its not retrieved properly from the GetPixel();

What should i do get the proper (r,g,b) value

All suggestions are welcome

12
Graphics / 2d water ripple effect
« on: May 09, 2011, 01:07:21 pm »
Hi,
      I want to implement 2d water ripple effect in my platformer game.
Can anyone suggest any idea for it.

13
General / SFML and Box2d
« on: May 03, 2011, 01:15:52 am »
Hi,
How to manage the co-ordinate system of SFML and Box2d??/
When i use the syntax
groundBodyDef.position.Set(100.0f, 50.0f);
and use this position in SFML

sf::Shape::Rectangle(groundBodyDef.position.x, groundBodyDef.position.y, groundBodyDef.position.x + 680, groundBodyDef.position.y - 10, sf::Color(127, 127, 0, 255));


It draws the rectangle at one position and the collision appears in other position.

Any suggestions ....

14
General / SFML 1.6 and VS2010
« on: April 11, 2011, 01:07:52 pm »
hi,
     This is my first time with sfml.I am trying to run sfml 1.6 in VS2010 but its giving lot of errors.  I have rebuild the libs from source using VS2010 but its giving me this error.

unhandled exception at 0x76dbf7cc in sfml_test.exe:0xC00000005: Access violation reading location
0x6e695720


I want to know whether SFML 1.6 will work in it or not. If there is solution to get it working please do let me know.

I dont want to revert back to VS2008 to make it work.

Regards

Pages: [1]
anything