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

Pages: [1] 2
1
Network / Re: How to reduce the delay in TCP?
« on: December 19, 2013, 02:22:00 pm »
I put everything in the game loop, including function for network. Is that bad?

2
Network / Re: How to reduce the delay in TCP?
« on: December 19, 2013, 01:59:24 pm »
Thank you so much. Can you give me an idea of how to limit the frame rate?

3
Network / How to reduce the delay in TCP?
« on: December 19, 2013, 05:26:36 am »
I'm making a networking game for my network class. I have not done any game with network before.
I use server-client for my game. It works okay with 2 clients, but when 3 player connect the delay occurs like when I move one player I have to wait about 3-5 secs on others screen to see the result.
I show in this video.


I send all x and y to server every frame. Is it too much for sending data?

4
Graphics / Sprite disappears when move render window.
« on: December 16, 2013, 07:30:09 am »
When I move the render window my player sprite disappears from the window but others sprites still exists in the window.
My player sprite is not a static sprite. It moves all the time, but the others is static sprite, they don't move.

How can I fix this problem?

Edit. It seems like when I move the render window it makes some conflicts with collision test so it makes my play sprite fall of the screen.
Is there any method to capture move window event?, so I can pause the updating collision.

Thanks in advance.

5
General discussions / Re: Android and iOS ports available for testing
« on: December 07, 2013, 03:33:49 am »
Is the stable version available soon? I would like to use SFML for my Android game project.

6
General / Re: Linking SFML with Qt
« on: November 08, 2013, 07:40:10 am »
Another question, can I render SFML inside Qt window? or I have to separate them.

7
General / Re: Linking SFML with Qt
« on: November 08, 2013, 06:49:35 am »
I forget to put .dll file in my project now it already works.  :D

8
General / Linking SFML with Qt
« on: November 07, 2013, 06:38:46 pm »
I can't run Qt program after it's linked with SFML.
It says "The program has unexpectedly finished".

This is my .pro file.

#-------------------------------------------------
#
# Project created by QtCreator 2013-11-07T22:13:54
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = MapEditor
TEMPLATE = app


CONFIG(release, debug|release): LIBS += -LE:/SFML21/lib -lsfml-audio -lsfml-graphics -lsfml-network -lsfml-window -lsfml-system
CONFIG(debug, debug|release): LIBS += -LE:/SFML21/lib -lsfml-audio-d -lsfml-graphics-d -lsfml-network-d -lsfml-window-d -lsfml-system-d

INCLUDEPATH += E:/SFML21/include
DEPENDPATH += E:/SFML21/include

SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

Am I do something wrong?
I use Qt 5.1.0 32 bit Visual Studio 2012 and SFML 2.1

9
General / Calculate start position for shooting bullet from the ship.
« on: September 01, 2013, 08:14:19 am »
Hi guys, I try to make a ship shoot a bullet toward a mouse position with this code
float deltaX = mousePosition.x - (aircraft.getPosition().x + aircraft.getLocalBounds().width / 2);
float deltaY = mousePosition.y - (aircraft.getPosition().y + aircraft.getLocalBounds().height / 2);
float angleRadian = (float)(std::atan2(deltaY, deltaX));
float angleDegree = (float)(angleRadian * 180 / PI);

It works fine with one bullet but when I add another bullet I can't figure out how to calculate the start position for each bullets.

This is a picture of this problem.


I try to specify start position of each bullets by this code.
sf::Vector2f offset1(aircraft.getPosition());
offset1.x += -10;//start shooting point for first bullet.

sf::Vector2f offset2(aircraft.getPosition());
offset2.x += 10;//start shooting point for second bullet.

But when I rotate the ship to other angles the bullets are not the same as the first picture.
How can I calculate the start position of each bullets? :)

10
I have a epub version so, I dont know what is the page 60 actually in the book  ???
but I guess.

This is the draw function of The SceneNode class
void SceneNode::draw(sf::RenderTarget &target, sf::RenderStates states) const
{
        states.transform *= getTransform();
        drawCurrent(target, states);

        for each (const SceneNode::SceneNodePtr  &child in _children)
        {
                child->draw(target, states);
        }

}

In The World class I call this function to render the parent node
_renderWindow->draw(_sceneGraph);

after I call it. Does the _sceneGraph call
void SceneNode::draw(sf::RenderTarget &target, sf::RenderStates states)
by itself?


11
It tells me to make a SceneNode class which inherits from sf::Drawable and sf::Transformable so I can draw by pass it as a paremter for the RenderWindow.draw() function

what I don't understand is for example, I have a SceneNode as a top of the SceneGraph then I call RenderWindow.draw(SceneNode). The result is every child node of SceneNode also draws too.
How it could be possible?

12
Oh, Sorry I mistype it. Actually I wanted to ask you about this

Is it good to have 340 textures because my render method is this?

I'm really sorry  :-[

13
It is good to have 340 textures because my render method is this
for(auto i = 0; i < TOTAL_PLATFORM; ++i)
        {
                window.draw(platformArray_test[i], &platformManager.getPlatform(i));

        }

platformArray_test = array of vertex array
and platformManager.getPlatform(i) returns a texture

14
Graphics / I try to load tiles form png file but it takes time so long.
« on: August 08, 2013, 11:30:28 am »
int i = 0;
        for(int y = 0; y < 17; ++y)
        {
                for(int x = 0; x < 20; ++x)
                {
                         if(!platformTexture[i].loadFromFile("Resources/Tileset/Tilesets.png", sf::IntRect(x * TILE_WIDTH, y * TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT)))
                                std::cout << "error..." << std::endl;
                       
                         ++i;
                }
        }
       

The png file size is 640*640 and tile size is 32*32
Loding tiles from this file takes time about 6 secs.
What is wrong with my code?

15
alright, I place clock.restart() after window.display() and window.clear() so it returns wrong value  ;D

Pages: [1] 2