• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

xterminenatorx

Hi I need help with some questions

2 posts in this topic

I have been wondering about this for a long time now. I understand some things about programming but its not clear how do you set it up.. I mean I know you first set up includes,defines, windproc next I think and then from here on i get stuck. how shjould a game flow and where should all the draw bitmap commands and AI commands be under. PLEASE HELP. If theres turtorials around Please letr me know THANKS
0

Share this post


Link to post
Share on other sites
Hi, xterminenatorx.

I think I can help. You could probably set up a game any way you want and still get it to work, but you're probably better off doing this:

Okay, basically you have your WinMain, as you mentioned before. As you probably know, normal Windows programs have message loops within WinMain. A game however, should have a slightly different message loop than other applications. It should look something like this:

while(1)
{
if(PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE))
{
if(msg.message == WM_QUIT) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//Game Loop
GameMain();
}

The above code assumes your MSG struct within WinMain is named msg. This code should be at the bottom of WinMain. Basically, games should set up a frame, and then render it on the screen. Then they should set up the next frame, render it again, and keep drawing frames until the game exits. That's why the above message loop is used. The call to GameMain (you don't have to name it GameMain, it can be anything) is made constantly, and within GameMain you should set up and render each frame.

Also, an easy way to do things is to have a finite state machine, which basically means your game can be in different 'states'. For instance, your game can be in STATE_LOADING when it's being loaded, or STATE_RUNNING when the game is running, STATE_PAUSED, etc. Whatever you want. I'll explain how to do this in just a minute. Getting back to GameMain, your GameMain function should look something like this:

        
void GameMain(void)
{
GetInput(); //Get input first

DoAI(); //This is where you'd generally do your AI and

DoPhysics();//physics, etc.



DrawFrame();//This function should contain the code that

//actually draws the frame to the screen.

//To answer one of your questions, yes this

//is where all the bitmap drawing goes



DisplayFrame(); //Here's where you page-flip if you're

//using DirectX, or where you blit your

//buffer to the display or whatever.

}


Now, as I mentioned, if your project is going to be of any size, it should have seperate states and stuff. Basically, you just keep a variable to keep track of the game's state. You should #define all of your game states to use for the value of this variable. For instance, if you have a menu in your game, when the game starts you could set the game state to a STATE_MENU or whatever. Then, in GameMain, it would check the state, and if the game was in a menu it would render the menu. That's basically how it works. For some instances, it may be useful to save the previous game state as well as the current.

I really hoped I could help. Note that the code for GameMain above is very simplified. There is a lot more you should do in it (such as calculate the framerate). You should also maybe time your input so the game only checks the input every so many milliseconds.

And as for WndProc, you really don't need to process any windows messages other than a couple (in some cases), like when you want to know when the app loses focus. So you should mainly just let DefWindowProc process everything.

Finally, I would recommend that you keep your code in several source files so that everything's seperated and easy to find. Also, keep every part of your game independant of the rest of the game so you can make changes easier.

Edited by - Midnight Coder on August 19, 2001 2:37:52 AM
0

Share this post


Link to post
Share on other sites