Jump to content

  • Log In with Google      Sign In   
  • Create Account


molehill mountaineer

Member Since 24 Apr 2012
Offline Last Active Jul 15 2014 07:09 AM
*****

Posts I've Made

In Topic: C++ Primer - CodeBlocks

14 February 2014 - 03:00 AM

Sales_item.h is a header file which you'll find in folder "1" of the .zip you linked to. Most likely the problem is because code::blocks starts looking for this file from a different "starting point" (= working directory) than visual studio.

I'm not familiar with this IDE but I think you could try copying the header file to the directory where the *.cbp (= project file) is located.

EDIT: also take a look at this

In Topic: How do I go about creating a game (and does anybody want to help?)

13 February 2014 - 06:23 AM

If you're just starting out I would strongly advise you to forget about 3D games for now. Making games takes a huge amount of work so adding the additional complexities of 3D mathematics and rendering just needlessly steepens the learning curve which will kill your motivation. I wouldn't even touch directX or openGL until you've made a few games with simpler API's such as SDL, SFML or allegro.  If you don't know how to code even a simple tetris game you really have no business starting a 3D project, boardgame or otherwise. 
 
You say you have a theoretical understanding of C++, I don't mean to sound blunt but that's just not going to cut it. The same principle as stated above applies: you're making things harder by trying to put together a game when you should just be learning how to think like a programmer
 
So, to summarize: first learn c++ for a couple of months, then make a few small games with user-friendly API's and after you can starting looking at directX or openGL tutorials
 
 
That said, if you absolutely must code a 3D directX project, Frank Luna's book is pretty good.

In Topic: A little assistance being pointed in the right direction for browser based games

09 February 2014 - 05:34 PM

Programming for the web is similar enough to programming stand-alone applications, with a few twists.

As with anything you're going to want to pick a language, get the fundamentals down and then start with a few *small* projects to get your feet wet.

 

I'm not much of a web-developer, but html5 would be my choice for a beginner:

 

step 1)

learn html5

 

step 2)

know how the web works

 

step 3)

make games

 

step 4)

???

 

step 5)

profit!


In Topic: Extreme Beginner Help!

19 November 2013 - 01:59 AM

It depends on what direction you wish to take - it sounds like you're interested in the programming side of things. 

When you're just starting out, the most important thing is to learn how to think like a programmer - what data structure do I use for a certain task, what is the difference between a while and a do while loop, what classes do I need to make to solve this problem, etc. Once you have this under your belt learning another language will be relatively easy - it's mostly a matter of understanding the syntax.  

For games, an object-oriented language is the norm. It's certainly possible to make a game in a procedural language (like those tetris games you can play on your calculator) but it's a bit of a headache. So, if you want to learn, you need to pick an object-oriented language (commonly referred to as an OO language), find a decent  book that will give you exercises to work on and start practicing.

 

Everybody has their own opinion on which language is best for beginners, I usually recommend java since its syntax is similar to C and it provides many libraries which reduces the complexity of the code. 

 

EDIT: also, I'm working on a pong clone. If you want to take a look at what goes into making a game check out my journal. Don't worry if you don't understand the code yet - I'm making things a bit harder than they need to be. The code will probably look like gibberish but it might give you a better understanding of how much work it takes to make even a simple game. 


In Topic: Inventory System for Noom Text Adventure Game

17 November 2013 - 04:20 AM

Since inventories usually allow the player to add/remove items at random I suggest you use a linked list. It's a datastructure in which each node contains a pointer to the next node. This means you can insert and remove at your own volition - it's simply a matter of adjusting the pointers (don't forget to free your memory!).

A double linked list means each node contains two pointers (one that points to the next node and one that points to the previous node).

Relevant links: explanation code

 

Stats seems like it would be a datamember of the player instance (that is Player::m_power accessed via Player::getPower(); , Player::m_hp accessed via Player::getHitPoints(), etcetera).

 

Assuming I'm interpreting your question correctly, you could create an Event class and store the events in a std::vector<Event*>. The events would be treated as a subroutine and stored in the Game instance. 

 

Something along the lines of:

GoblinDuel::RunEvent(Player* player) //"GoblinDuel" is a class which inherited from "Event"
{

    bool finishedEvent = false;


    printf("--YOU ENCOUNTER A GOBLIN--");
    printf("PREPARE TO FIGHT!");

    if(player->getHP() < 5)
        {
            printf("Goblin throws you a health potion");
            player->addItem(new HealthPotion()); //add item to linked list
        }

    Goblin* goblin = new Goblin(1000); //goblin with 1000 HP 
    while(!finishedEvent)
    {
        

        //fighting code here


        if(goblin->getHP() <= 0)
        {
            printf("Goblin groans and slumps! You take his sword")
            player->addItem(new GoblinSword()); //add item to linked list
            finishedEvent = true;
        }

         if(player->getHP() <= 0)
         {
             printf("Your guts fall on the floor. The goblin sheaths his sword and walks away");
            finishedEvent = true;

            //don't forget to end the game when we return to main loop
        }
    }
}


Game::RunAllEvents()
{
    std::vector<Event*>::iterator it = m_events.begin();

    while(it != m_events.end())
    {

        it->RunEvent(m_player);
        if(m_player->getHP() <= 0) //player died in event
        {
           this->showDeathScreen(); //you would actually just break and call showDeathscreen() in the main loop but I'm not going to type the whole game =)
           break;
        }

        ++it;
    }
} 

I typed this rather quickly so don't take it as gospel, it's just something to help you get started. Also: events will have to be inserted into the vector in order in which they take place.

 

 

If the events aren't run sequentially you can use an std::map<string, Event*> instead. You can then call the event by name when you need it. That would look something like this

 

Game::runGameLoop()
{
    //add event durin initialization
    m_events.insert(std::pair<std::string, Event*>("goblinDuel", new GolbinDuel()));





    //lots of code goes here




    //somewhere in your game loop
    if(eligibleForGoblinDuel()) //check if we need to run goblin duel
        m_events.find("goblinDuel")->runEvent(m_player);
}


bool Game::eligibleForGoblinDuel()
{
    bool playerHasSword = m_player->hasSword(); //check inventory for sword
    bool isInSecondRoom = m_currentRoom == 2;
    bool playingForTenMinutes = m_timer.getTimeInMinutes() >= 10;
    if(playerHasSword && isInSecondRoom && playingForTenMinutes)
        return true;
    else
        return false;
}

PARTNERS