Some Questions

M

mOoEyThEcOw

Guest
I kinda know what I'm doing but I have some questions I still haven't been able to figure out.

First, what the hell is the proficiency level, how is it determined? (I know it affects the weapon spread...)

Second, any one have any ideas about how to create a persistent text file for multiple configurations, to be loaded into the game? (kinda like css presets but more involved)

Third, (as I'm kinda new to this more advanced c++) for the idea above, if I have this right, I need to create a .cpp file to parse the information then modify the player files to hold the information, so that I can call it in functions relating to that player?

Fourth, (I haven't really investigated this one, but) is it possible to have two weapons? like left click is primary right click is secondary (is it possible not a how to, though some hints might be nice)
 
Fourth, (I haven't really investigated this one, but) is it possible to have two weapons? like left click is primary right click is secondary (is it possible not a how to, though some hints might be nice)
you might use the smg1 for this it got primary and secondary fire, you might make and model that includes both weapons. and when you left click the left gun does its animation and right click the right gun does its animations. you might get some probs with the muzzle.
Try to sort something out I've never tried this and won't do. but good luck!
 
I meant more along the lines of halo's 2 weapon system... (you don't pick them up in game but the customization is what I want) but I understand if that doesn't work well, would it be possible to have a second 'invisible' weapon which more less just used the right click? (and could be diffrent while keeping the same primary weapon)

other questions still need answers too!
 
Well no not really, the smg has a secondary fire thats always the same, I'm talking about having a primary weapon and then having any number of different secondary weapons (and this is for every weapon). Not picked up or changed in the middle of the game, but prepicked combinations. And I really don't want to make 2 million different weapons....
 
I think he means that he wants different weapons to be combined together not like 1 model for each combination. isn't it able to make 1 model that can be controlled which models of weapons it should load ? then you can dynamicly change all the weapons in your hands.
 
i think i get it , i just watched some gameplay vids . you can definitely do it , but you will have to make extensive changes to the player class.
 
Ok, thank you! the other questions would like answers too!
 
i believe hl2 already has a config file to load up stuff like that, you might want to look into it.
 
Which question are you answering? and that doesn't help me with the first one.
 
i have no idea about the first question so i answered the second ... please do forgive me .
 
I was just making a joke about your name. I'm still really confused about what your actually asking but, and I presume this wouldnt be to hard, you could create multiple secondary fires and then once you have it for one weapon copy and paste the code for the others.?
 
The fourth question has been answered sufficiently, I would like to know about the other 3/4 of my post not the question I added as an after thought.
 
I dunno if it's as simple as just copy pasting the alt-fires into diff weapons.

The way it could work is to have your alt-fire button BOTH change to the other weapon AND fire with it (like how binding an 'alias' to a key works). This isn't a very elegant solution though. It'd be better to have a dedicated key to use for switching between primary and secondary weapons, but this would mean you couldn't fire both at the same time (i.e. how Halo does it).

The optimum solution would be to have the player able to dual wield, but I think this might require a big overhaul of HL2's weapon menu system (the select functionality part). I don't think you'd be able to simply just edit it to fit. You'd also need to have more than one model+textures+animations on screen, so the models may have to be lower detail to compensate for double the strain. Plus I don't know just how tricky it would be to change HL2 so you can fire 2 on-screen weapons independantly of eachother.

Add to this the fact you'd need to be able to scroll through different weapons independantly and therefore overhaul the GUI side of the weapon menu interface, too. If you have it like Halo, where you can only wield 1 of each type, it solves the weapon selection problem, at least.

Dunno how difficult all of this is to program, I'm just giving ideas for possible workarounds based on my limited knowledge of how HL2 works. It sounds like quite a lot of work.

--
If you really desperately wanted to have 2 weapons on-screen, I think a compromise would be to have fixed combinations. This would reduce the personalisation aspect, but would make it a lot quicker to code. E.g. you can swap between Sniper+Knife and Shotgun+Uzi or Assault Rifle+Pistol. This way you would just create two weapon models but have the game treat them as one 'weapon'. Primary fire would be the left hand and secondary fire would be the right hand.
 
Thank you very much for your response, but...

I have already solved this issue the question was originally an after thought, I would like my other 3/4 of the post answeared not the one I already solved.
 
Thank you very much for your response, but...

I have already solved this issue the question was originally an after thought, I would like my other 3/4 of the post answeared not the one I already solved.
Care to share how you solved the 4th question?
 
heh , i didnt even think about the weapon selection , i guess that adds all kinds of problems . im really thinking of working on this one just as an experiment.
edit: probably closed his eyes and willed it to happen :p
 
Well it depends how you define 'fix' its fixed for one because I realized I can get around the problem that caused me to need it in the first place... BUT:

...I figured because I wanted pre-user-made combos, I would just make a function in the weapon_hlmpbase that would use a variable to determine which secondary attack to use, so that all weapons inherited it...

but that was just my plan before I realized it wasn't needed

But I still want help with the other 3 questions!!!!!!!!!!!!

Most specifically: How to create, read, modify, and delete multiple (not for diffrent users or servers, but for diffrent 'builds') persistent configuration files, from in the game (they are made by the user). e.g. the css weapon fast buy system, where each fast buy option is a diffrent file.
 
did you read my post?
e.g. the css weapon fast buy system, where each fast buy option is a diffrent file.

as in the system in css where you buy items click the save button and then when you click that option again it buys all the same items... and there are 4 options... (<-thats the fast buy system)

except I want a diffrent file for each configuration, and with many more options, this configuration will be used to create the player's "class" and will hold info about how they spent their "points", so this will be read each time they spawn...

(must I continue with MORE examples...)

e.g. if a player makes a "class" and saves it, it will be saved as a file in a 'config' folder... to be read when ever the player uses it or edits it, and to be changed when ever the players is in the "class builder".

e.g. tf2's new item system, except each class has its own config files and you make more then 9 and customize the weapons more....

e.g. (if you've ever played it, it's a steam game, has a demo and free play time for an hour on Saturdays...) Threadspace hyperbol's ship maker, where you can change everything about the ship as long as you keep the same number of points as evrey one else (kinda dumbed-down, but thats the general idea)

I only really need help making the files, reading them, editing them, and deleting them from with in the game, I can do the game's changes and menus and stuff myself....
 
Looking back on it maybe it was a bit rude... but I'm kinda getting annoyed with this asking for help thing in general (I've posted other places). Everywhere I post people focus on the fourth question, the one I added as an after thought! When the one I really wanted help with were the other 3, and expected a quick answer on the first one. It's really starting to bug me.

But you haven't exactly been kind yourself:

I'm beggining to wonder how old "mooeythecow" is.

And finally people not reading things is a pet peeve of mine, I hate when people read half or part of something, or completely ignore something and it annoys me to no end.

So I'm sorry about being rude, but people continue to ignore me when I say "Ok thank you so much for answearing question 4!! The other questions need answers too!" and eventually "Thank you but question 4's allready been answeared, the other ones still need answers though!! (Which is pretty rude to ignore some one like that 4 or 5 times in a row (not here) and continue giving advice on the fourth one... even after I remove it form the original post...)

And the only response i've gotten has been from this website... And it was really vague and I looked into it (while having no clue what I was looking for) and found nothing...
 
It was a light hearted joke, come on. anyway I dont want to spam your thread but to be honest your gona get vague answers when your asking complicated questions. did you expect someone to write an entirely new weapon system for you?

Anyway the only person who really checks these forums and is experienced with source coding is mindless_moder but hes on holiday as far as I know.
 
*sigh* (I want to say did you read my posts... but) No I don't expect them too write me a new weapon system, BECAUSE IT'S ALREADY BEEN ANSWERED SUFFICIENTLY 37 (yes I counted) TIMES!!! it was the fourth question that I added as an afterthought! And when I say:
"thank you now could you help me with this?" people seem to ignore me...

All I want help with now is (AND IT HAS NOTHING TO DO WITH DUAL WEAPONS, OR EVEN WEAPONS FOR THAT MATTER!!:flame:) is creating, reading, editing, and deleting persistent files from within the game... just a couple pointers would be nice, I'm not asking for an entire block of code (though it would be nice :E)

And for that matter it can't be too complicated... every source game seems to be able to do it in one form or another...

(sorry if I come off as angry, BUT I AM!!! It has nothing to do with this forum specifically just all four threads I made altogether are getting on my nerves... In fact this forum has been the most useful btw!)
 
lol it might be just cause we aren't well versed enough with hl2 coding, I can barely code my way out of a paper bag (or in other terms I can only go so far as to code a mod so reliant on inheritance it's practically plagiarism :D)

