Introduction to c++ needed

Hey guys, im Dylan and i have decided to learn to code c++ to help myself in game development and programming for games. I have only recenly begun the tutorial on this website and i find it very informative and easy to understand.

I know to some of you, This is a laugh as you are experts but i wish to be just as good in the future. So far i have learnt:
1. Data types
2. Varibles.
3. Operators.
4. Functions 1 and 2.
5. Constants.
6. Basic input and outputs.
7. Structure of a program.
I am currently learning arrays.

So far i have made a program that asks you for your grade and when you give an a b c or d it tells you the percentages and if you tell it your percentage it groups you into either a b c or d.

Not very advanced i know but i have to start somewhere.

I have a goal in mind for myself and it is to make a full working 3d game in an engine by this time next year. I wish to have a zombie a.i, loot drops and much of the same features as dayz but for my own use so i can see how to code this advanced stuff.

I recently done some study on A.I and c++ but one part in particular confused me. It was con-structers and de-structers. What are the purpose of these and how do i incorperate them into A.I.

Secondly if i wish to make a loot drop in lets say the cryengine 3 SDK can i do this with a flowgraph or a math algorithm.

Thirdly. How can i make zombies randomly spawn in groups of lets say 20. I wanted to make it so that they spawn in allocated areas on the game world.

Lastly. If i want my script to relate to a particular object or feature in my game how do i make them relate. Example: How do i make my zombie script in c++ relate to my mesh in game and use the script on the mesh.

Here is the code i am on about when i say con and de-structers.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  #include <iostream
#include <stream>
#ifndef _new1_
#define _new1_
using namespace std;

struct new1 : public CGameObjectExtensionHelper,< new1, GameObjectExtension >
{
   new1Entity(){}
   
   ~new1Entity(){}
};


#endif 
Last edited on
I have a goal in mind for myself and it is to make a full working 3d game in an engine by this time next year.


If you mean you will be using an existing engine, this is doable, but unlikely. If you mean you are going to write the engine yourself, then it will take much longer than a year for you to get familiar enough with C++ to do this effectively.

Even using an existing engine... completing a "full" game will take quite a while.

Not to discourage you or anything, but you should know what you're getting into.

It was con-structers and de-structers. What are the purpose of these and how do i incorperate them into A.I.


They aren't necessarily related to AI. They are fundamental concepts of Encapsulation and OOP.

A constructor is run whenever an object (an instance of a class) is created. This allows you to initialize all of its members which lets you ensure that your object is always in a known state.

A destructor is run whenever an object is destroyed, which lets you free up any allocated resources.

The application and significance of these is obvious when you understand the idea behind OOP and encapsulation. If you want to learn more about these particular features, that is a topic you can research.

Secondly if i wish to make a loot drop in lets say the cryengine 3 SDK can i do this with a flowgraph or a math algorithm.


I'm not familiar with cryengine... but this question is so generic that I'm all but positive the answer is "yes".

Pretty much any "math algorithm" can be implemented in programming.

Thirdly. How can i make zombies randomly spawn in groups of lets say 20. I wanted to make it so that they spawn in allocated areas on the game world.


This question out of context is impossible to answer.

If you know how to spawn 1 zombie... then just put that in a loop to do it 20 times.

When (or after) they're spawned, just put them wherever in the game world you want by adjusting their position.

Lastly. If i want my script to relate to a particular object or feature in my game how do i make them relate. Example: How do i make my zombie script in c++ relate to my mesh in game and use the script on the mesh.


Again.. this question is very generic and difficult to answer in any meaningful way.

