Mod Creation From Scratch Created 9 years ago2014-08-13 22:39:39 UTC by Tetsu0 Tetsu0

Created 9 years ago2014-08-13 22:39:39 UTC by Tetsu0 Tetsu0

Posted 9 years ago2014-08-13 22:45:11 UTC Post #321157
So I've always wanted to make my own game, and It's time I felt I'm able to do so.
I have ONE more class left to take before I get my degree, so I'll have some more time to dedicate towards my goal.
I have a firm grasp on Level Design with Hammer
I've been using 3DS Max on and off for a few years and I feel comfortable making props (weapons will need to be learned)
I've taken two C++ courses, and I have coded C regularly at work over the past 4 years.

This thread will serve 2 purposes.

1 - Learning for others
  • I want to tell people of my experiences and hopefully teach anyone who reads this
2 - Learning for myself
  • I'm hoping that some people have gone through what I will go through and might be there to help me along the way.
I've created a Word Document with the steps I've taken so far, and links to helpful websites. I hope I'll have the discipline to update that as I go along, as I'm sure It'll be a helpful learning tool for everyone once it's complete.

Mod Description
Close-Quarters Multiplayer Foam Dart Combat


I've always had a lot of fun with NERF(c) guns, but I've never had a lot of people to legitimately shoot and play with. I was thinking of making a simple shooter that uses foam darts as ammo and points are accumulated by non-lethal hits and completing level objectives like capture the flag or hack the mainframe(lol).

Each round, every player will start with the same Weapon: a single-shot dart gun. You have 10 darts (with one in the chamber upon spawning) and you're required to reload after every shot.

Darts will travel slow, and will have significant drop. Once darts impact ANYTHING (players or otherwise) they will become a pickup,

Players use points to purchase better guns that hold more darts, require less manual reloads, fire farther, and more accurately.

Players have a Hit Point pool of +/- 3. Players will warp to spawn when depleted, and will need to wait a specified cooldown time to regenerate points before returning to the arena.

More powerful weapons take more of your hit pool off, and headshots will count as double.

Weapons / Damage
Single-Shot Pistol - 1
6-Shot Revolver - 1
Double-Barrel Shotgun - 2
Single-Shot Sniper - 2
Semi-Auto SMG - 1
Full Auto SMG - 1

Levels will include Offices, Playgrounds, Houses, Schools, bumper to bumper traffic jam.

My mod has already been created, and I have created weapon models, foam dart models, and have access to the source code.

[b] First Milestone Goal[/b]
  • Create Single-Shot foam Dart gun that shoots foam darts.
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-08-13 22:55:41 UTC Post #321159
Sounds Really cool! I've played a paintball mod that reminds me of this.

This is for gold source?
Posted 9 years ago2014-08-14 00:39:17 UTC Post #321161
This is for Source 2007.
So steps I've taken so far:

:hammer: Download Source SDK
:hammer: Create a Mulitplayer Mod with Source 2007
:hammer: Run Game to download source code
:hammer: Download Visual Studio 2010 (FREE!)
:hammer: Open Source Project
:hammer: Tried to Compile and failed :pwned:
:hammer: There are missing pieces of code! A compile will result in an error unless you have these:HERE THEY ARE
:hammer: There are also some fixes you need to apply HERE and HERE

