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


  • Content count

  • Joined

  • Last visited

Community Reputation

510 Good

About Cryusaki

  • Rank
  1. I would also recommend finding a tile-set not in the public domain / free to use and ask the artist to use it. My guess is most people would be glad to see their work go to use as long as you give recognition for their work.   Also I would recommend using simple place holder graphics until you get to the point you need a well animated dog, giving you time to know what you want/need.
  2. I see my issue now, I haven't coded in a long time but I can't believe I made such a basic mistake Thanks everyone but I have a new issue related to my original issue How do I make a function that can work with a variable declared in the main? #include <iostream> using namespace std; void function(); int main() { int x = 5; return 0; } void function() { cout << x << endl; } I get an error at second last line saying x is out of scope, I understand why I just don't know how to solve this
  3. My program has SFML so I am not going to post that code but here is simple version of what I mean #include <iostream> using namespace std; int main() { void function(); { cout << "Hello world!" << endl; } return 0; } The program will say Hello World but I want it to only run when i call the function later on How do I stop that?
  4. I want to make a function in main that will not run however just making the function causes it to run I tried prototyping the function but I am using object that are made and in main and that is out of scope That goes the same for above main, as the variables/objects inside were defined in main How do I stop the program from running the function without calling it when I create it?
  5. You're going to want to look here: lazyfoo.net/SDL_tutorials/ It's been a long time since I used this website or SDL so Im not sure if it's up to date or not
  6. So my main issue when programming a game of pong is the ball reflection when it collides with the player or AI paddle. When I first made a pong game I just gave the ball's yvel a random value between -1 and 1 and just flipped the sign on the xvel when it struck the paddle but that is horrendously boring. The player needs some sort of control over the ball and I was going for the kind that when the ball strikes the paddle it is reflected in the direction based on where it struck the paddle.   There were a few ways I was going to go about this, the most simple seemed to split the paddle into a few sections. When the ball and paddle collide check how far down the middle of the ball hit the paddle and give the ball a preset yvel based on where it hit. Closer to the edges gave it a larger value and closer to the center made the yvel close into 0. This of course would go for beneath the center and would make the ball head downward.   However I thought there was a better way to do this. What I tried to do ended of working with some glitches. I would take the amount of pixel difference between the center of the ball and where it hit the paddle and made that into a reasonable yvel value. Its hard to explain so I will include code that I used which is in C++ SFML. // Ball/Paddle Collision else if(sBall.getPosition().x <= 30 && sBall.getPosition().y + BALLHEIGHT >= sPaddle.getPosition().y && sBall.getPosition().y <= sPaddle.getPosition().y + PADDLEHEIGHT) { bpdelta = (sBall.getPosition().y + BALLHEIGHT) - sPaddle.getPosition().y; std::cout << "BPDelta: " << bpdelta << std::endl; ballvelx = ballvelx * -1; if(bpdelta < 60) { ballvely = 1 / (bpdelta / 10); std::cout << "Delta <= 60" << std::endl; std::cout << ballvely << std::endl; if(ballvely > 0) ballvely = ballvely + -1; } else if (bpdelta > 60) { bpdelta = bpdelta - 60; ballvely = bpdelta / 100; std::cout << "Delta > 60" << std::endl; std::cout << ballvely << std::endl; } else ballvely = 0; } These are just things that I tried to do without copying anyone elses work, what I want to know is what is the easiest and proper way to do this. I am currently not concerned by spin with how fast the paddle was moving when striking the ball, thanks and sorry for the wall of text
  7. After about a half hour of intense trouble shooting I have found out my simple error, sorry for this now useless bump :P
  8. Thank you so much, that helped me a lot! The problem seems so obvious now :P
  9. Main.cpp #include <SFML/Graphics.hpp> #include <SFML/Window.hpp> #include <iostream> #include "SpriteManager.h" int main() { SpriteManager SpriteMan; const int PADDLEWIDTH = 30, PADDLEHEIGHT = 90; const int BALLWIDTH = 30, BALLHEIGHT = 30; const int SCREENWIDTH = 800, SCREENHEIGHT = 600; float ballvelx = -0.75, ballvely = 0; float bpdelta = 0; int p1Score = 0, p2Score = 0; bool bLeft = true; float frameCounter = 0, switchFrame = 100, frameSpeed = 500; sf::RenderWindow window(sf::VideoMode(800, 600), "Pong Clone"); SpriteMan.loadSprites(); window.setKeyRepeatEnabled(false); sf::Clock clock; sf::Time time; sPaddle.setPosition(0, SCREENHEIGHT/2 - (PADDLEHEIGHT/2)); sComputer.setPosition(SCREENWIDTH-PADDLEWIDTH , SCREENHEIGHT/2 - (PADDLEHEIGHT/2)); sBall.setPosition(SCREENWIDTH/2 - (BALLWIDTH/2) , SCREENHEIGHT/2 - (BALLHEIGHT/2)); while (window.isOpen()) { sf::Event Event; while (window.pollEvent(Event)) { if (Event.type == sf::Event::Closed) window.close(); } switch(Event.type) { case sf::Event::KeyPressed: if(Event.key.code == sf::Keyboard::Up) sPaddle.move(0, -1); else if(Event.key.code == sf::Keyboard::Down) sPaddle.move(0, 1); } // Collision Check // Paddle/Screen Collision if(sPaddle.getPosition().y <= 0) sPaddle.setPosition(0,0); else if(sPaddle.getPosition().y + PADDLEHEIGHT >= SCREENHEIGHT) sPaddle.setPosition(0,SCREENHEIGHT - PADDLEHEIGHT); // Ball/Screen Collision if(sBall.getPosition().y <= 0) ballvely = ballvely * -1; else if(sBall.getPosition().y + BALLHEIGHT >= SCREENHEIGHT) ballvely = ballvely * -1; // Scoring else if(sBall.getPosition().x <= 0) { p2Score++; ballvelx = 0.75; ballvely = 0; sBall.setPosition(SCREENWIDTH/2 - (BALLWIDTH/2) , SCREENHEIGHT/2 - (BALLHEIGHT/2)); std::cout << "Player 2 Scores!" << std::endl; } else if(sBall.getPosition().x + BALLWIDTH >= SCREENWIDTH) { p1Score++; ballvelx = -0.75; ballvely = 0; sBall.setPosition(SCREENWIDTH/2 - (BALLWIDTH/2) , SCREENHEIGHT/2 - (BALLHEIGHT/2)); std::cout << "Player 1 Scores!" << std::endl; } // Ball/Paddle Collision else if(sBall.getPosition().x <= 30 && sBall.getPosition().y + BALLHEIGHT >= sPaddle.getPosition().y && sBall.getPosition().y <= sPaddle.getPosition().y + PADDLEHEIGHT) { bpdelta = (sBall.getPosition().y + BALLHEIGHT) - sPaddle.getPosition().y; std::cout << "BPDelta: " << bpdelta << std::endl; ballvelx = ballvelx * -1; if(bpdelta < 60) { ballvely = 1 / (bpdelta / 10); std::cout << "Delta <= 60" << std::endl; std::cout << ballvely << std::endl; if(ballvely > 0) ballvely = ballvely + -1; } else if (bpdelta > 60) { bpdelta = bpdelta - 60; ballvely = bpdelta / 100; std::cout << "Delta > 60" << std::endl; std::cout << ballvely << std::endl; } else ballvely = 0; } // Ball/Computer Logic if(sBall.getPosition().x + BALLWIDTH >= SCREENWIDTH-PADDLEWIDTH && sBall.getPosition().y + BALLHEIGHT >= sComputer.getPosition().y && sBall.getPosition().y <= sComputer.getPosition().y + PADDLEHEIGHT) { bpdelta = (sBall.getPosition().y + BALLHEIGHT) - sComputer.getPosition().y; std::cout << "Computer Collide" << std::endl; ballvelx = ballvelx * -1; if(bpdelta < 60) { ballvely = 1 / (bpdelta / 10); if(ballvely > 0) ballvely = ballvely + -1; } else if (bpdelta > 60) { bpdelta = bpdelta - 60; ballvely = bpdelta / 100; } else if (bpdelta == 60) ballvely = 0; } // Ball Logic sBall.move(ballvelx, ballvely); // AI Logic if(sBall.getPosition().y + (BALLHEIGHT/2) < sComputer.getPosition().y + (PADDLEHEIGHT/2)) sComputer.move(0, -0.25); else sComputer.move(0, 0.25); // Clock Work frameCounter += clock.restart().asSeconds(); if(frameCounter >= switchFrame) frameCounter = 0; // Drawing Screen window.clear(); window.draw(sBackground); window.draw(sComputer); window.draw(sPaddle); window.draw(sBall); window.display(); } return 0; } SpriteManager.h #ifndef SPRITEMANAGER_H_INCLUDED #define SPRITEMANAGER_H_INCLUDED #include <iostream> class SpriteManager { private: public: void loadSprites(); }; #endif // SPRITEMANAGER_H_INCLUDED SpriteManager.cpp #include "SpriteManager.h" #include <SFML/Graphics.hpp> #include <SFML/Window.hpp> void SpriteManager::loadSprites() { sf::Texture background; if(!background.loadFromFile("Board.png")) std::cout << "Could not load background." << std::endl; sf::Sprite sBackground; sBackground.setTexture(background); sf::Texture paddle; if(!paddle.loadFromFile("Paddle.png")) std::cout << "Could not load paddle." << std::endl; sf::Sprite sPaddle; sPaddle.setTexture(paddle); sf::Sprite sComputer; sComputer.setTexture(paddle); sf::Texture ball; if(!ball.loadFromFile("Ball.png")) std::cout << "Could not load ball." << std::endl; sf::Sprite sBall; sBall.setTexture(ball); }
  10. The seperate class to load, display and destroy the sprites is my form a Sprite Manager class, instead of having a wall of text in the main main.cpp file that loads all the files in I want to move it to another class and call that method (sorry I think I used the word function incorrectly in my last post) just as a way to sort the code up visually and mentally. The class will have a seperate methods to handle displaying at the end of the loop and then kill the images once the loop has ended completely. Not during the loop   Also my bad about the snippit of code that is showing the sprite to texture bit. I left out a line, embarassing :S It should be edited back in now but incase it isnt here is the revised version sf::Texture paddle; // Here is the missing line if(!paddle.loadFromFile("Paddle.png")) std::cout << "Could not load paddle." << std::endl; sf::Sprite sPaddle; sPaddle.setTexture(paddle); I have not taken an official programming language courses so my terminoligy is unsurprisingly poor, all my knowledge comes from free online help all over the web. Good to know though! sPaddle.setPosition(0, SCREENHEIGHT/2 - (PADDLEHEIGHT/2)); // Line 31 And ther Error message that is coming up in the build log is saying  |31|error: 'sPaddle' was not declared in this scope|
  11. So I created a basic pong game in SFML using a single main.cpp file. Now I want to better organize the game so I created a seperate class to handle loading in the sprites, displaying them and then destroying them. I wanted to keep everything simple so I made sure the loading in file was under Public:  This is a line of code I use to load in a sprite  sf::Texture paddle; if(!paddle.loadFromFile("Paddle.png")) std::cout << "Could not load paddle." << std::endl; sf::Sprite sPaddle; sPaddle.setTexture(paddle);  So in the main program I make a call to that function however when I debug and run the program it says that sPaddle was not declared in this scope. The function was called directly after declaring my variables and initializing the screen. Also the function is in the public section of the class. The line of code that is trying to call sPaddle specifically  sPaddle.setPosition(0, SCREENHEIGHT/2 - (PADDLEHEIGHT/2)); comes directly after. What is wrong? I never uploaded code before so if you need to look at it just let me know, Thanks
  12. I know exactly the boat you are in, I started with some basic C++ knowledge and tried to jump into game programming like SDL What I did was take a step back and practice C++ until I was sick of it and practiced some more. You can't expect to make a decent game without first knowing pointers and classes like the back of your hand. Next I suggest SFML. Im sure SDL is great but I personally found SFML to be easier to learn and understand, plus CodingMadeEasy on Youtube has some great SFML 1.6 and 2.0 tutorials. Also I suggest learning to draw a little or some simple pixel art even if it resembles NES era graphics, unless you have a personal friend who knows how to draw you will want more than just circles and squares to represent your sprites
  13. I know a little bit about pointers in C++ and have been using it on and off for a long time now but I feel like Java is where I want to go I have made a little pong game in SDL and a frogger clone in SFML however I could never wrap my head around creating an engine with either libraries and could not find any good tutorials to help me through (the Lazyfoo with SDL was good but it was only for small concepts) I want to use an engine so I am not stuck at the programming stage forever and play around with my sprites or game development so I was hoping to find a happy mix between an engine that allows plenty of programming but does all the low level work I think I am going to start out with GameMaker to play around, all the while learning a library in Java or C++ (SFML or libgdx) and see where that takes me   I would also like to point out that everyone who has replied seems to be getting -1 ratings, im not sure why as they all seem to be great comments :S
  14. Thanks, I was looking into Game Maker and it seems okay. I see there is a 50$ version, does that give me the right to sell the game? Does that take away any game maker watermarks? These are questions that I didnt find answers to on the main site.   Also what about unity, I dont want to be the 1,500$ version but what about the free one? What permission and limitations does that have? Is it a good idea?
  15. I have been searching on and off for engine that I would like to use while learning programming but I can't seem to choose one I plan on making a 2D singleplayer offline game in the sidescroller perspective in C++ or Java.   When looking at Engines they all seem to be either 3D based 2D but uses 'no programming' as a selling point (I want control over how my game works) 2D and in a language I dont know (I know Java and C++) or is just no longer supported   I am thinking of GameMaker since it is reliable and well known with plenty of tutorials I dont want to turn to the Android App route just yet What should I use?