• 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.
Sign in to follow this  
Followers 0
turbello

Writing a game

6 posts in this topic

Hi there,

So I've started to write a Game Engine to write my game with.
I'll post some code sometimes with some explanation to keep you all updated.

[spoiler][code]
/////////////////////////////////////////////////////////////////////////////////
// Entry point of the application
/////////////////////////////////////////////////////////////////////////////////
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
// Avoid warnings of not-used parameters
////////////////////////////////////////////////////////////////////////////
UNREFERENCED_PARAMETER( hPrevInstance );
UNREFERENCED_PARAMETER( lpCmdLine );

// Allocate the object of the GameEngine
////////////////////////////////////////////////////////////////////////////
GameEngine engine(hInstance, nCmdShow );

// Attemp to initialize the GameEngine
////////////////////////////////////////////////////////////////////////////
if( engine.Initialize( _T("GameEngine"), 640, 480, false, 60 ) == false )
{
return -1;
}

engine.GoFullscreenMode(); // Go to fullscreen mode
// Enter the GameLoop
////////////////////////////////////////////////////////////////////////////
while( engine.ProcessMessages() )
{
engine.BeginRender();

// Update & Draw stuff
////////////////////////////////////////////////////////////////////////
engine.SetColor( RGB(100,0,0));
engine.DrawRect(10,10,100,100, 3);
engine.DrawLine(0,0,640,480, 2);

engine.SetColor( RGB(0,0,50));
engine.DrawEllipse(130,100,250,200,50);

engine.SetColor( RGB(0,200,0));
engine.SetFont("verdana", true, false, true, 20);
engine.DrawText("Test",100,400);

if( engine.IsLeftButtonDoubleClicked() ) // if you double-click the left mouse button go back to windowed mode
engine.GoWindowedMode();

engine.EndRender();
}

// Close the application
////////////////////////////////////////////////////////////////////////////
return 0;
}
[/code][/spoiler]

The following code is from the WndProc, how I handle on some interesting events:
[spoiler][code]

case WM_MOUSEMOVE:
RECT windowRect;
GetWindowRect( hWnd, &windowRect );
POINT pt;
GetCursorPos( &pt );

pt.x -= windowRect.left;
pt.y -= windowRect.top;

pEngine->SetMousePos(pt);
return 0;

case WM_MOUSEWHEEL:
pEngine->SetWheelPos( GET_WHEEL_DELTA_WPARAM(wParam));
return 0;

case WM_LBUTTONDBLCLK:
pEngine->IsLeftButtonDoubleClicked(true);

[/code][/spoiler]

I can handle double mouse-clicks too. For this you need to add a style into the WndClass.
[code]
WNDCLASS wndClass;
WndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
[/code]

I'm controlling whole my game with 1 object. The GameEngine object
But Instead of writing hundreds lines of code into 1 class I wrote some extra classes:
[code]class GameEngine: public ResourceLoader, public InputState, public Painter[/code]

I don't like to overload the processor and I would like to work with a framerate so in the ProcessMessages method I'll let the application sleep for (1000 / framerate) if there are no messages.


So if there are any questions about my code, how I go to fullscreen and back to windowed mode, just ask.
And if there are some suggestions about some code, just tell. :wink:



pm: this topic should not be closed till my game is finished, what will take some months. I would love to keep posting all my progress here if that's ok.
1

Share this post


Link to post
Share on other sites
Maybe you should consider a blog, a forum is not meant for this kind of stuff and a blog can never hurt
I'm not a mod of course, so I'm not sure whether they'll allow this
0

Share this post


Link to post
Share on other sites
You could make a developer journal here, or you could use some free blog hosting website to set one up
0

Share this post


Link to post
Share on other sites
Yes, any site member can start a developer journal and it really is the best place to collect things like this.

Post something good and you might even get features on the front page :D
0

Share this post


Link to post
Share on other sites
Go to http://www.wordpress.com for free and reliable blog hosting. I have since moved my site on to a separate domain (http://noogai03.co.uk/wordpress), but it was great when I used it.
It will be www.[NAME HERE].wordpress.com, with no ads.
You can also try www.blogger.com, which is good, but not as good.
Hope this helps
Noogai03
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0