End of night progress - Code compiles. Victory
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-08-14 06:31:10 UTC Post #321167
I always had the itch to make something similar myself but alas, lacking any kind of programming knowledge...And whatever i may have learned in my student years, has been long forgotten :P
Good luck and keep us updated, this should be interesting to see where it takes you!
Posted 9 years ago2014-08-14 06:44:49 UTC Post #321168
I really hope, you can explain how source coding works. Ive always really wanted to code for gs or src, but the lack of OOP knowledge i could never understand how it all comes together :(
rufee rufeeSledge fanboy
Posted 9 years ago2014-08-14 20:57:42 UTC Post #321195
I've ran into a few SNAFUS last night. Including a shifty debug compile that almost brought my computer to its knees.
I'm keeping a journal/ log / instruction manual of all the issues i've ran into thus far.
Included in the manual is the steps taken to resolve the issues and then some links for more information.
I really hope, you can explain how source coding works.
Rufee, As soon as I gain some insight into that i'll let you know. I've been trying to figure that out as well. I can't find any 'main()' function that calls things, but I do think entities are called and processed in ticks.
I haven't found the 'tick' command origin yet however.
I'm still running through some of the coding tutorials - and I haven't played a successful compile yet... It'll all come together in time.

Just didn't do a debug compile and everything worked just fine!
Only problem I need to sort out now is that I need a red_team spawn and a blue_team spawn.

I'll probably have to copy the info_player_start and info_player_deathmatch information.
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-08-15 08:28:18 UTC Post #321208
@tet: I'm not entirely sure how Source is structured but I would guess that the main function and the game loop are both part of the closed source portion of the engine client.
Penguinboy PenguinboyHaha, I died again!
Posted 9 years ago2014-08-15 11:41:40 UTC Post #321211
Obviously the main() is somewhere in hl2.exe which is closed source. Anyway i know the basic idea, ticks are simple enough to understand, but everything else is quite a mystery to me. Waiting on you tet :)
rufee rufeeSledge fanboy
Posted 9 years ago2014-08-15 16:59:53 UTC Post #321215
I'm waiting on free time rufee :) I somehow found 4 hours on Wednesday to work out all the kinks and get the initial compile working. I'm not sure when I'll have another solid block of time like that.
Anyway, my next step is modifying the pistol code to launch a foam dart.
I'm assuming i'll have to do the following:
1) get player view vector
2) spawn a dart in front of player
3) give an initial velocity to the dart based on view vector
4) simulate dart like a slow moving rocket
5) create a physics model of the dart upon impact so it bounces / rolls /falls after a collision
Valve has some good documentation on this: https://developer.valvesoftware.com/wiki/Projectile_based_Weapons
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-08-20 23:15:48 UTC Post #321299
Having some issues with multiplied references and such.
I'm just trying to copy the weaponpistol code.
At first i needed a weapon script, which I got, but there seems to be more to it.
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-08-20 23:20:18 UTC Post #321300
Code makes kitteh scart.. :o Major props for doing this sir!
Captain Terror Captain Terrorwhen a man loves a woman
Posted 9 years ago2014-08-21 01:07:12 UTC Post #321301
I figure most people don't code because they run into problems like this. I'm gonna make notes on how to fix everything.
Here was my main error for anyone who experiences the same issue:
3>.Release_sdkClient.dll : fatal error LNK1169: one or more multiply defined symbols found

EDIT!
Woohoo! Figured it out!
I added something somewhere that i wasn't supposed to. During one of the tutorials, I thought i was supposed to add:
STUB_WEAPON_CLASS( weapon_pistol_dart, WeaponPistolDart, C_BaseCombatWeapon ); into the clientmode_sdk.cpp file. I commented that out and it works fine! even sending the command give weapon_pistol_dart works and i get ammo equipped.
EDIT 2
I'm a total noob and found the script files in the sourcemods/dartfight/scripts folder.
Copied weapon_pistol to weapon_pistol_dart, modified a few things and now i'm golden!
User posted image
It also seems that I don't have info_player_deathmatch entities in my FGD.
I have to attend to that.
I might just make info_player_red and info_player_blue spawn points - but then i'll have to learn how to assign teams to them. hmmm

Also, I've mentioned this before
I'm assuming i'll have to do the following:
1) get player view vector
2) spawn a dart in front of player
3) give an initial velocity to the dart based on view vector
4) simulate dart like a slow moving rocket
5) create a physics model of the dart upon impact so it bounces / rolls /falls after a collision
The crossbow and crossbow_bolt code do this already. I just need to copy it for my needs.
And in my research of that, It seems that I started down the incorrect path by copying the pistol code.
Oh well.
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-08-23 14:17:41 UTC Post #321373
I was a bit disappointed to find that there weren't any "red team" and "blue team" spawn points in the initial FGD. I tried to make a test map for my Mod, but I could only join the spectator team. I think I need to create team spawns myself.

I read a tutorial on the VDC on how to create a logical entity - I learned how the FDG links entities to the code. So I decided to tackle this myself and just read the code.

I found the RED TEAM and BLUE TEAM code in the sdk_gamerules.cpp file.
In there is the pre-defined link to the FGD.
[quote]
#if defined( SDK_USE_TEAMS )
LINK_ENTITY_TO_CLASS( info_player_blue, CSpawnPoint );
LINK_ENTITY_TO_CLASS( info_player_red, CSpawnPoint );
[/quote]
So if we're using teams, use info_player_red and info_player_blue.

