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

Pages: [1]
1
So, I'm trying to get a basic client-server setup working. I have looked at the provided example, but the server simply waits until it gets a request, responds, and then it will close at the next bit of user input.

I want to build a real working example where the server constantly simulates physics, until it receives a packet, and the client should draw graphics at all times while listening for packets from the server.

I would assume that the only way to solve this is for both the client and server to have separate threads for listening for connections.

I have a simple setup in mind that I would like input on. I can see some issues with this, which I will bring up as well.

Server :
-Has two threads, one for Listening/Processing packets, and one for constantly simulating physics.
-If it receives input, it makes this change in a thread-safe buffer that is available to the other thread.
-If it receives any information requests, the listener responds with the requested info.
-Server updates all clients with updated physics states at a regular interval.

Client:
-Has three threads, one for listening to the server, one for drawing graphics/game logic, and one for audio.
-There is a physical state buffer that is always updated on a regular interval with information from the server. this stores information about the entities that should be watched as they aren't at rest.

I do have some questions about this setup though.

-On the client, it seems that it requires at LEAST 3 threads, but what happens if your processor only supports 2 threads?

-Even if the computer can still handle all the threads, is one thread for networking enough? What if I need to send a packet to the server, at the exact time that the server is trying to send me a packet? Are both of our packets lost?

I appreciate any input you guys can give me, as I'm new to real-time network programming.

2
Window / Call Keyboard::isPressed() in another class?
« on: October 09, 2012, 10:56:42 pm »
Hey guys,
So I want to be able to call Keyboard::isPressed() in another class. Basically, I have a class that handles mapping keyboard and gamepad input. Do I need to have a pointer to my original sf::Window to call Keyboard::isPressed() ? If not, what do I need to pass to my class/function in order to check what keys are pressed?

3
Hey guys,
So I am using OpenGL to draw to an sf::Window in SFML2. The general working setup is something like this :

while(window->isOpen())
{
    sf::Event event;
    while (window->pollEvent(event))
    {
        // Request for closing the window
        if (event.type == sf::Event::Closed)
            window->close();
    }
    window->setActive();
     
    //DO OPENGL STUFF HERE
           
    window->display();
}  

What I need to do is have a function inside another class that can actually handle the OpenGL portion of the code. Is this even possible in OpenGL? I tried doing something like this, but I get a SegFault when I try to call localWindow->setActive(); :

Renderer.h
class Renderer
{
private:
    Window* localWindow;

public:  
    Renderer(sf::Window* inWindow)
    {
        localWindow = &inWindow;
    }

    void draw()
    {
        localWindow->setActive();

        //OPENGL STUFF HERE!
    }  
}

Main.cpp
#include "Renderer.h"

sf::Window* window;
Renderer renderer(window);

void main()
{    
    //Create new Settings and Window to point "window" to.
    sf::ContextSettings settings;
    settings.antialiasingLevel = 4;
    settings.majorVersion = 3;
    settings.minorVersion = 3;
   
    sf::Window localWindow(sf::VideoMode(800,600), "OpenGL", sf::Style::Default, settings);
   
    window = &localWindow;
   
    graphics();
}

void graphics()
{
    while(window->isOpen())
    {
        sf::Event event;
        while (window->pollEvent(event))
        {
            // Request for closing the window
            if (event.type == sf::Event::Closed)
                window->close();
        }
        window->setActive();
         
        renderer.draw();
           
        window->display();
    }
}

4
General / Correct way to handle physics time-stepping
« on: October 05, 2012, 10:54:41 pm »
Hey guys,
So I have written a simple physics engine which works great for me, but I want to make sure it works well on other PCs. I have found a lot of vague and complicated tutorials online that describe multiple methods of handling your timesteps. Could someone please give me a rundown, or point me in the direction of information that is complete?

Thanks.

5
So, I have a previous post that is not clear enough at all. I am trying to move away from fixed function completely. I have done this previously in SFML 1.5, but things have changed a lot in SFML 2. I want to do 100% Raw OpenGL without the help of SFML, and at the very end, render it to my Window. Is this possible? Essentially, I do not want to do GLBegin() and GLEnd(). I want to pass my VAOs to compiled shaders and render that way.

Thanks,
Kurasu1415