are you signed up for the hl2coders list?
 
Well I did try to answer this question before, hl2 uses cfg files I'm not sure how they work but they do contain initialization information.
anyways if you want to implement a dual weapon system ........ hehehhe just kidding :p . If you want to roll with your own config system you have to first decide on a format for your information, two things to think about are HEADERS and DELIMITERS.
Headers: are used to tell your program important information about a file for example the number of lines in the file (including the header), the context in which the file applies etc.
Delimiters: are used to separate data in a logical manner for example to denote the end of the line or to group data.

For example you could write a small file like this

Code:
//6 as in 6 lines ? this will help in initializing arrays . 
Player

Name = "blah" 
Health = 100
Inventory = [3, gun, sword, hammer]

Reading this would be fairly straight forward. You read the file line by line and then parse each line looking for keywords and delimiters that you have defined, for example when you hit a "[" you know that this is the beginning of a group, I have formatted it in such a way so that the size of the group is the first element this way you can declare an array of that size to store the items in the group for the inventory. after reading the "[" character you parse characters until you hit a "," and then store that as the 0th element, continue that until you hit the "]", it's as simple as that.

Writing a parser is a lot of work, but it's also a learning experience. If you format the file in an intelligent manner then you shouldn't have trouble parsing it. If you don't want to bother with all that you can write your config file in xml and use one of the many xml parsers out there (i suggest tinyxml ). Parsing and file reading can take up a lot of time , to speed things up you need to be consistent with the format you're writng the file in , that way you can form a specific algorithm to read and extract the data, another thing to be careful with is error handling since its a config file nothing can really proceed if there is an error in the file.

