Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Dec 1999
Offline Last Active Yesterday, 08:29 PM

#5175736 How to program tile transitions (C++/SFML)

Posted by Eck on 23 August 2014 - 09:10 PM

This article is about transitioning terrain tiles:



And this forum post explores it a little further:



I think they'll shed some light on your problem.


- Eck

#5174834 Staying Motivated

Posted by Eck on 19 August 2014 - 03:08 PM

Yeah, being an indie game developer is rarely the path to riches. In fact, it usually costs you lots of time, effort, time, socialization, time, money, and time. But if you do finish a game, release it, and even one person (not a friend or family member) buys your game. You get to say... "I'm a professional game developer!" :)


- Eck

#5174583 Staying Motivated

Posted by Eck on 18 August 2014 - 05:50 PM

First of all, you should realize that staying motivated is a pretty common problem. You're not alone. There was a really good post that lots of good advice on how to stay motivated. Here's a link to my post. 



Watch the movie Collateral! :)


Focus on smaller games at first. There's a great article on which game you should code first and why.



If you go straight to your dream-game of awesomeness, you'll quickly get overwhelmed. But if you take baby steps of small reasonable goals you'll be rewarded with a sense of accomplishment and be equipped with tools and code to tackle bigger projects.


If you can stay motivated to get into shape, I'm pretty sure you can stay motivated to work on game development. It sounds like you have a pretty busy life right now so the time simply might not be there.


The only "trick" is, that there isn't a trick. You have to prioritize it or it just won't happen. You have to want to lose weight more than you want to eat donuts. You have to want to complete a game more than you want to play a game. :)


Good luck man,

- Eck

#5173006 Can't solve problems without googling?

Posted by Eck on 11 August 2014 - 09:39 PM

You will do a lot of things wrong over your career.  You will try something and it will fail. You will start down one path and realize you could have done something much better...


You'll probably also solve a problem one day and say to yourself, "Damn. Now THIS is some awesome code."  Then a few years later you'll look back at that work and laugh at past-Lith for being such an ignorant newbie. 


Like others have said before, you'll get better through practice. Since you're 17 and started programming a couple of years ago, I wouldn't worry too much about it. You're motivated to learn and are programming in your free time. Good job.


And one reason the solutions look easy online is because you're looking at the solution. You're not watching a video of some mathematician staring at a whiteboard for hours at a time, trying and failing a hundred different times. You get to see his nice proof on a clean sheet of paper without any scribbles or teardrop stains. :)


- Eck

#5171096 Where should I start? (2D Game Programming)

Posted by Eck on 02 August 2014 - 08:33 AM

Ah... At first you said  "a simple 2d game where my friends and I can chat" and then you drop the term "We're going to make an mmorpg"...  Ugh...


Go read this article right now:



Read the whole thing! >.<


And don't knock using game engines or higher level languages. Read this one too:



Especially #2 where he talks about using game engines and languages. He even points out that Minecraft was made in Java.


- Eck

#5170922 Snake code review request

Posted by Eck on 01 August 2014 - 11:58 AM

Very solid code review Josh Petrie. Good job.


And kudos to the original poster for finishing some of the first-step games. So many beginners flounder around trying to code their dream game, get frustrated and give up. You'll be happy you're taking the time for these fundamentals.


Out of curiosity, how long did it take you to write these two games? Rough estimates for each project is fine. 


- Eck

#5170921 Where should I start? (2D Game Programming)

Posted by Eck on 01 August 2014 - 11:49 AM

If you haven't written any games yet, starting with a multiplayer game is too big of a first step. Jumping straight into network game programming will over complicate things.


Here's a great article for starting out:



It explains which games you should make first and why.


Once you have a game, then you can move on to trying to make it multiplayer. You'll want to find a good networking library for C++. I used Lidgren for a few personal C# projects a while back and was very pleased with it. I'm not sure if Lidgren has a ready-to-use C++ library or not.


- Eck

#5170916 use of pointers

Posted by Eck on 01 August 2014 - 11:17 AM

I didn't see where anyone mentioned Polymorphism yet.


You can use pointers to common base classes instead of instances of specific classes. For example: instead of your physics manager having a list of starships, missiles, asteroids, etc. You can create a PhysicsObject base class and then derive your Starships, Missiles, and Asteroids from them.


Now your physics manager class can have a list of PhysicsObject pointers and not care about which derived type each item is. Each of these derived items can be treated like a PhysicsObject so you have a list of them, and all your physics functions can take a PhysicsObject pointer.

// For this function, we could pass it a pointer to a Starship, a pointer to a missle, 
// or a pointer to anything that dervies from the base class PhysicsObject
void ApplyForce(PhysicsObject* physicsObject, float direction, float magnitude, float elapsedSeconds);