You zombie code (read: it's not a script) can just modify your mesh as needed. Typically you'd have a 'Zombie' class which would own both the logic and the mesh, and when you update the Zombie object it would also update the mesh according to the zombie's AI/logic... and when you draw the Zombie object it would draw the mesh.
I have a goal in mind for myself and it is to make a full working 3d game in an engine by this time next year.

highly doubtful
Don't make a goal that is too far fetched. It will just discourage you.
Last edited on
when i say a full game it to me sounds probable. I am efficient with 3ds max maya and other 3d model programs so making my objects wont be difficult the only hard side is the scripting for the a.i which will be zombies and the health and thirst systems. Also my questions were ment to be asking for help on how i should approach making a zombie a.i. It seems wherever i go nobody wants to help on zombie a.i but theyll glady help on making a fps soldier or the likes. Being new i dont want to sound ignorant its just help is easy to come by but valued help is something i find hard to get on most forums.

When i asked about loot i really wanted to know how can i do it. Not is it possible even though that is what i asked.

By zombies i wanted to know how can i make them react to my player in certain ways and where in the tutorial pages can i find what i need as it all seems to be related to actual math programming and nothing to do with gaming not even a reference.


Thank you for your replies.
Your questions are very difficult to answer because they are too generic.

Everything in programming follows a logical path. If you know how to form logical paths and write those paths in code, then you know how to do any kind of logic you need to do.

If you want the zombie to react to a player, then you can have the zombie watch what the player is doing and respond to it.

Example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Zombie
{
    Position lastSeenPlayerPos; // position at which the player was last seen

    void update() // do the logic/AI for this zombie
    {
        Position nextPlayerPos = __getCurrentPlayerPos__();

        if( nextPlayerPos != lastSeenPlayerPos )
        {
            // the player has moved.  Put logic here to have your Zombie "react" to their movement
        }
        lastSeenPlayerPos = nextPlayerPos;
    }
};



I think the problem is you are skipping over learning how to program and are jumping into "how can I do this thing that I want to do". It doesn't really work like that... you have to understand the language and concepts first... once you 'get it', then you should be able to answer the "how" questions yourself.


The only way to learn to program is to actually program. I suggest you start writing some small games... like a really basic vertical shooter or something. That will teach you a lot about how this stuff works.
Step 1. Become fluent in a language
Step 2. Gain better understanding of said language (an ever lasting goal)
Step 3. Learn about and from different libraries.
Step 4. Repeat steps 1 through 3
Step 5. Learn about algorithms.
Step 6. Learn about Different approaches and methodologies of programming
Step 7 repeat steps 1 through 6.
Step 8 - Is about where I'm about now, and can't really give you any more advice. But at this step, I feel as though I'm still not ready to tackle a project as complex as a 3d game by myself.
so where can i make a simple vertical shooter like that how can i make it run on windows with a launcher or what need i do for this.
Lofty aspirations, my friend. You need to actually go through the process of learning from the ground up in order to get anywhere. Maybe that's not what you wanted to hear, but it's true. You mentioned having trouble getting anywhere on previous forums - Let me tell you, it's because of your line of questioning. You don't understand the concepts, and therefore don't know what the right questions to ask are. You seem to lack a lot of fundamental knowledge in this field, so how do you think you're going to pull this off?
AAA Game developing companies have hundreds of professional programmers and employees scattered in all sorts of departments. Why? Because it's difficult, and it takes a long time to do right (even then, it's not always right).

I'm actually very curious what made you think that constructors/destructors had anything directly to do with artificial intelligence. I've seen people make outlandish assumptions like this. Making mistakes is part of learning, of course, but unless you have an acquired intuition about these things, it's a marathon in the opposite direction.

Keep reading and studying online resources. If you want to, do some research and get a good book. Sorry for being so harsh, but there's a reason that these kinds of threads have become somewhat of an inside joke.
Cronin:

My advice would be to do the following:

1) Install SFML
2) Write a basic SFML program that does nothing but runs and shuts down when the user wants it to
3) Draw a basic graphic on the screen
4) Let the user move the graphic around by pressing keys
5) Draw another graphic on the screen that moves around on its own
6) Do something when the two graphics overlap.


After those 6 steps, you should have a pretty clear idea of what it takes to make a basic vertical shooter. Go from there.
thank you disch ill do that. The reason why i have as you said such an outlandish goal is because its my ultimate goal. It doesnt have to and wont be done in a long time but its what i want to achieve in the future.
Topic archived. No new replies allowed.