C++ like many other OO languages has a few nifty little object for handling file I/O they are located in the iostream library , I'll leave it to you to actually look these up and understand how they work (this might help http://www.cplusplus.com/doc/tutorial/files.html). If you want to deal with multiple files you will probably want to maintain one master config file that contains the names of all the sub files and their count, you can then show the user the contents of the master and load each file respectively based on which one they choose. Now this is all well and good until you realize that your user could probably just open up one of these and change their details , this may or may not be in your favour , if you don't want them to tamper with them you can use a basic encryption algorithm to encrypt the data with an appropriate key.

Ok now for actually changing the player , I would suggest wrapping up the whole parser in a nice little cpp class , call it something like "cfgLoader" now in the constructer of the loader have it take in a pointer to the player that you want to configure and the name of the master config file . Then make a function called "Load" this will do all the fancy parsing and at the end it can call an internal function called "Configure" that will configure the player accordingly since you've given it a pointer to the player.

edit: i dont really play css so when you talked about the presets i thought you were talking about weapon binding that was quite popular in 1.6 . sorry about that .

edit2 : i realized that i didnt talk about deleting or editing , you should be able to find out how to delete a file through some c++ reference site it doesnt come to me at the moment , for editing you might want to consider creating a struct that holds all the player config info and then dump that when you're writing , editing is the same as writing as you cant really edit single lines of a file , you have to rewrite the entire thing . you will also have to look itno a gui to allow the player to edit values and stuff like that , cant say that i know much about that sorry .
 
THANK YOU!!! YOU ARE A GOD!!!! *bow* *bow* *bow* THANK YOU! THANK YOU! THANK YOU! THANK YOU!

Ahem anyways I'll post my progress so any one else who wants it can get it.. and I might still have a question or two... but THANK YOU!!
 
heheh no worries mate . you have some really interesting features , i think i'll chime in and code up some of these when i get back from vacation . btw if you get it in any usable form make a lil post in the hl2.net wiki , i want to start up a lil dev corner and maybe whip this place into shape.
 
The features your seeing from this is just the tip of the iceburg! (by the way my major inspiration was a mix of threadspace hyperbol and tf2)

But anyways... if I implemented tinyxml... would I put it in just the client or both? (this is another major thing that always confuses me) because the client is the only one reading these things... once its passed to the player... the server gets it right? (networking in c++ is not a strong point of mine, this is my first attempt at a multilayer mod of source, I've done some single player stuff though)
 
would it be easy to create a new player class? i.e. a hl2ct_mpplayer? as it would be easier to implement this if I could just overwrite the old functions instead of trying to get the data to all the earlier classes... or am i being stupid and missing something here?


anyways my current plan:

the game starts:

the master list is refreshed (each file is checked to see if its in the master list, if its not it adds it after checking the math)

my mp plan is:

a person joins a server
the game looks up the build's names and points on a 'master list'
they pick a 'build' to spawn as
the local machine does the math to make sure its ok
they spawn
the 'build' is sent to the server which again checks the math
if its ok the server implements the values for that player

and when they make it themselves:

load or create a file
display properties (to a vgui panel)
they make a change
the local machine does the math and recomputes a value
they save it (therefore the game does too) and if its new is added to the master list


(when i say doing the math i mean that the computer takes each value (enumerations) figures out their value and then adds it up to a 'point total' which is then saved to the file for fast look up. Different servers will have diffrent point limits) this method will make it so cheating in the file doesn't matter

sound good?

edit: btw I forgot to mention this earlier, but fstream, ofstream, and ifstream are not defined variables or classes... atleast with cbase.h is there another header file I need? (I've been mucking around with the vgui) and I've decided to write my own parser as tinyxml likes to barf at me (i.e. give me a thousand and one errors) in source.... and it's a learning experience.
 
you need these
#include <iostream>
#include <fstream>
(it was in the tut i linked to :S ) .

you lost me again with all that "build" and "point" talk , i think i'll just go through it with you on IM lol .

edit: just found out hl2 has its own file system (which makes complete sense) , heres some info on it http://developer.valvesoftware.com/wiki/File_System .
 
iostream.h and fstream.h cannot be found according to my compiler (i already tried before you posted)
 
Hey I have some networking question, as I still don't fully understand it:

Ok so I have a struct that I can now read files into. So now I need to get the struct into the player, and from there into the server's version of the player, so heres my first question: how can I network the struct? Am I going to have to break it apart and the 'reassemble' it on the other end? And for that matter: If I want the client to get the actual structure first THEN send it to the server how would I go about that? Is there some way to get the client to read the variables and just send it directly to the server? (as the client doesn't truly need to know all this) or I could just do it in the shared files?

You know what? I'm more confuzzled than before...

Ohh and for that matter: What is the relationship between hl2mp_player, c_hl2mp_player and hl2mp_player_shared? are they friends? (more specifically the shared) is it contained in both? (again realize I'm rather new to this multilayer coding thing...)
 
Back
Top