Do a search for C++ polymorphism for some more reading. This looked like a decent article.



- Eck

#5170382 Top-down 2d Tile game - how to generate wall tiles?

Posted by Eck on 30 July 2014 - 10:35 AM

This article is about transitioning terrain tiles:



And this forum post explores it a little further:



I think they'll shed some light on your problem.


- Eck

#5167140 Any good tutorial for side scrolling shooter game with Game Maker: Studio? Or...

Posted by Eck on 16 July 2014 - 06:46 AM

I did a search on google for game maker side scroller tutorial. The top link is a 17 part YouTube series that walks you through step by step of making a... side scrolling shooter with GameMaker Studio. It had 43 upvotes and 1 downvote so I'll go ahead and recommend that. If you don't like that one, I strongly suggest digging through the other 19,000+ results and finding finding a series you like. A big part of game development (and programming in general) is learning how to do your own research.


There are about a blue-gillion "What do I do first?" threads on this site. Jump in! If you get stuck, try and figure it out yourself. If you're still stuck, ask for guidance then. We'll be happy to help at that point when you tell us the specific problem you're having and you tell us the steps you have already tried. Take a look at the beginner faq:



- Eck

#5165810 c++ function pointers

Posted by Eck on 09 July 2014 - 07:58 AM

8 Years never needed a function pointer and I can't find a good example.


Function pointers are kind of a weird tool in your toolbox. People are normally taught function pointers in an academic/abstract setting and then they are quickly forgotten because you can get by without them on a day to day basis. So here is a real world example.


