Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Satharis

Member Since 18 Oct 2007
Offline Last Active Today, 12:14 PM

Posts I've Made

In Topic: Tile Map Editor - Individual Tile editing

23 December 2014 - 11:48 PM

A game with an "infinite world" is generally completely different from a hand developed one.

I feel like your post is very vague about what it is your important goals are with the idea you're talking about.

In Topic: Starting my own game engine - please don't laugh.

16 December 2014 - 04:36 AM

I see a lot of

Write games, not engines.

around here usually. A line that is both completely right and completely wrong at the same time.

If you want to learn about the bare metal of a game engine, writing a game is certainly a decent way to do it. If you think about it, having to implement a game from bare metal yourself means you'll have to face and tackle each obstacle as you go, that both makes you research each part and gives you experience.

The other part that most people don't seem to mention is that making games takes -a long time-. If anything making even a half-assed game takes quite a lot of effort, you'll end up teetering into design and art and mechanics and audio more than just focusing on code. You'll end up dinking around with data and planning things and trying to make an actual game at the expense of a LOT of your free time. Often if you want to work on a side project you have to be rather choosy about what it is, since coding is such a long term effort.

Basically I'm just throwing out there a little advice: it's awesome you want to make your own engine, but remember to take small steps! Don't try and write some convuluted resource manager or something when your engine doesn't even have an identity. I would pick a simple goal to work on, something like.. "make a simple 3d shooter where you're in a room with a paintball gun and have to fire at pop up targets," something like that. The same applies to a 2d engine really.

In Topic: How Do Terraria Animations Work?

16 December 2014 - 04:24 AM

All of the animation is hardcoded into the game itself rather than being driven by the assets themselves. (hardcoding the amount of content that Terraria has is generally a terrible idea if you have non-programmers who want to add content - but hey, they shipped a successful game and made a ton of money, so shows what I know smile.png ).

Terraria is hardly a shining example of game development and the fact it "shipped" and made a lot of money shouldn't really detract from that.

I would advise not looking too closely for inspiration from a game that boasts every item in a giant file, ever entity in a giant file, a function for every single piece of dialogue in the game.. in each language in one giant file.

You could write a book about Terraria's code. There are games out there with a LOT more skill put into them that don't ever come close to the popularity of Terraria, like Minecraft, some games will just defy the general standard.

In Topic: 0 experience in programming and game development

16 December 2014 - 01:27 AM

i love playing games and thats why im choosing to start in this trade

 
Making games is nothing like playing them.

In much the same way that designing and manufacturing a car is nothing like driving one.

Maybe that answer will hit home a little better.

Frankly you shouldn't think about going into game development unless you like some trade -related- to game development: programming, art(modeling/concept/etc), animation, audio(music or sound effects.) You have to love the profession AND games.

In Topic: C++ Number guessing

12 December 2014 - 09:07 PM

#include "stdafx.h"
  • You don't actually need this, and probably aren't using it. Look up precompiled headers to get an idea of what it does, this early in your coding adventures you probably don't need to bother or worry about using one.
  • Your code style so far is very much like C rather than C++, although there are quite a few differences between the languages the main one would be the concept of classes. You'll want to read up on classes at some point to get some ideas on how to format your code in a more object oriented way.
//Defining Functions
int main();
void menu();
void gamePlay();
  • A nice matter of style for code usually is to order functions by the order you expect them to be called in. Of course you can't get this perfect but usually it makes for a nicer read. For example your game starts with main at the top, then it calls menu, and finally you either get to gamePlay or end up exiting. Don't be shy about forward declaring functions just to do less typing.
//Variables
int choose = 0;
int randomNumber = rand();
int tries = 10;
int guess;
  • Prefer to declare variables in the smallest scope that you use them, and right before you use them. For instance you declared all four of these as globals outside of any function, but choose belongs solely to menu and the other three belong solely to gameplay.
if (choose == 1){
        gamePlay();
    }

menu();
  • You call gamePlay at the end of menu and then call menu again at the end of gameplay. When you make a function call the function essentially gets pushed onto a stack, you can think of a stack like one of those plate holders you see at buffets. You put a plate on it and push it down and the last one that was put on top gets removed by visitors first. Basically when you call each thing back and forth like that it will infinitely keep adding more "plates" to the stack, until it runs out of memory. In practical example this probably won't happen, the stack is rather large. But it could certainly happen if you kept doing that in the future, you always want your code to return at some point.
Anyway here is a revised version, let me know if you have any questions.
//////////////////////

// Guessing number.cpp : Defines the entry point for the console application.
//
#include <ctime>
#include <iostream>
#include <string>

using namespace std;

// Functions
int main();
void Menu();
void PlayGame();

int main()
{
    // Seed the random number generator so we get actually random results!
    srand(static_cast<unsigned int>(time(NULL)));

    Menu();

    return 0;
}


void Menu()
{
    int menuChoice = 0;
    bool running = true;

    while (running)
    {
        cout << "Guess the Number\n\n";
        
        cout << "-Menu-\n\n";
        
        cout << "1-Play\n";
        cout << "2-Exit\n\n";

        cout << "Enter your choice: ";
        cin >> menuChoice;
        cin.ignore();

        cout << endl;

        if (menuChoice == 1)
            PlayGame();
        else if (menuChoice == 2)
            running = false;
    }
}

void PlayGame()
{
    int randomNumber = rand() % 1000 + 1;
    int tries = 10;
    int guess;

    cout << "Guess the random number between 1 and 1000!\n";

    while (true)
    {
        cout << "You have " << tries << " tries remaining\n\n";
        cout << "Enter a number: ";
        cin >> guess;
        cin.ignore();

        cout << '\n';

        if (guess == randomNumber)
        {
            cout << "Congratulations, you guessed the right number: " << randomNumber << "!";
            cin.get();
            cout << "\n\n";

            return;
        }
        else if (guess < randomNumber)
        {
            cout << "That guess is too low!\n" << endl;
        }
        else if (guess > randomNumber)
        {
            cout << "That guess is too high!\n" << endl;
        }
        
        tries--;

        if (tries == 0)
        {
            cout << "Sorry, you're all out of guesses! The random number was... " << randomNumber << "!";
            cin.get();
            cout << "\n";
            return;
        }
    }
}
As a challenge to yourself you could try expanding the game a bit, or work on a different one. I did a lot of little changes to give the game more sensible behavior. You of course don't need to copy my style, its just an alternative to give you inspiration on how you might tackle some of the problems you run into.

PARTNERS