6
Graphics / Raw OpenGL with SFML 2
« on: August 08, 2012, 07:02:31 pm »
In previous versions I know SFML had a way to create an OpenGL context of a certain version, and then just draw to a window using Raw OpenGL instead of using any SFML specific calls. Do I have to do anything special to render OpenGL to an SFML2 Window? I want to use standard OpenGL, not the SFML functions. I want to handle my own shaders etc.

Thanks!

7
SFML projects / 2D Platformer + Game Engine using OpenGL+SFML
« on: July 27, 2012, 10:43:01 pm »
Hey Guys,
So we have been working on a 2D platformer for quite a while now. I have been developing the toolkit to work with which I call the "Stack Toolkit". I'll get more to that later. We aren't quite ready to release any screens/demos to the public yet, but I can tell you that we are throwing up a kickstarter with a 10 Minute playable demo in 3 months. I plan to release some nice tech demos here in this thread soon to generate some interest, get feedback, maybe inspire you guys and share what I have learned.

The Game

The game is called Fobia. It is a game about a man with a horrible life, who is forced to battle his past. I can't say a whole lot about the designs, other than that we are using everything we can in a game to invoke strong emotion of impending doom, and immense sadness in the player. We want you to feel the way our hero does, and that is tired and ready to give up. Throughout the game you do grow, and become much more powerful as a result. This growth is shown through abilites, tone of dialogue, music, and color. Everything will be revealed in our Kickstarter.

The Tech

So not only am I designing the game, and managing my team, but I am also the lead developer. I decided that I wanted to focus on having linux support as well as OSX, Windows, and later Xbox. I decided wanted to go with a fully-abstracted component-based system. The system also supports Lua and Python scripting, and would be easy to integrate your favorite language into.

For those who don't know what component-based means, it's pretty simple. There is no "Object" class. There is no "Player" class.

EXAMPLE TIME! : Let's say you want to make a basketball. A basketball would be represented by 3 components : Physics, Sprite, Audio. Each component handles their own duty. So Graphics would draw our sprite, Physics would make sure our object collides and bounces properly, and Audio will make sure that it plays the correct sounds. If you wanted to add input, just tack on an Input component, and define how it reacts to input.

The event system is really the core of the toolkit. The system routes events from one component to another similar to how the old telephone operators would work. Events only get sent to components that care about that Event type.

EXAMPLE TIME! : Consider our Basketball example again. When our ball hits the ground, we want to hear a noise on collision right? Well, when it collides with something, we tell it to send a "Collided" Event. That event gets routed to any other component that cares about that. so our Graphics component will take that event, and know that it shouldn't draw the ball over or inside the thing it collided with. Also, the Audio Component will know when to play our "bouncing" noise.

This setup allows for rapid growth, as changes require little to no changes in other components.

The scripts are actually handled by a component as well. Essentially, I have little API's that wrap core event functions, and use a lot of operator overloading to allow Lua and Python scripts to send events so that a script in one component can affect other components the correct way.

I also want to bring up the topic of the Editor UI. I am using a cool little opensource API called Berkilium (http://berkelium.org/). This allows me to tie in my C++ code to a UI written 100% in HTML/CSS/Javascript. It runs very quickly, and allows for resizable, pretty,  and quick-to-write GUIs. It is actually rendering a browser as a texture over the game, but you don't even notice anything except that its very nice. The only negative here is that it uses the Chromium core, which makes it 32-Bit only. This runs in a seperate OS process so that the rest of your game can still be 64-bit.

Conclusion

I am just so excited about this project that I wanted to share a little bit with the people that have helped me in the past with little SFML glitches, as SFML is used in many of my components for the non-console versions of my game. I also want to point out that after I get the code better documented, and stable, this code will be released open-source and I encourage indies to use the system.

Please let me know if you have any questions or comments. Feel free to PM me as well!

Thanks Guys!

8
So I am working on a little 2D platformer, and I am looking into how everyone handles multiple resolutions and aspect ratios. For aspect ratios, does everyone just show black bars, or show more of the screen to different ratios? For resolutions, do you just let OpenGL scale your sprite textures, or do you make versions for EVERY resolution?

Thanks!

9
Window / Hardware acceleration for SFML drawing?
« on: July 22, 2012, 04:10:48 am »
Hey guys,
Does anyone know if there is a setting somewhere that enables hardware acceleration and double buffering for SFML2 drawing? I just want to be able to make an sf::polygon and have that accelerated instead of having to do all of my 2D drawing in OpenGL.

Thanks!

Pages: [1]
anything