I did some snooping and found the base FGD code for The T and CT teams from CS:S. I'm hoping i can just copy that and modify it to suit my needs.
//--------------------------------------
// Copied from CS:S FGD
//--------------------------------------
@PointClass base(Angles) studio("models/player/ct_urban.mdl") = info_player_counterterrorist :
[
]
So in looking at the CS:S Player start definition, there's no other code that needs to be written, because the "Angles" is the only field that matters. We're inheriting that already because our base class is already "Angles". When placed, it'll use the ct_urban model.

I just have to copy mine to use the (included) red_player and blue_player models, and link them to the info_player_red and info_player_blue classes.

My red team spawn FGD code:
//--------------------------------------
// RED PLAYER SPAWN
//--------------------------------------
@PointClass base(Angles) studio("models/player/red_player.mdl") = info_player_red : "Red Spawn"
[
]
I modified that for the blue team as well.
I saved and then loaded up the SDK Launcher, and Hammer.
IT WORKED!! :biggrin: :biggrin: imgur
User posted image
I placed red-ish and blue-ish overlays beneath the spawn points to make sure read spawns in the red location and blue spawns in the blue location.

Saved, Compiled, Annnnnd It works!!! :walter: :hammer:
User posted image
Victory
EDIT
I was also getting an error in HL2 saying there was no info_player_deathmatch. I added on into the FGD and set the model to models/editor/playerstart.mdl
Works like a charm, and no errors anymore!
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-08-24 14:42:48 UTC Post #321395
Oh you reminded me of the ventures i took once in the SDK and teams were one of them.

Personally i very dislike the idea that you can do a lot of stuff by just copying the code and modifying it, but that's a personal trait that i have, i just hate reusing code. My every php project is from scratch even if its a similar thing, it does open up improvement and problem fixing opputunities, though that slows down develoment a bit.

Btw Tet you should write a new book :)
rufee rufeeSledge fanboy
Posted 9 years ago2014-08-26 00:21:32 UTC Post #321401
Until I get more comfortable with the code, I'll be copying and pasting.
All of the stuff I want to do has been done before. So I just need to find where the code is and modify it for my needs.

I'm writing a book to go along in my adventures.
Not for publishing, but for the general public.
EDIT
I found a crapload of tutorials and tools for making models for HL2.
Unfortunately, they require 3DSMax 2012 and I have 2015. But Thanks to Autodesk's wonderful dedication to students, I'm currently downloading 2012.

I'll whip up a model and see if i can get everything working.
EDIT 2
I guess there's no such thing as whipping up a model. I'm having a bear of a time setting up any of the community model compiling tools. They all return the same errors and no models pop out. I'm going to go the hard way and write batch files. I got the basics set up so now I need to get it all working.
EDIT 3
Successfully compiled 2 models tonight; a test box and a foam dart model.
Next step is to have the Deagle spawn the dart!
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-09-04 17:05:51 UTC Post #321630
SNAFU #42
SOURCE needs one of these: Code Map

In other news I'm going to try and convert the Handgrenade into a throwable dart. The grenade code covers spawning of objects, launching at a trajectory etc.
The grenade projectile handles collision and damage dealing upon colliding with a player.

I kept trying to play with those but it's throwing a mass of compiler issues at me.

Holy headache batman!
I'm not giving up though!
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-09-04 20:34:12 UTC Post #321634
Yeah honestly from my experience you have to suffer and get through it in the coding side of things.

Source wasn't a purpose build engine for modding like UT or Unity is, it just came out that way and built upon gs reputation.

If i knew how to code for source so much math and sh*t could be applied to make everything look outstanding (dreams to make a mod exclusive to Oculus)
rufee rufeeSledge fanboy
Posted 9 years ago2014-09-05 10:31:23 UTC Post #321635
Yeah. Skimming the code it looks as if it was commented as an afterthought. There's even references to HL1 code from what I can gather.
My lack of coding experience isn't helping much, but It's very hard to figure out what links to what, and why my errors are actually errors.

I might have to dig deeper to find some more guides. It's very frustrating spending 45 minutes solving one compile error when I'm getting bombarded with 20+.

If I don't make significant progress by the end of September, I'm going to download the Unreal 4 Source code and see what mess I can make with that.
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-09-05 13:23:42 UTC Post #321636
Aw I want to code so bad now, I just need someone to hold a gun to my head for 2-24 months, OR, trap me on a deserted island with a computer, coding books, and nothing else :)
Captain Terror Captain Terrorwhen a man loves a woman
Posted 9 years ago2014-10-05 17:08:42 UTC Post #321941
If I don't make significant progress by the end of September,
Did you?
Posted 9 years ago2014-10-06 11:30:26 UTC Post #321957
UPDATE!

