Help WIth Getting Started On Game

Started by
5 comments, last by hatflyer 20 years, 4 months ago
I was hoping someone could help me get started on a project, maybe with a general outline/structuring of the problem? I''m a bit lost. I''ve read how to make a single, simple window, but this is beyond what I know. I want to develop a simple Windows game using VC++. It would need an opening screen with a message and a start button. Then a main game screen (a new one?) comes up with icons for playing cards. The user chooses several, inputs a dollar amount (with a mouse on a button), then the program computes results. The results are displayed in a graph. The user is also able to change the dollar amounts throughout the game, affecting a numerical display. In phase 2, the user then chooses a few more cards, and again graphical results are shown. Obviously, the user then can re-start the game. If anyone could help, or give a specific source where this type of problem is discussed, it''d be great. Thanks, Jim
Advertisement
It's hard to give advice without specific questions. The best advice I can give is to write down exactly what you want to do (you've got a pretty good list there anyway) and then ask yourself how you will go about doing each task.

i) I want to develop a simple Windows game using VC++.

ok

ii) It would need an opening screen with a message and a start button.

Presumably you want to use GDI drawing functions. First stop is the GDI documents and tutorials (e.g.). Draw out what you want on paper, then try and get that working on the computer.

iii) Then a main game screen (a new one?) comes up with icons for playing cards. The user chooses several, inputs a dollar amount (with a mouse on a button), then the program computes results.

Ok, so write down the rules for card combinations. You can then write the algorithm to compute the results.

iv) The results are displayed in a graph. The user is also able to change the dollar amounts throughout the game, affecting a numerical display.

This can again be done by understanding the drawing functions.

v) In phase 2, the user then chooses a few more cards, and again graphical results are shown.

Repeat of the above.

vi) Obviously, the user then can re-start the game.

Clear all state, go back to the beginning.

Now, if it was me I'd prefer to forget about the windows stuff and go with simple graphics/input APIs like SDL or Allegro for the drawing and input stuff. The details for almost everything you can want to do are found in documentation and tutorials. The hard part is working out what you want to do and what order that needs to be done in. Pen & paper are your friends

[edited by - JuNC on November 30, 2003 2:49:23 PM]
Ok, heres wut i see, direct x...
Get a d3d book, if yo ualready know it (which no offence i dont believe you do) you would want to create an image for ur opening screen, render it, loop untill a certain button is pressed, then go to your title screen, for which yo uwould need one background picture, which would be rendered first, and then two images for each selection (selected, unselected) then you would want to create a card class

class D_CARD /*I named it d-card cuz im dan and i like to leave a mark on my classes :-D*/
{
public:
void LoadCard(int); //enter enumerated int for the type of card
bool CheckForSelected();
void MoveTo(int, int);
void Render();
private:
int CardType;
DIRECT3DSURFACE9 CardSurface;
int UpLeftx;
int UpLefty;
int LoRightx;
int LoRighty;
}

void D_CARD::LoadCard(int CardType)
{
char string[128]={0};
switch(cardType)
{
case QUEEN_HEARTS:
strncpy(string, "c:\\CardGame\\QHearts.bmp";
break;
case KING_DIAMOND:
strncpy(string, "c:\\CardGame\\KDiamond.bmp";

//ETC
}
//LOAD IMAGE CODE
//TOO LAZY TO PUT
//IF YOU NEED TO KNOW IT....
//SAY SO
}

bool D_CARD::CheckForSelected(int x, int y)
{
if (!(x>D_CARD::UpLeftx&&x<D_CARD::LoRightx))return 0;
if (!(y>D_CARD::LoRighty&&y<D_CARD::UpLefty))return 0;
return 0;
}

THE MOVETO SHOULDNT BE HARD, and the render, im just too lazy to do that right now...
I''m still having a little trouble on a more general level.

I think I can figure out how to display a single window (probably) using VC++. I''m having trouble seeing the big picture, as to how displaying a window fits into the overall flow of a program. The tutorials and articles I''ve seen deal with a single activity, whereas I will have several different windows (or one window displayed several consecutive, different ways). Is there a source where I can see how it all comes together?

There is a basic sequential flow to the program (start screen, input cards, input dollar amounts, make calculatioons, display results, get further input, make computations, display results, re-start). Yet C++ is object oriented. How do I combine the two? Is it possible for someone to make an overall architecture/diagram of how this would all work together?

Also, is direct 3D more difficult and overkill for this simple game?

Thanks again.
ok, windows is event based as far as your concerned
this means taht your window must have a message handler, which affects the window based on certain messages, this handles generally called the WndProc has the prototype
long CALLBACK WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)

the uMessage contains the message, this could say that the mouse was moved, in which case the wparam would contain the coordinates if im not mistaken, but anyways, it could say a key has been pressed, (WM_KEYDOWN) so basically you want this proc to have a switch statement to handle every message that is important to you, from these messages you can determine what to display in your window
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
I think i can diagnose your problem efficiantly. There are various WINDOWS MESSAGES you can respond to. This includes messages for being clicked, and messages for the loading, closing, and drawing of windows (or widgets). When a window is loading, initialize your variables. Create (and show) a new window when the user clicks a button (or have an update() function work in the paint or timer thread/message) And have that (when necessary) call open a window. That window is now active, and has its own message loop to worry about, in which you do the same thing. Usualy then, i would have ways for the windows to communicate with eachother (passing public variables usualy)
hey cesar stop copying me :-D
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."

This topic is closed to new replies.

Advertisement