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

Pages: [1]
1
SFML projects / SuperSpiel3D - My first game
« on: June 25, 2014, 12:49:21 pm »
I've just finished my first year in university and decided to upload my last project. We had a task to write 2 programs: a console simulator of cockroach races and a game with bots, multiplayer and such (the teacher said that it was our task to find out how to do it and that google is our best friend, he was obviously trolling us  :D ). We also had to split up into 2 teams, and our team decided to combine those 2 projects into one multiplayer FPS game with cockroaches, the game was meant to be a parody. I grabbed SFML and Bullet physics (and sfeMovie at the end) and experimented for a few weeks, and then the work started.

The result was not as good as we wanted, but it was much better than we expected :)  This project was our guarantee to get good marks for programming.

The game itself is not really good: it has some memory leaks, random crashes (probably because I didn't use mutexes :P ) and such, but it's my first game and the first relatively big project I worked on. And this is my first step from console applications.

Here are some screenies:
(click to show/hide)

And an outdated gameplay-video
https://www.youtube.com/watch?v=6iNKETcmyig

Here's a download link if you want to check it out, but I must warn you that the game uses some resources from other games, but I don't think It's a problem for such small and already obsolete project.

2
System / Another sf::Thread topic...
« on: April 01, 2014, 11:23:34 am »
Hi everybody! I'm new to SFML and this forum.

I have a task at the university to write a game, and I've decided to stick with this library.
Everything has been good so far, but when I've decided to make a separate thread to track button presses and made a draft code, it didn't work.

Here's the thread function:

void EventThread()
{
        while (g_WindowOpened) // THIS IS BOOL!
        {      
                g_Mutex.lock();
                sf::Event event;
                while (MainWindow->pollEvent(event))
                {
                        // Close window : exit
                        switch (event.type)
                        {
                                case sf::Event::Closed:
                                        MainWindow->close();
                                        g_WindowOpened = false;
                                        break;

                                //Mouse input
                                case sf::Event::MouseButtonReleased:
                                {//Mouse works only in menus
                                        if(g_CurrentMenu)
                                        {
                                                if(event.mouseButton.button == sf::Mouse::Left)
                                                        g_CurrentMenu->LButtonActions();
                                                else
                                                if(event.mouseButton.button == sf::Mouse::Right)
                                                        g_CurrentMenu->RButtonActions();
                                        }
                                        break;
                                }
                                       
                                case sf::Event::KeyPressed:
                                {
                                        g_Keyboard[event.key.code+1] = true;
                                        break;
                                }
                                case sf::Event::KeyReleased:
                                {
                                        g_Keyboard[event.key.code+1] = false;
                                        break;
                                }

                        }
                }
                g_Mutex.unlock();
                sf::sleep(sf::milliseconds(1));
        }
}


Part of main() :

...
        sf::Thread eventThread(&EventThread);
        eventThread.launch();

        // GAME LOOP
        while (g_WindowOpened)
        {      
                g_Mutex.lock();
                DrawGLScene();
                MainWindow->display();
                if(g_bGameON)
                        dynamicsWorld->stepSimulation(1.0f/60.f,10);
                g_Mutex.unlock();
                sf::sleep(sf::milliseconds(16));
        }              
       
        eventThread.wait();
...

When I run the game, the thread doesn't seem to be running, only the GAME LOOP.
I'm afraid I've made a stupid mistake somewhere, but I can't figure out where. :(

Pages: [1]
anything