Jump to content

  • Log In with Google      Sign In   
  • Create Account


SonicD007

Member Since 23 Feb 2006
Offline Last Active Jun 23 2014 06:41 PM

#5115165 How to program a zelda style game

Posted by SonicD007 on 07 December 2013 - 12:08 PM

Nice game!

 

As others have said, you have the skills to create this type of game already.  The basic idea behind it is to use an image file that has 32x32 (or whatever size you want to use) "tiles" in it.  You draw each tile basically the same way you did your animation for sonic (if you had one image that contained all the animations).  The way you would add depth to the game would be using something called Z-order which is just means you draw the ground layer before the collidable layer so things like fences appear above the ground layer. if you want to have a tree cover a player, simply draw the top part of the tree on the sky layer as opposed to the collision layer (where the bark of the tree would be)

 

I've been trying to make a game like this for years but I keep getting caught up on design issues and whatnot.  I want to make it as perfect as I can which is why I haven't even gotten into the development of the actual game yet.....

 

Anyway, take a look at Tiled for an easy/opensource way of creating your 2d maps.  Then you can roll your own reader for the xml file that tiled produces, or you can use http://code.google.com/p/tmx-parser/

 

Let me know if you have any other questions about this style of game.  (Been trapped here forever haha)




#5113519 SDL 2.0 handling keyboard input ( onkeydown, onkeypressed, onkeyup, onkeyrele...

Posted by SonicD007 on 01 December 2013 - 11:59 AM

This might help you: http://www.gamedev.net/blog/355/entry-2250186-designing-a-robust-input-handling-system-for-games/

 




#5087093 Damage Mechanic

Posted by SonicD007 on 18 August 2013 - 12:41 PM

I've never programmed this feature myself but I would go about implementing it as a "DAMAGED" state where the character would temporarily not respond to user input.  During this state, the character would display the injured graphic and would move back x amount of pixels.  Once the time limit of this DAMAGED state has worn off, the state would transition back into "NORMAL" state.  There would be an entering function for when a state is transitioned to or from another state so the normal state would have an enter method so to speak in which it would check what the last state was (in this case DAMAGED) then it would act based on what the previous state was.  So for this megaman damaged look, when the state goes from DAMAGED to NORMAL, give the player control of his character again and begin the temporary invincible timer.

 

Take a look at the Finite State Machine pattern.  This might be able to explain it better than I can.

http://gameprogrammingpatterns.com/state.html




#5086588 First game project, a 2D platformer.

Posted by SonicD007 on 16 August 2013 - 02:58 PM

IMHO I would say you should create small applications that focus on one thing before building a 2d platform as your first game.  If you want to implement grounds/jumping, I would say create a new project and create a "ground" (Technically if you can create boundaries then creating a ground should be no problem).  Have a rectangle jump on your created "ground".  After that move onto the next thing you want to accomplish and so on.  You'll have a very difficult time creating a 2d platformer if it's your first game and you're still learning C++ as well as SFML.  Take a step back and deal with C++ only.  Try to complete the Gamedev project 1 in the cpp workshop forum.  You'll learn a lot from that.  Also take a look at http://gameprogrammingpatterns.com/.  I've found those patterns very helpful.  In particular, I would look at the type object pattern, the state pattern, and the component pattern.  I don't know what exactly your expertise is in programming with C++, but by the sounds of it I think you should give the gamedev project a go before trying to make a 2d platformer.

 

Tiled is a great opensource tild map making program that you can use to create your levels for the 2d platformer.  You should also read up on tiled maps if you don't know what those are.  If you want to add physics, you should look into "fixed game loops".  I can't go into detail right now but this should be enough to start you off with.  I strongly suggest doing the gamedev project 1.




#5071863 Object Oriented Design Menu System

Posted by SonicD007 on 21 June 2013 - 01:51 PM

