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

[C++] suddenly shutdown on some computers

4 posts in this topic

Hey everyone.
[left]At first: Please excuse my poor English skills :-(.[/left]
[left]But let me tell you about my problem:[/left]
[left]I wanted to lean how to use SDL. So, at first I read some articles and tutorials. Then I started to code a "game", less a game, more object of my personal study.[/left]
[left]I want to create a framework, which grows with my knowledge, where I can implement my ideas and learn out of it.[/left]
[left]I have chosen C++ because I already have some Skills in it and want to improve them.[/left]
[left]This is my working state:[/left]
[left]- I am using Windows 7 64bit Professional[/left]
[left]- game-state-machine with actual 2 states (menu & "game"-mode)[/left]
[left]- button, timer, tileMap, animation, player, bitmapFont & log classes[/left]
[left]- menu state shows a background, with a barely animated cloud and a button, which switches to gameState[/left]
[left]- game-mode has a tileMap based background with a level read in by a file, A test of the bitmapFont, and a moveable "hero" with a camara following him (2D if there are any uncertainties) and an exit button.[/left]
[left]All this works fine on the computer I coded it on.[/left]
[left]Now the actual problem:[/left]
[left]I placed the compiled .exe and all necessary .dll's and images in my DropBox because I wanted to test it on my notebook and I direct linked the folder with a fellow student.[/left]
[left]On the source computer it isn't possible to start the game, direct ".exe doesn't work anymore..." (- hope I translated this one right -).[/left]
[left]On my Notebook (also Windows 7 64bit Professional / no seperate SDL installation) the game starts correct and enters the main Menu, but if click on the new Game button the game closes without any error message.[/left]
[left]So I set up my log and logged every step happening (See code & log below).[/left]
[left]This way I pointed out that the program exits without a reason (visible for me) after the end of the constructor of the exit button in game state.[/left]
[left](This is the most important problem)[/left]
[left]On the computer of my friend (he actually tested with ArchLinux) it works fine in some cases or it isn't startable. (Also interesting, but it's more important for me to get a working version on my notebook, but I am interested in articles/tutorials about using SDL cross platform, because reading windows and linux tutorials and then point out the differences isn't fun, I think.)[/left]
[left][i]Edit: Talked to my friend again, he used windows, too, but I am still interested in cross platform sources.[/i][/left]

[left]I am thankful for every help and advice you can provide me. :-)[/left]

[left]If new Game button is clicked nxtState is set to STATE_HOME_FARM, changeState is called every gameloop before rendering.[/left]
[left][CODE]
void changeState()
{
if (nxtState != STATE_NO_CHANGE)
{
log->log("start change");
if (nxtState != STATE_EXIT)
{
log->log("delete act");
delete workingState;
log->log("done");
}
switch (nxtState)
{
case STATE_HOME_FARM:
log->log("detected home farm");
workingState = new HomeFarm();
log->log("createt state");
break;
}
log->log("set vars");
actState = nxtState;
nxtState = STATE_NO_CHANGE;
log->log("done");
}
}
[/CODE][/left]

[left]This is the constructor of my HomeFarm class.[/left]
[left][CODE]
actWid = LEVEL_WIDTH;
actHig = LEVEL_HEIGHT;
log->log("create hero");
hero = new Farmer;
log->log("create exit button");
exitButton = new ExitButton(SCREEN_WIDTH/2, SCREEN_HEIGHT-200 , 200, 100, "Buttons/test_button_exit.png");
log->log("create font");
[/CODE][/left]

[left]This is the constructor of my ExitButton class[/left]
[left][CODE]
log->log("set vars");
CLIP_MOUSEOVER = 0;
CLIP_MOUSEOUT = 1;
CLIP_MOUSEDOWN = 2;
CLIP_MOUSEUP = 3;
button.x = x;
button.y = y;
button.w = width;
button.h = height;
log->log("load img");
img = loadImg(filename);
log->log("set clip");
setClips();
log->log("set initial clip");
state = &clip[CLIP_MOUSEOUT];
log->log("done");
[/CODE][/left]

[left]And finally this is my log.txt created if I run the game on my notebook and try to start a Game.[/left]
[CODE]
start change
delete act
done
detected home farm
create hero
create exit button
set vars
load img
set clip
set initial clip
done
[/CODE]

[left]Nazzrim[/left] Edited by Nazzrim
0

Share this post


Link to post
Share on other sites
What's workingState initialized to? Make sure it's either NULL or a valid state if you're going to be deleting it on the first state change. Edited by Slavik81
0

Share this post


Link to post
Share on other sites
Right after start up before the gameloop starts working state is initialized to MainMenu state.
[CODE]
int main (int argc, char* args[])
{
if (init() == false)
{
log->log ("Error on initialisation...");
return 1;
}
actState = STATE_MAIN_MENU;
workingState = new MainMenu();
while (actState != STATE_EXIT)
{
[/CODE]
0

Share this post


Link to post
Share on other sites
[quote]
[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][background=rgb(250, 251, 252)]So I set up my log and logged every step happening (See code & log below).[/background][/left][/size][/font][/color]
[/quote]
How does your log work? Does it flush each time it is called?

[quote]
I placed the compiled .exe and all necessary .dll's
[/quote]
How are you building the executable? In release mode? Which DLLs are you including? The "application is not working" message usually means some required DLL is not working.
0

Share this post


Link to post
Share on other sites
Yes it flushes every time:
[CODE]
void Log::log (std:: string message)
{
logger << message << std::endl;
logger.flush();
}
[/CODE]

I am not completely sure what the difference between release/debug mode (- maybe someone got sources :S? -).
So I use Notepad++ for coding, and mingw32 via cmd for compiling.
I have a bunch of header files for my classes and .ccp files for the actual classes.
I am compiling it using the command "g++ 'all.ccps' -lSDL -lSDLmain -lSDL_image.
This are my includes DLLs:
libgcc_s_dw2-1.dll
libstdc++-6.dll

libpng15-15.dll
SDL.dll
SDL_image.dll
zlib.dll

The first two are there, because my notebook complains if they are not *shame*
The rest are SDL and related DLLs.

I must concede that my DLL skills tend towards zero, but I really like to improve them. ;-)
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