I recently used function pointers (C# delegates) in a generic Credit Card Processing library that I wrote for my employer. It needed to work across all the C# projects who had different data-layers. I had a very specific series of events I wanted to happen when sending a credit card transaction as it was being used to make it bullet proof.

  1. Save the credit card transaction attempt BEFORE sending to the processor - Status: About to Send
  2. Send the transaction to the processor
  3. Save the result of the credit card transaction - Status: Approved/Denied

I could have solved this problem with documentation. Hey jerkies! Do it like I told you! But, if they didn't use it correctly, the burden of figuring out the problem was going to be on my shoulders anyway. So I'd rather be sure.


I could have solved the problem with direct saves through one of the data layers. But then I'd have to copy/paste the code in each project and rewrite the saves for each data layer. If there was a bug, I'd have to fix it in each copy of the code... Bleh.


So, I decided to use function pointers (C# delegates). The signature was:

bool PersistTransaction(CreditCardTransactionInfo)

I didn't care how they saved it, I just tell them the info they need to save. If there is a problem saving the data, they should return false to me so I don't try to go through with the transaction. This allowed them to use the data layer they felt like using. Heck, they could have even saved it to a file instead of into the database if they felt like it.The more junior programmers started murmuring amongst themselves and claimed I was a dark sorcerer...


In games, you might use function pointers to control simple AI movements for sidescrolling shooters. Basic enemies might just move straight, others might follow a sin curve, and others track the player like a heat seeking missile. You can solve this problem without function pointers, but it opens up some neat possibilities.


- Eck

#5164889 So... I'm a Molecular Biologist....

Posted by Eck on 05 July 2014 - 09:52 AM

I figure I would try to get the game coded in C++ and for mobile devices, but I want it to be as cross platform compatible as possible and the code to be as open source as possible. I'm not sure what my options are in that regard.

I'm also not sure what my options are in regards to actually coding the information. I guess they can be math based or rule based (if/then type stuff)? Is there any other way to encode the information?

I understand that there is underlying game mechanics and then there is a user interface on top of that (generally), but I am unsure how to say that in technical terms and what my options are in that regard.


Pink Horror is right. Unless there's another technical requirement, the language shouldn't concern you. "Open source" just means sharing your source code so that doesn't limit your options at all. Cross-platform makes things a bit tougher, but you aren't restricted to just C++. That may have been true at one time, but languages, engines, and frameworks have come a long way. C# and Unity are still a good choice. Heck, you could even do it in GameMaker technically.


And Kaptein is correct too. Being the non-programmer idea guy, you don't have to be too technical with your requirements. Professional programmers frequently interact with non-technical people and work together to figure out exactly what the client is asking for. You're already starting to talk to us through forums and we're starting to get an idea of what you want. If this were an in-person discussion with a whiteboard, we'd be able to start roughing out some general ideas. 


If you want to start figuring out the game mechanics, you can start on this yourself with no technical skill whatsoever. Cut out some construction paper shapes for your molecules and move them around, or use blocks, or some other kind of manipulative. Figure out "what" you want the user to do and this will be the game's mechanics. Since you are the SME (Subject Matter Expert) you'd be in charge of that with guidance from the programmer. Figuring out "how" to allow the user to do this will be the user interface, and will be both your responsibilities. Figuring out the low level details of the specifics of the coding is the programmer's responsibility.


Re: Encoding the information - It sounds like data-driving (detailing out specifics via data files) the game mechanics is what you're asking about and it should be doable. It adds some up-front complexity to the task, but I find that doing so usually opens up so many more possibilities. It makes your game "mod-able" (able to be modified by the end user) and sometimes in ways the original programmer never even thought about. 


I have to cut this short since I have plans this Sat. Sounds like an interesting project. :) 


Honestly, as a programmer, one thing that somewhat bothers me is when someone who does not know what he or she is doing with software still wants to make all the high level technical decisions, and then force the actual programmers doing the work to use the programming languages, libraries and tools of their choice, based on some light Internet research, instead of letting the people who may have actually written games in several different languages and environments decide which ones to use. But that's just me.

But that's just you...And me... And damn near every other developer... :)


- Eck

#5164745 Old Keyboard State in Input Handler

Posted by Eck on 04 July 2014 - 08:57 AM

In your update function, I see where you're copying the new keyboard state to the old keyboard state, but you aren't updating the new keyboard state. I don't see how the "keydown" is working without this. smile.png Unless you're always newing up an instance of Input somewhere else in your program...

void Input::update(){
    std::memcpy(keyboardOld, keyboardNew, length);
    keyboardNew = SDL_GetKeyboardState(&length); // Add this line.

Give that a try and see what happens,

- Eck

#5164742 So... I'm a Molecular Biologist....

Posted by Eck on 04 July 2014 - 08:25 AM

Question 1: I want to make a game, what do I do?

Well, someone needs to know how to program on your team. Right now, your team is...You. You have some 10 year old programming knowledge which is better than nothing, but that's a far way off from a game developer. So either start learning how to program, or find a programmer to join your team. 


If you're going to learn to program yourself, you'll have to pick a language. I'll suggest C# since you can get Visual Studio Express (a compiler and integrated development environment) for free and C# seems to be a popular starting language these days. Find some C# tutorials and start working your way through them. Once you get the basics down, you're ready to move on to a framework that makes drawing things to the screen and moving them around way easier. I'll suggest Unity or MonoGame since they also have a free option and start learning how to use them.


If you're going to add a programmer to your team, you're probably going to have to pay him on a milestone basis. You might be able to convince this hypothetical programmer to do this work for a cut of the profits, but probably not. Ideas are cheap, and most programmers have other things they can be doing for money. :)


Question 2: I want to make a game about folding proteins, any suggestions?

1. It's too early to worry about this just yet, so don't. Don't try to jump into your dream 3d protein folding awesomeness as your first project. You will get overwhelmed and likely get very demotivated. Instead, make some other simple practice games. Here is a great article that tells you which games you should work on and why:



2. I watched the video and even though I just told you it's too early to worry about this, I wanted to tell you about my ideas. :) I saw 3d blobby shapes, twisting, folding, and rotating. How are your 3d modelling skills? What about your 3d math skills? Even if you have both of those skills where they need to be, what would the player be doing during all this? If they have to manipulate or build their own proteins, this would be pretty complex. You'd have to design and code some kind of intuitive UI almost like a 3d modeler for that task. And I would guess that many people wouldn't be able to "play" the game from this 3d complexity. Plus, you said the formulas for this were crazy complex on top of  all that. 


If this is an educational game, I think the concepts are more important than the specific details. So I would abstract these concepts out to 2d and come up with game play elements based on them. I'm picturing Tetris like blocks connected with hinges. Players could design their own proteins, or receptors, or blockers by connecting pieces together. The UI for this would be much simpler, and I think players would have a much easier time predicting what will happen to these simpler 2d shapes bending on hinge points.


But that is a long way off. :) To summarize a rough plan, with VERY rough time estimates.


1. Learn to program. (1-2 months)

2. Learn a framework  (1-2 months)

3. Write some simple games (3-6 months)

4. Make your protein folding game (6-12 months)

5. Sell your game to the masses for a blue-gillion dollars!


Good luck,

- Eck

#5164048 Receiving very odd compiler Errors

Posted by Eck on 01 July 2014 - 08:45 AM

Basically "circular inclusion" is when class one's header file (Component.h) needs to use class two's header file (GameObject.h). And class two's header file needs to use class one's header file.


You use "forward declaration" to give the compiler a heads up, "Hey compiler. I know you don't know what GameObject is but it's going to be a class, and I need a pointer to it. I promise we'll have implementation for it later, but for now just trust me that I need a GameObject pointer in Component." :)


This is a very rough definition, but it should give you an idea of what these things are before continuing your research.


- Eck