in
Welcome to Lionhead Community Sign in to Windows Live ID | Help

Restart

Last post 08-29-2008, 12:51 by Tylium. 8 replies.
Sort Posts: Previous Next
  •  07-07-2007, 12:08 2699971

    Restart

    Ok, i've decided that i should rewrite all my code. This is my progress so far: http://warlock.campus.luth.se/forum/viewtopic.php?id=7 The only thing that i'm a bit stranded on right now is how i should get the main message loop over to another object. It's kinda stuck inside of cBase. Comments and critique is accepted. /* Mike */
    Blog: http://pineinteracive.blogspot.com/
  •  07-07-2007, 18:11 2700338 in reply to 2699971

    Re: Restart

    I have been thinking... how about threading, is it possible to skip cBase message-loop problem with threading?
    Blog: http://pineinteracive.blogspot.com/
  •  07-08-2007, 8:00 2700980 in reply to 2699971

    Re: Restart

    No ideas? /* Mike */
    Blog: http://pineinteracive.blogspot.com/
  •  08-21-2007, 15:19 2763400 in reply to 2700338

    Re: Restart

    ZuraK:
    I have been thinking... how about threading, is it possible to skip cBase message-loop problem with threading?


    How would that solve anything? You still need a message loop to process all of your window messages, that's just how Windows works...

    I think you should try to work with what you have at the moment. You'll notice after a while what's wrong with your design.

    http://myspace.com/pushingcows.se
  •  09-05-2007, 14:19 2772410 in reply to 2763400

    Re: Restart

    I've managed to solve the problem, tho i haven't implemented it yet. Hopefully i will have some time to implement and test it out soon. Too much studies =(.

    /* Mike */

    Blog: http://pineinteracive.blogspot.com/
  •  09-07-2007, 7:34 2773385 in reply to 2772410

    Re: Restart

    ZuraK:
    I've managed to solve the problem, tho i haven't implemented it yet. Hopefully i will have some time to implement and test it out soon. Too much studies =(.

    /* Mike */

    You are not the only one arround here who can't find time to do what they want due to studies :(. Anyhow it's G o o d [Good] that you've solved the problem yourself, grats :D.

  •  09-13-2007, 22:59 2776450 in reply to 2773385

    Re: Restart

    GAH! Does this even seem possible? It seems like i never going
    to be content with my creation =(.

    /*****************************************************************************
    class Basics
    {
    public:
    Base( window_creation_information )
    // window proc & process
    // window process calls engine->update, wich calls
    // updatePhysics(); and updateRender();
    inline getHwnd() { return window_hWnd };
    private:
    // main window init protected:
    window_info;
    };

    class
    Engine
    {
    public:
    // Engine calls DXStuff on construction
    // then goes forth and creates Renderer() so
    // that we have a manager for rendering objects.
    // TODO: Create manager for physics
    updatePhysics();
    updateRender();
    // loops and managers for physics/render/etc
    };

    class DirectXStuff
    {
    public:
    DirectXStuff
    (windowhandle+other_useful_info)
    inline getDevice() {return DxDevice};
    private:
    initializeDirectX();
    protected:
    DirectX_device;
    }

    class Renderer
    {
    public:
    Renderer(Directx_device device);
    render();
    protected:
    Directx_device m_device;
    };

    engine::engine()
    {
    Basics
    * newBase;
    newBase = new Basics(winfo);

    DirectXStuff newDevice;
    newDevice = new DirectXStuff( newBase->getHwnd() );

    Renderer newRender;
    newRender = new Renderer( newDevice->getDevice() );

    newBase->processWindowMessage( &this );
    }
    /*****************************************************************************

    (Z)

    Blog: http://pineinteracive.blogspot.com/
  •  08-28-2008, 0:26 3038644 in reply to 2776450

    Re: Restart

    Ok, since i've been studying alot of object-oriented programming during my first year at the game development programme at LTU, i've come to know that alot is in the design of a game. I'm really drunk so i think i'm really straight-forward when im writhing this:

    The most important thing reagarding designing a starting of a game is, that you really know the inner workings of object-oriented programming. I can't be more precise, but it's really important. Object-oriented design gives alot of possibility when it comes to design of game-code so those who feels hit by this post, please, learn more about coding in object-oriented design in C++. High-tech envolves assembler and C, which can be G o o d [Good] to know, tho myself i don't know those things.

    Even tho i'm really drunk and not really a game developer, i think i can say that C, C++ and ASM is really important to know as a game developer. It can greatly help you get into the bussiness of game development of your choice

    I'm sorry if i am offending someone while being drunk on a forum. But this is helping me getting the real information out to people who want to become developers.

    What you need to think about it really the thing about game development is gameplay, gameplay, gameplay. Whitout gameplay, you are not going awnywere. Even if your game looks like ***, and your gameplay is fun, you'r going to have a succsessful game. And thats the part thats most important.

    If the group is a large one, please notice that your need to have a well-connected group and everyone needs to have a G o o d [Good] chemistry. Otherwise, your'e going to be in for a hard-time. Without a G o o d [Good] group-chemistry, there's going to be alot of trouble and the game development proceess is going to become a really painstakeingly hard processs. Our group during our processs when we where working on our simple game where not optimal, so our project took alot of damage becouse our group where not optimal. I'ts really an important aspect that the team-memberrs know eachother welll.

    Our group was 3 persons, and we had 2 programmers and 1 designer, and it was not working as G o o d [Good] as we hoped it would. However, our designer took the mission as group-manager and he did a really G o o d [Good] work whiping the programmers into-work, but did not manage to get the design through. I'm kinda sad becouse of that, he said he neeeded to be harder on 'us' the programmers but did'nt have the heart, becouse we where writing the engine from scratch, where the other groups where using an existing engine to complete the course. So our project where pushed 3 months from deadline. Our original deadline was 2 month of time, which means we where 5 months over due. And our check for appprovement for our prototype is in 1 day.

    I'm sory my english is not as G o o d [Good] as it would be.

    I know this is just some drunken talk but, i can't just lest this go without letthing other developers know how important team-chemistry is.

    I hope this can help somewhat, when it comes to develop new technology and techniques.

    I am sorry if i have offended someone with my random talk, best wishes:
    /* Mike

    Blog: http://pineinteracive.blogspot.com/
  •  08-29-2008, 12:51 3041444 in reply to 2776450

    Re: Restart

    ZuraK:

    ...

    class Basics
    {
    public:
    Base( window_creation_information )
    // window proc & process
    // window process calls engine->update, wich calls
    // updatePhysics(); and updateRender();
    inline getHwnd() { return window_hWnd };
    private:
    // main window init protected:
    window_info;
    };

    ...

    engine::engine()
    {
    Basics
    * newBase;
    newBase = new Basics(winfo);

    DirectXStuff newDevice;
    newDevice = new DirectXStuff( newBase->getHwnd() );

    Renderer newRender;
    newRender = new Renderer( newDevice->getDevice() );

    newBase->processWindowMessage( &this );
    }

    ...



    I might have the wrong idea about what the problem is here, but it seems you're worrying over where to place the windows message loop with regards to the rest of your object orientated engine code.

    Trying to integrate win32 code into an oop framework is a bit of a "square peg round hole" situation in itself but more importantly it's not really a G o o d [Good] idea to have your engine dependant on the windows messages themselves. The message loop and window procedure should exist within an incredibly thin layer between your OS and your game / engine code. In other words, your engine should only be concerned about it's own tasks and messages, not those currently residing on the OS's message queue (imagine the difficulty you would have porting your engine to other platforms, and this should show you why OS messages and your engine shouldn't play together).

    Your engine's constructor seems to be responsible for kick starting the message loop which is a little weird, here's the order I would do things:

    1. App) Initialize Window
    2. App) Initialize Engine
         2.1. Engine) Initiailize Renderer
    4. App) Message Loop
         4.1. App) Get Messages
         4.2. App) Handle Messages
         4.3. Engine) Update
         4.5. Engine) Render

    Also...I would consider making your engine class a singleton so that any OS messages that the engine might need to be made aware of can be handled like so:

    LRESULT CALLBACK WindowProc(HWND hWindow, UINT uiMessage, WPARAM wParam, LPARAM lParam)
    {
        // Get pointer to engine instance
        Engine* pEngine = Engine::GetInstance();

        switch(uiMessage)
        {
            ...

        case WM_MOUSEMOVE:
            pEngine->OnMouseMove(x, y);
            break;

            ...

        default:
            return DefWindowProc(hWindow, uiMessage, wParam, lParam);
        };

        return 0;
    }


    The implementation specifics could be debated forever, but I personally prefer not to worry too much about it.

    Hope that helps... Crazy [:crazy:]

View as RSS news feed in XML