Hello everyone.  I've been programming for a few years and have had enough with my brain not grasping Object Oriented Design and creating classes that aren't decoupled.  I went back to the beginning and took a look at Project 1 in the CPP workshop (http://www.gamedev.net/topic/409907-c-workshop---project-1/).  Now, I created a very loosely coupled class which is good (ignore the fact that there are no error checks and does not sanitize user input)....

 

TextMenu class


#include "TextMenu.h"
 
TextMenu::TextMenu()
{
}
 
TextMenu::TextMenu(std::string title, std::vector<std::string> textEntries, IMenu* parent)
{
this->m_title = title;
this->m_textEntries = textEntries;
 
if (parent != 0)
{
this->m_parent = new TextMenu();
this->m_parent = parent;
}
}
 
 
TextMenu::~TextMenu(void)
{
if (this->m_parent != 0)
delete this->m_parent;
}
 
void TextMenu::Display()
{
std::cout << "===========" << m_title << "==========" << std::endl;
std::cout << "\n";
 
for (int i = 0; i < m_textEntries.size(); i++)
{
std::cout << i+1 << ". " << m_textEntries.at(i) << std::endl;
}
}
 
int TextMenu::GetInput()
{
std::cout << ">";
char input;
std::cin >> input;
 
return atoi(&input);
}

....And it follows the Single responsibility rule.  The only problem is all the logic for deciding what to do with the user input falls upon the main() code.  This in turn results in a nasty looking switch statement that looks to me to be a very very poor way of doing things....

 

Main

#include <iostream>
#include <string>
#include <conio.h>
#include <vector>
#include "TextMenu.h"
 
using namespace std;
 
int main(int argc, char* argv[])
{
vector<string> entries;
entries.push_back("Create Character");
entries.push_back("Shop");
entries.push_back("Quit");
 
TextMenu test("Main Menu", entries, 0);
test.Display();
 
switch (test.GetInput())
{
case 1:
entries.clear();
entries.push_back("Name");
entries.push_back("Class");
entries.push_back("Economic Status");
entries.push_back("Back");
 
TextMenu charCreation("Character Creation", entries, &test);
 
charCreation.Display();
if (charCreation.GetInput() == 4)
charCreation.m_parent->Display();
break;
}
 
_getch();
return 0;
}
 

So, what would be the best way of dealing with this?

A) Have the menu class handle the input by somehow creating handlers and attaching them to each menu entry.  (I'm thinking of .NET and how for example the button gui item simply has a button.Click() Event that gets triggered.  Not sure how to do this event delegation in c++ though)

 

B) Keep the logic out of the menu class but somehow I would have to clean up that main() code.  It looks horrible as it is and I know it's a poor design, but I'm not sure how to fix it.

 

How would you guys fix this problem?  Please keep in mind I want to improve my OOP design skills.  Ignore the fact I don't have any error checking and the main() code was created as a draft to test my class.  I'm leaning toward answer A to solving this issue but I'm open to how others would do this.

 

Thanks.

 

P.S. I'm not a beginner in C++, just can't seem to grasp the design aspect of programming well :/

 

EDIT: Seems like the code tags don't like my tabs/spacing o.0




#5030863 Fixed Time Step Game loop

Posted by SonicD007 on 10 February 2013 - 06:14 PM

Thank you so much everyone!  L. Spiro, thank you for clearing things up for me, that's two blogs you've made that've helped me out so far :)




#5030402 Fixed Time Step Game loop

Posted by SonicD007 on 09 February 2013 - 10:39 AM

I've been trying to understand fixed time step game loops for about 3 weeks and I'm still having trouble understanding it.  I've read http://lspiroengine.com/?p=378 http://gafferongames.com/game-physics/fix-your-timestep/ and http://www.koonsolo.com/news/dewitters-gameloop/ multiple times and I still can't wrap my head around it exactly.  I understand that we want to render as fast as possible as well as updating the game logic at regular intervals.  What I don't understand is why the interpolation value is used in the rendering function instead of the update logic function.  Also, what would be the time that I would use to do my actual logic updates?  Would it be the dt time (interpolation time) or what?  If someone can do a mock up in paint to help me visually see how everything connects I would GREATLY appreciate it.  I'm driving myself crazy trying to get this under my belt.  Another problem I was having was my timer integer was "overflowing".  

 

(I had a tough time understanding gafferon's tutorial.  deWitter and Spiro I understood better)




#4953660 Game Programmer's Rite of Passage

Posted by SonicD007 on 28 June 2012 - 08:26 AM

Thanks for the replies! I'm not too much of a noob as I've been programming on and off for about 6 years but I'm going at an incredibly slow pace. My friend and I decided we would create Tetris->Asteroids->Space Invaders for now. I'm in the bad habit of starting projects and not finishing them but I've still been learning. I'm hoping by having someone else programming with me I won't want to stray away from finishing the projects.

I recently read Head First: Object Oriented Design & Analysis which was a great read. I'm trying to keep the concepts from this book in mind when I program now and I think it's helped a lot so far.

I didn't think of trying to program Pac Man, that should be fun. A maze game would also be fun to make. It could definitely be expanded upon to add traps and monsters, maybe that will be our fourth project!

ApochPiQ, I read that a while back, it motivated me a bit to move my butt haha!


#4953341 Game Programmer's Rite of Passage

Posted by SonicD007 on 27 June 2012 - 07:58 AM

Hey everyone, I was just wondering what games you guys think a programmer should have under their belt. For instance, most people say do a text based game, then pong, then tetris, then ........ so I would like to know what games you guys think should be made and in what order you would do them. If you could list concepts that would be learned from making each game that would also be great.

Thanks.


#4952867 Moving diagonally (Chess) logic

Posted by SonicD007 on 25 June 2012 - 08:06 PM

Hey everyone, I'm writing a simple chess clone and I'm not sure how to implement the diagonal moving. I already made the Pawn, Knight, and Rook, but I'm having trouble on figuring out the diagonal moving through a 2d array. Anyone have an algorithm or guide on implementing diagonal moves? Thanks! (I'm working on the Bishop now)


EDIT: A shower later and I just realized the same way I did the attacking for the Pawn is how I would do the diagonals for the Bishops. Sometimes typing the question out and a nice shower helps get the brain working haha! Thanks anyway!


PARTNERS