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

Pages: [1]
1
SFML projects / Re:creation - a top down action adventure about undeads
« on: October 16, 2016, 08:29:09 pm »
SushiKru, thank you!

Here's one important thing: using ECS doesn't mean you have to build everything with ECS in mind. In my game, states are implemented as a bunch of classes which have enter, exit, update, draw, handleEvent virtual functions. I also have a stack of game states, so I can have PlayingState and then push GUIPausedState on top of it.

The StateManager calls update from top to bottom (GUIPausedState, PlayingState) and if one of the current states returns false, it stops. GUIPausedState can return false and then PlayingState update won't be called and this is what achieves pause.

On the other hand, draw is called from bottom to the to (PlayingState and then GUIPausedState). In GUIPausedState you can draw your overlay menu, for example.

All systems are created at the start of the game, but their update functions are called from PlayingState::update only (well, I also have RenderingSystem::draw and PlayingState::draw calls that, but for others update call is enough).

Transitions between states can be accomplished by making some states like FadeOutFromBlackState or something like that. And then you'll just have LoadingState pushing PlayingState and FadeOutFromBlackState to state stack after it's done loading stuff (and popping itself from it). And once FadeOutFromBlackState finishes, it can pop itself from stack (possibly sending an event which PlayingState and other things can catch, so it'll start processing player input and updating stuff...)

Yeah this is what i read on few topics in stackoverflow or gamedev. I think the RenderSystem is a special case, i can't imagine how it could work if the render is done in update(), the idea of having a draw() function that is called at a specific time is probably a better solution. You can even call it on a different thread so you will use 2 cpus core (well it's overkill for a 2D game probably  :D)
Thank you for the answer, so a state machine above everything, and depending on the state i could create different ECS. It's really hard to understand fully ECS, when you start using it, you want to do everything with it but it's probably not a good idea.

2
General / Re: I Can't make SFML works with clion and mingw
« on: October 14, 2016, 05:38:19 am »
Ok nevermind, i am really stupid, the problem was missing dlls (sfml dlls) but i was trying the wrong executable ... for some reasons i had 2 folders, Debug and Debug0 (probably because i changed the target name in CMakeLists).

3
General / Re: I Can't make SFML works with clion and mingw
« on: October 14, 2016, 05:32:18 am »
I think it's a dll problem, i found few topics talking about this, like this one:
http://stackoverflow.com/questions/31066330/mingw-sfml-giving-error-code

but i still can't get it works, i copied all SFML/bin dlls in my folder containing the executable. I also added mingw bin folder to PATH variable but i still get the same problem, i don't really know what to do

4
General / I Can't make SFML works with clion and mingw
« on: October 14, 2016, 05:02:53 am »
Hello

So this is what i did:
from the SFML website download page, I:
- Downloaded the SFML library: SFML 2.4.0 built with GCC 6.1.0 MinGW (SEH) - 64-bit
- Downloaded MinGW Builds 6.1.0 (64-bit)  (and use it as the toolchain in CLion)

I put them both in a folder, this folder also contains a folder name Project which contains my sources and CLion settings
This is my main.cpp:
#include <iostream>
#include <SFML/Graphics.hpp>
using namespace std;

int main(int argc, char* argv[]) {
    cout << "test" << endl;

    sf::Window window(sf::VideoMode(800, 600), "myproject");

    while (window.isOpen()) {
        sf::Event Event;
        while (window.pollEvent(Event)) {
            if (Event.type == sf::Event::Closed)
                window.close();
        }
        window.display();
    }
}

This is my CMakeLists.txt:
cmake_minimum_required(VERSION 3.6)

set(PROJECT_NAME myproject)
project(${PROJECT_NAME})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)

#sfml
set(SFML_DIR "${PROJECT_SOURCE_DIR}/../SFML-2.4.0")
set(SFML_ROOT ${SFML_DIR})
set(CMAKE_MODULE_PATH "${SFML_DIR}/cmake/Modules" ${CMAKE_MODULE_PATH})
find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED)

include_directories(${SFML_INCLUDE_DIR})
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} ${SFML_LIBRARIES})
 

it compiles without error:
"C:\Program Files (x86)\JetBrains\CLion 2016.2.2\bin\cmake\bin\cmake.exe" --build C:\Users\SushiSalami\.CLion2016.2\system\cmake\generated\Project-edb1033a\edb1033a\Debug0 --target myproject -- -j 4
-- Found SFML 2.4.0 in D:/Development/C-C++/myproject/SFML-2.4.0/include
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/SushiSalami/.CLion2016.2/system/cmake/generated/Project-edb1033a/edb1033a/Debug0
[ 50%] Building CXX object CMakeFiles/myproject.dir/main.cpp.obj
[100%] Linking CXX executable myproject.exe
[100%] Built target myproject
 

but when i run, the application crash directly without any error except the exit code that is different from 0:
Process finished with exit code -1073741515 (0xC0000135)
"

Ofc i googled this but i can't find anything revelant  >:(

Thank you :)

5
SFML projects / Re:creation - a top down action adventure about undeads
« on: October 14, 2016, 12:16:29 am »
Hello

First congradulations for your game, it looks really awesome, i read some of your tutorials about entity/component/system and LUA and it's really helps me to understand how it works.
I have a question, i am trying (for learning purpose) to implement an ECS but i can't figure how the game state should be handled. By game state i mean the differents states of the game (title screen, options screen, loading screen, in game screen, maybe the fighting screen in a jrpg etc ...). Do you use a class above everything that will handle screen transitions or do you just use ECS to accomplish this ? Are your systems always working even if they are not needed ? for example does MovementSystem exists even if you are in the title screen ? Or do you add them depending on the screen ?
I was thinking about a GameStateSystem  but i am really not sure how it could work:

enum State { title, inGame, loading }
class GameStateSystem : System {

  void update() {
    if (m_nextState != m_currState) {
      switch (m_nextState) {
        case inGame:
           // what you do here ?
           break;
      }
    }
  }

  void setState(State state) {
    m_nextState = state;
  }
}

Pages: [1]
anything