• 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.

Spencer Allen McMillan

  • Content count

  • Joined

  • Last visited

Community Reputation

111 Neutral

About Spencer Allen McMillan

  • Rank
  1. So, I'm doing this assignment and I cannot figure out what I'm doing wrong. I'm supposed to find the difference between the player's number and computer's number and then use modulus division. I then use the resulting number to decide on whether the computer or the player wins the hand. For some reason though python seems to be skipping my else statement or something. Any help would be appreciated. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] [CODE] def number_to_name(number): if number == 0: name = "rock" return name elif number == 1: name = "Spock" return name elif number == 2: name = "paper" return name elif number == 3: name = "lizard" return name elif number == 4: name = "scissors" return name def name_to_number(name): if name == "rock": number = 0 return number elif name == "Spock": number = 1 return number elif name == "paper": number = 2 return number elif name == "lizard": number = 3 return number elif name == "scissors": number = 4 return number def rpsls(guess): import random player_number = name_to_number(guess) comp_number = random.randrange(0, 5) winner = (comp_number - player_number) % 5 print "" print "Player chooses " + number_to_name(player_number) print "Computer chooses " + number_to_name(comp_number) if (comp_number - player_number) % 5 == 1 or 2: print "Computer wins!" elif (comp_number - player_number) % 5 == 0: print "Player and computer tie!" else: print "Player wins!" rpsls("rock") rpsls("Spock") rpsls("paper") rpsls("lizard") rpsls("scissors") [/CODE]
  2. Thanks Brother Bob! I shall read/practice with pointers some more.
  3. I'm stumped. It compiles fine, but when it gets to the for function in main that prints off the array it says I don't have access to it. Here's the revised code. [CODE] #include<iostream> #include<cstdlib> #include<ctime> using namespace std; void randomArrayFill( int *a, int size ) { a = new int[size]; for( int i = 0; i < size; i++ ) { a[i] = rand() % 100; } } int main() { //----Init-------------------------------------------------------------- int size = 0; int *a = 0; srand(0); //----End Init---------------------------------------------------------- cout << "Enter the size of an array to create: "; cin >> size; randomArrayFill( a, size ); for( int i = 0; i < size; i++ ) { cout << a[i] << " "; } cin.get(); cin.get(); return 0; } [/CODE]
  4. Thanks! I've got another issue, but I'm going to see if I can work it out before askin' another question. Thanks again! 0/
  5. Hello, I'm learning memory allocation online right now and I'm having some issues. I'm trying to create the size of an array in run-time and I seem to be having some issues. When I code it all inline it works fine, but when I put it in a function I seem to be doing something wrong. I keep getting this error on Visual Studio: [b]error C2082: redefinition of formal parameter 'a'[/b] Here's the code. [CODE] #include<iostream> #include<cstdlib> #include<ctime> using namespace std; void randomArrayFill( int *a, int size ) { int *a = new int[size]; for( int i = 0; i < size; i++ ) { a[i] = rand() % 100; } } int main() { //----Init-------------------------------------------------------------- int size = 0; int *a = 0; srand(0); //----End Init---------------------------------------------------------- cout << "Enter the size of an array to create: "; cin >> size; randomArrayFill( a, size ); for( int i = 0; i < size; i++ ) { cout << a[i]; } cin.get(); cin.get(); return 0; } [/CODE]
  6. Thanks Rad. I knew I should just sleep and take a look at it again, lol. And noted on the srand. I'll be sure to change that.
  7. Code snippet wasn't cooperating. >.<
  8. Hello, I'm workin' on a slot machine program and for some reason I'm having some issues with the menu. Selecting one breaks out of the menu loop and will allow you to play the slot machine game. Selecting two quits the game. And anything else it prints onto the console "Please enter a valid option." For some reason, when an invalid number is entered it prints but it doesn't loop back. So yeah, slightly confused. *I apologize, but the code snippet tool was not cooperating with me, only showing a portion of whatever code I put in* Here's the code: #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int Random( int, int ); int main() { //---- Initialization------------------------------------------------- int low; int high; int chips = 1000; int hold = 0; bool quit = false; //----End Init-------------------------------------------------------- // Start Game--------------------------------------------------------- while( !quit ){ //----Menu-------------------------------------------------------- while( hold <= 0 ) { cout << "Player's chips: $" << chips << endl; cout << "1) Play slot. 2) Exit." << endl; cin >> hold; if ( hold == 1 ) break; if ( hold == 2 ) quit = true; else cout << "Please select a valid option" << endl; } //----End Menu---------------------------------------------------- } cin.get(); cin.get(); return 0; //---End Game--------------------------------------------------------- } int Random( int low, int high ) { srand(time(0)); int a = (rand() + low) % high; return a; }
  9. Thanks a lot! That was actually a REALLY simple fix, lol.
  10. Hello, I'm in the process of learning DirectX 11 with the book "Beginning DirectX 11 Game Programming". I'm using Microsoft Visual Studio '10 and I'm trying to get a blank window running. Here's the code I'm running: [CODE] #include <Windows.h> LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) { PAINTSTRUCT paintStruct; HDC hDC; switch( message ) { case WM_PAINT: hDC = BeginPaint( hwnd, &paintStruct ); EndPaint( hwnd, &paintStruct ); break; case WM_DESTROY: PostQuitMessage( 0 ); break; default: return DefWindowProc( hwnd, message, wParam, lParam ); } return 0; } int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE prevInstance, LPWSTR cmdLine, int cmdShow ) { UNREFERENCED_PARAMETER( prevInstance ); UNREFERENCED_PARAMETER( cmdLine ); WNDCLASSEX wndClass = {0}; wndClass.cbSize = sizeof( WNDCLASSEX ) ; wndClass.style = CS_HREDRAW | CS_VREDRAW; wndClass.lpfnWndProc = WndProc; wndClass.hInstance = hInstance; wndClass.hCursor = LoadCursor( NULL, IDC_ARROW ); wndClass.hbrBackground = (HBRUSH ) (COLOR_WINDOW + 1 ); wndClass.lpszMenuName = NULL; wndClass.lpszClassName = "DX11BookWindowClass"; if( !RegisterClassEx (&wndClass ) ) return -1; RECT rc = { 0, 0, 640, 480 }; AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE ); HWND hwnd = CreateWindowA( "DX11BookWindowClass", "Blank Win32 Window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom-rc.top, NULL, NULL, hInstance, NULL ); if(!hwnd) return-1; ShowWindow( hwnd, cmdShow ); // demo init MSG msg = { 0 }; while( msg.message != WM_QUIT ) { if ( PeekMessage(&msg, 00, 0, 0, PM_REMOVE) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else{ // Update // Draw } } // Demo Shutdown return static_cast<int>( msg.wParam ); } [/CODE] The error I'm receiving is: error C2440: '=' : cannot convert from 'const char [20]' to 'LPCWSTR' . For the line: wndClass.lpszClassName = "DX11BookWindowClass"; Any ideas as to how I can fix this?