Own Player variables

Grab your favourite IDE and tinker with the innards of game engines

Own Player variables

Postby WaterRatj on Tue Sep 25, 2012 4:52 am

How would somone create custom variables that are saved in the pPlayer variable?

trying to look on how to do it the easy way (without knowing to much c++,still learning)
Trying to create different iCustomVariable, strCustomVariable to be saved inside the pPlayer?

anyone can throw me in the right direction?
WaterRatj
Member
Member
 
Joined: Wed Mar 02, 2011 1:45 pm

Re: Own Player variables

Postby zombie@computer on Tue Sep 25, 2012 2:29 pm

simply add the variables to the class and use https://developer.valvesoftware.com/wiki/DATADESC datadescs to add the variables to the savegame thingy. Childsplay really.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: Own Player variables

Postby WaterRatj on Tue Sep 25, 2012 6:21 pm

I don't acctually mean save games. But variables for in multiplayer games.
WaterRatj
Member
Member
 
Joined: Wed Mar 02, 2011 1:45 pm

Re: Own Player variables

Postby Garrador on Tue Sep 25, 2012 8:32 pm

What you should really do first (before diving into the actual game programming), is to teach yourself the basics of programming concepts and basic c++.

Here are some key concepts you should know at a minimum:

- Inheritance
- Polymorphism
- Derivation

There are some of the most told-about concepts.

You should buy/download yourself a C++ for dummies book, since it will take you from the mega-basics to what you really need to know and have as a working foundation. Learning c++ bygoing through articles here and there, with no linear learning curve as to what concepts and functions you should know, can be time consuming and not really a good way to learn it. Use a book. It saves time and frustration. After you have the base foundation, then you can go explore deeper and such. Sounds boring and all that, but you should really do it. I tried starting right away on programming with HL2 mods and such, and it really didn't get me anywhere. Start with the basics and work your way up.

You should be comfortable with classes, the concept of abstraction. The difference and up/downsides of public, protected, private methods/variables and what static variables and methods are, how memory management works, at least at a basic level. Scope of variables, how pointers work.

A lot of stuff is quite necessary to know beforehand.

What zombie@c says would lead you to the correct thing to do (vague as ever :P ), but I don't think you'd get far unless you know how it works basically.

Source uses C++, but has its own system, hierarchy and syntax + macros etc. etc. So it's kind of a language made with C++, to put it on the edge. So if you don't know it, you'll have a hard time understanding it.
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: Own Player variables

Postby WaterRatj on Tue Sep 25, 2012 8:39 pm

I'm already learning c++ from differnt good sites, and learning basics (have experience in former javascript).
I'm looking at examples and learn a bit from htat, but some people are vague on how and where things are sorted in the sdk.

Already have made alot of progress on my mod with workarounds to load functions and stuff.
But need better and more explained examples then vague answers some people give :p

From this forum I already learned a few things.
So In can see i'm on the right direction with c++ basics but can't expect to learn a whole new language in few days ^^
WaterRatj
Member
Member
 
Joined: Wed Mar 02, 2011 1:45 pm

Re: Own Player variables

Postby zombie@computer on Tue Sep 25, 2012 8:48 pm

WaterRatj wrote:I'm already learning c++ from differnt good sites, and learning basics (have experience in former javascript).
I'm looking at examples and learn a bit from htat, but some people are vague on how and where things are sorted in the sdk.

Already have made alot of progress on my mod with workarounds to load functions and stuff.
But need better and more explained examples then vague answers some people give :p

From this forum I already learned a few things.
So In can see i'm on the right direction with c++ basics but can't expect to learn a whole new language in few days ^^

you're vague as well :wink:
Where is the problem? You don't know how to add variables to a class? You don't know which object is a player class? You don't know how to use variables in a class? And what do you mean by 'variables for in multiplayer games'?

As the old saying goes. Garbage in, garbage out. Vagueness in, vagueness out.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: Own Player variables

Postby WaterRatj on Tue Sep 25, 2012 8:50 pm

lol wasn't talking about you that was being vague :p

I know what variables are and how to add them to the game :p
Was talking about networked ones so they both are the same on server and client. (variables for in multiplayer games)
Seems easy to understand.

Have found this :D
WaterRatj
Member
Member
 
Joined: Wed Mar 02, 2011 1:45 pm

Re: Own Player variables

Postby Garrador on Tue Sep 25, 2012 9:00 pm

You should still consider spending more time with pure c++ console based applications and work from there. Makes it easier, but I will not bother convincing you more than with my previous post, as it should be enough. Its just that I can tell from some of your questions that you should really get a grasp at the concepts first.

It's great that you want to learn it, as it's great fun and all, but I speak from experience (by that I mean, I went straight on with tackling game programming, which made me demoralized quickly, because I didn't understand anything that was being done). Then I found a few complex books that went through everything in basic c++ and then some. After a few of those, and some other books that was more aimed towards a special topic, I found it much easier to start learning Source' syntax and it's way of doing things. I actually just started with it as well, but I've spent years programming (at a hobby level) with C#, C++ and PHP. Also, I started touching up on game-programming concepts (yes, game programming is one direction one can take with c++, as well as math, 3d programming, physics, economical, statistics etc etc) with XNA game lib for C#. It's much easier to handle, and will give you a great introduction to game programming without needing to use a really advanced engine. That helped a lot to have as a base.

Anyways, you should definetly do the basic c++ stuff first at least. I understand you're eager to get going with your own mod and all that, but trust me, it will be sooo much harder and much more demoralizing if you don't.

Give it some thought, and good luck ;)
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: Own Player variables

Postby WaterRatj on Tue Sep 25, 2012 9:04 pm

I will learn basic c++, reading while working on the mod.
so i'm getting to the stuff at some point, just sometimes not in the right order :p

I understand that basic c++ is better to go trought first.
But like i learned javascript,php,lua and tcl. I love to learn while doing something usefull to it.

Making a simple c++ won't be a challenge for me. won't trigger me to wanting to learn the language.

Making a custom Sourcfe mod is a very challenging project for learning c++.
But I'm also following your advise that is that I learning the c++ basic on my way
WaterRatj
Member
Member
 
Joined: Wed Mar 02, 2011 1:45 pm

Re: Own Player variables

Postby Garrador on Tue Sep 25, 2012 9:13 pm

Well, you definetly went for the challange ;) Of course, depends on what you want the mod to be / what features it will have. But why would you write a unchallanging app whilst learning basics? It's not a rule of thumb that you should do that just because it's a console app :P Console apps are like any other app, but with a different interface. You can make it as advanced as you like.

In example; write a custom stack queue (pop,push) (First in, last out principle or whatever). Write a simple text-based game that takes player input and advances the game based on those. Be creative!

By all means, do what you fell comfortable with ;)
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: Own Player variables

Postby WaterRatj on Tue Sep 25, 2012 9:45 pm

yeah, SourceSDK isn't the basic stuff :p
And guess i'm going right away for the BIg challenge :p

Thing is my head is just so full of ideas for my mod!
Everynight i sleep, more ideas and more idea just pop up.

For most I will have a way to work it in, but for few things I need more knowledge of c++ but I will get there :D

I'm looking at it positive.
For now i already have +-20% worked in the mod ^^

So thats one big reason why not wanting to spent some time to something else :D
WaterRatj
Member
Member
 
Joined: Wed Mar 02, 2011 1:45 pm

Return to Programming

Who is online

Users browsing this forum: No registered users