Thanks Stu

I already Explained all this to Dim[s]bark[/]beak..

I got custom guns working, I got player spawns working, I got custom entities working. I did not however get custom projectile guns working. I couldn't figure out all the links between headers and source files and etc. I've heard this before from Don Punch back when Mist of Stagnation was on the Source engine; the code is an absolute mess.

So my quote about the end of September was a lie, because I did the following around mid September:

I bought a license for Unreal 4 ($20USD) and started playing around with it... I had the Dart model imported in 10 minutes.. Had a physics model built in another 5, and scripted a blueprint (in-game-code) that spawns a dart model with an initial velocity...
I had made more progress in 1 hour with the Unreal 4 toolkit than I did in 3 weeks with Source.

Then school started and I got slammed at work and I found a game called warframe...

Unreal has a fantastic tutorial base, fantastic asset library ( for free) and it's built for modders, and it's super pretty.

Honestly I might just consider this a failure and keep on keeping on with Unreal.
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-10-06 11:48:00 UTC Post #321958
That sounds pretty cool, if I wasn't busy with other stuff I would definitely look into the UE4 stuff.
Penguinboy PenguinboyHaha, I died again!
Posted 9 years ago2014-10-06 14:40:23 UTC Post #321961
I gotta see how to create a standalone EXE.
I'll have to make a simple little game and release it for you guys.
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-10-06 18:22:38 UTC Post #321967
Will you still post your antics in it?
Posted 9 years ago2014-10-06 19:55:28 UTC Post #321968
On the unreal development or all my issues during the source stuff?
Also... Some bad news.
Unreal 4 [blue]requires[/blue] a 64-bit processor. So everyone stuck in the 2000 decade is out of luck :(
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-10-07 06:23:38 UTC Post #321973
Everything after 2006 supports 64bit so all you peeps with 2 cores can run it.
rufee rufeeSledge fanboy
Posted 9 years ago2014-10-08 13:03:37 UTC Post #321992
Assuming your OS is 64-bit, rather than just your processor.
Notewell NotewellGIASFELFEBREHBER
Posted 9 years ago2014-10-08 13:39:12 UTC Post #321993
I'm so glad everything is moving up to 64-bit. Managing a 32 bit project with a 64 bit one is annoying. Far too many 64 bit dll's still have 32 in their names. >_>
TheGrimReafer TheGrimReaferADMININATOR
Posted 9 years ago2014-10-08 19:03:15 UTC Post #321996
How silly.
Posted 9 years ago2014-10-09 15:23:46 UTC Post #322005
Yeah so right now i'm focusing on building a game from the ground-up.
Working on reading keyboard inputs and such. Assigning them to actors.
I'm going to make a simple game before i try anything else.
The nerf game would be simple - set up game rules, get networking working etc etc...

I kinda got tired of the idea after trying for so long on it.
Most of the work would be modelling, texturing and level design.

Maybe we can make a community project out of it?
Make some models, make some textures... I can honestly just map in hammer, export to a model and import straight to Unreal.
Tetsu0 Tetsu0Positive Chaos
Posted 9 years ago2014-10-10 02:36:52 UTC Post #322017
I've been messing with UE4 as well these past few months. Nothing worth posting, imho, just messing around with blueprints and vehicles mostly. Unreal is great on so many levels, no doubt about that, but until you learn it inside-out it can surely act like a diva... I had a hell of a time trying to create custom rain, something that would take seconds in gs/source, sigh...
Tetsuo, you should post texture progress if you ever get around it. It'd be interesting to see start->end results and could definitely learn something from it! :)
Posted 9 years ago2014-10-10 13:03:10 UTC Post #322026
Absolutely.
I'll make another thread just with unreal.
I've only glanced over everything i've dealt with so far. So you're definitely right - unless you know it, it's almost impossible to get what you want out of it.

The more i play, the more i learn, but i'm far from an expert in any aspect of the editor. There's SO MUCH to do.

I like the way unreal has done some of their textures. They're really spread out and simply laid out. Maybe my first to-do will be simple texture creation..

I might figure out how to do all this in blender since i'm not going to have 3DSmax forever.
Tetsu0 Tetsu0Positive Chaos
You must be logged in to post a response.