June 14, 2008

Viper Woes

Written by theY4Kman at 9:51 pm under Viper and Python

I have a small blog post for ya, but it’s mostly for my sake. I made some very stupid mistakes over the past week with Viper, and I wish to share them with you (and archive the solutions for when I inevitably make them again).

First off, I had this code to create ConCommands:

pCmd = new ConCommand(new_name, CommandCallback, new_help, flags);

It took me around three or four days to realize I wasn’t registering pCmd. I slipped in META_REGCVAR(pCmd), and it works beautifully :D

Secondly, and lastly, I had consistency issues with paths. Windows is very annoying because it uses backslashes instead of forward slashes. This means that I have to escape every directory in a path. Thankfully, Python accepts both forward and back slashes in paths. However, a trie a does not. I had a lot of trouble determining why Viper couldn’t recognize which plug-in called Register (that function finds the path of the script which called it, looks it up in the trie, then updates the plug-in’s info). After a lot of searching, it finally dawned on me that the path entered into the trie and the path from Register were different. You can thank my shotty eyesight; I had printed out the two paths into the console and still couldn’t see any differences for the longest time :P

April 20, 2008

ConVar Manager Update and more!

Written by theY4Kman at 10:06 pm under Viper, SourceMod and Programming

Last night and today I worked on finishing the ConVar manager, which I did actually complete! All convars created inside of a plug-in are added to the ConVar manager’s internal database (A Trie) and the plug-in’s convar list. Tomorrow I’ll work on adding a “cvars” option to the Viper menu, which will be accessed with “sm py cvars”. I’ve created a test plug-in to create many ConVars, which successfully created every single one, and was able to retrieve the value from each; each convar was declared as a different type of data (Float, int, string, etc.), and retrieved by each type, so as to test my error checking, also.

There is one problem, though: If you create a convar from the console by using the Python interpreter command I’ve created, “py”, it does not work. The Python convar object is created, so you can call functions on it and the such, but the Source ConVar class instantiated through “new ConVar(name, defaultVal, …)” equates to NULL when accessed. The chain of command is this:

  1. On the Python side, the user creates a convar object
    convar = console.CreateConVar("a_name", "a_value")
  2. CreateConVar does some simple error checking (Making sure the name isn’t blank, etc) and calls New_ConVarObject, then Init_ConVarObject. I’m going to showoff here and present the code of this:
    static PyObject * Console_CreateConVar(PyObject* self, PyObject* args, PyObject *keywds)
    {
    	char const *pName, *pDefaultValue, *pHelpString = NULL;
    	int flags = FCVAR_PLUGIN;
    	float fMin = NULL, fMax = NULL;
     
    	static char* kwds[] = {"name", "value", "desc", "flags", "max", "min", NULL};
     
    	if(!PyArg_ParseTupleAndKeywords(args, keywds, "ss|siff", kwds, &pName, &pDefaultValue, &pHelpString, &flags, &fMin, &fMax))
    		return NULL;
     
    	if(pName[0] == '\0')
    		Py_RETURN_NONE;
     
    	Py_XINCREF((PyObject*) &console_ConVarType);
    	PyObject* ConVarObj = (PyObject*) console_ConVarType->tp_new((_typeobject*)console_ConVarType, args, (PyObject*)NULL);
    	ConVarObj->ob_type->tp_init(ConVarObj, args, (PyObject*)NULL);
    	return ConVarObj;
    }
  3. New_ConVarObject just sets the values of the object. Nothing to see here.
  4. Init_ConVarObject does all the real work for the Python side: error rechecks (Just in case :D), creates the ConVar (Through the ConVar manager), and does some work after the ConVar object is created.
  5. The ConVar manager does all the real work on the C++ side:
    static int console_ConVar_Get(console_ConVarObject *self, PyObject *args, PyObject *keywds)
    {
    	char const *pName, *pDefaultValue, *pHelpString = NULL;
    	int iFlags = 0;
    	float fMin = NULL, fMax = NULL;
     
    	static char* kwds[] = {"name", "value", "desc", "flags", "max", "min", NULL};
     
    	if(!PyArg_ParseTupleAndKeywords(args, keywds, "ss|siff", kwds, &pName, &pDefaultValue, &pHelpString, &iFlags, &fMin, &fMax))
    		return -1;
     
    	// Make sure the ConVar has a name. teame06 would be dumb enough to make a ConVar with no name, which is why I add this check in!
    	if(pName[0] == '\0')
    	{
    		PyErr_SetString(PyExc_ValueError, "cannot have a blank ConVar name.");
    		return -1;
    	}
     
    	CPlugin* pPlugin = g_VPlugins.GetPluginByPath(GetCurrentPath());
     
    	if(pPlugin == NULL)
    	{
    		PyErr_SetString(PyExc_StandardError, "error in accessing the plugin.");
    		return -1;
    	}
     
    	self->info = g_VVars.CreateConVar(pPlugin, pName, pDefaultValue, pHelpString,
    				 iFlags, (fMin != NULL), fMin, (fMax != NULL), fMax);
     
    	if(!self->info || !self->info->pCvar)
    	{
    		PyErr_SetString(PyExc_StandardError, "error in creating ConVar.");
    		return -1;
    	}
     
    	self->info->handle = self;
    	self->convar = self->info->pCvar;
     
    	printf("Convar '%s': '%s'\n", self->convar->GetName(), self->convar->GetString());
     
    	return 0;
    }

Anyways, I’m getting way too technical now. Nobody understands me. I’ll go cry in a corner.

The “and more!” is that I added ClientCommand and FakeClientCommand to the Client object. I’ll work on the Client object tomorrow, too; it needs Kick and Ban. Now, off to workout and bed for me!

April 19, 2008

ConCmd/Var Manager Deadline

Written by theY4Kman at 10:11 pm under Viper and Programming

Today, I set a deadline for the console command and variable managers. I was to finish the pair in around 3 hours, beginning at 3pm EST. It worked very well for around an hour, until I had an urge to play Team Fortress 2, for which I paused development, played for an hour, and pushed the deadline ahead another hour. The time I spent developing Viper was extremely productive, compared to my regular barely-work-lots-of-play schedule, which wreaks havoc on my development and school work :P

The results of it were, well, okay, at best. However, the so-so results were caused by fixing compiler errors, not from lack of work. I had much trouble with the py_console files. For example, recent compiling brought forth new errors to py_console.cpp; first off, there was this:
'console_ConVarType' : redefinition; different types of indirection

Then, this sprung up:
C:\coding\hl2sdk\public\tier1/utlmemory.h(102) : error C2129: static function 'int console_ConVar_Get(PyObject *,PyObject *,PyObject *)' declared but not defined

It made absolutely no sense, for many reasons:

  1. utlmemory.h is not directly included from the file I suspected was causing the error (py_console.cpp)
  2. utlmemory.h is part of the HL2SDK, and should have nothing to do with my Python files
  3. Sawce loves Rukia!

I’ll be working on it tonight, and hopefully it’ll be committed working by the time I hit the showers.

March 22, 2008

Call of Duty 4 Update

Written by theY4Kman at 2:08 pm under PS3 and CoD4

Just recently Infinity Ward released an update to Call of Duty 4: version 1.20. I was ecstatic to find it, and couldn’t wait to get on. When the downloading and installing finally finished, I trembled like a rabbit facing a 12-gauge as the game loaded. Upon entering multiplayer, I found that the game mode Oldcore is gone. AAAAHHHHH!

Oldcore is Hardcore (No HUD, less health, slower regeneration) Old School (No classes, higher jumping, pickups), and it was the absolute best game mode there. And they removed it! They killed Oldcore! YOU BASTARDS!

However, they did add a few things that I like. For example, you can now mute people in-game. So no more mic-spamming! I honestly don’t understand why developers don’t include this from the get-go. Anyways, they also optimized server selection, upped the bandwidth standard for 18-player games (No more lag :D), added chase (third-person) cam for spectators, and added better kill cams (For grenades, RPGs, M203 nades, etc).

February 11, 2008

Celebrate Black History Month with some HAND PICKED cotton balls!

Written by theY4Kman at 2:13 am under Funny and Awesome

cotten-balls2.jpg

I think we have a winner

January 11, 2008

I SAID PINCH HIS TITS!

Written by theY4Kman at 9:18 pm under Funny, Awesome and Video


Awesome.

November 27, 2007

CD Players

Written by theY4Kman at 4:52 pm under Reminisce

It seems only yesterday that CD players were the device to have, and “mp3″ was just a typo of “MP5″. Pause and glance around a bit and you’ll find cell phones, iPods, laptops, tablets that all play music. We’ve come a long way since 8-tracks, but it hasn’t been a picnic. So before we get lost in the new wave of music players (I’m hoping the standard will be Vorbis), I’m gonna stop and remember a bit of the [shitty] past.

It’s Monday morning and I’m testing out my brand new Sony Walkman CD player, complete with “The Wall”, by Pink Floyd. I strut onto the bus, feeling so cool as I deftly handle the hot, new gadget. Sitting down amongst the ever-so-faint “ooohs” and “aaahs”, I switch it on, fix crap headphones on my head, and while away the trip to school to Comfortably Numb.

*BUMP* *SKIP*

Fuck.

November 17, 2007

Project Origin Trailer

Written by theY4Kman at 12:29 pm under Project Origin, Video, PC, 360, Review, PS3 and Games

I found, through StumbleUpon, this gameplay trailer for Project Origin, the sequel of F.E.A.R. and wanted to share it with you! It runs for eighteen minutes and demos the beginning of the game, I presume. The graphics look splendid, accenting the naturalism throughout the game. One’s ability to interact with many of the world’s objects creates a sense of control, which is the basis for great replay value (Well, that and lots of gore). Did I mention it has lots of gore?

Project Origin is being developed by Warner Brothers Interactive Entertainment. It’s still the same people who worked on the original. WBIE purchased Monolith Productions and are now flaunting that they will be releasing the next F.E.A.R. The reason the game has been titled “Project Origin” is because Vivendi, the publisher of the original F.E.A.R., has a trademark on “F.E.A.R.”

If you liked the video…don’t get too excited. The game doesn’t have a set release date, but it will come out in 2008.

November 9, 2007

Call of Duty 4

Written by theY4Kman at 11:57 pm under PS3, CoD4, Review and Games
CoD4 Logo

I got Call of Duty 4 (CoD4) the day it came out, and when I started playing it, I was amazed at how realistic it looked and felt. I have a PS3, so I was a bit disappointed that there weren’t any Sixaxis features for it.

They introduced me (’Soap’ MacTavish) to the controls of the game at a range on a USMC base. Picking up a clearly marked carbine from the table, I was instructed to look down the range. After being taught the basics of CoD4 aiming (I could generalize it as all CoD games…Yes, even CoD2 *gasp*), I got a secondary firearm — An M9 Beretta. So I shot some targets, yada yada yada, shanked a watermelon, yada yada…

Next I proceeded to some warehouse/hangar thing where a group of SAS were standing, ridiculing my name :(

When I heard them bashing ‘Soap’, I had an urge to find out if I could hurt my own team, so I tried…I expected it, but you can’t hurt a teammate when you have your crosshairs on them. Well, since I’m a crafty, person, I moved the crosshairs to the right of the soldier’s body and jabbed him with my blade. I killed the bastard, but was reprimanded with a blurred screen and the message “Friendly fire will not be tolerated!”

With my glory and triumph pounded by the scolding, I trudged to a training facility some 10 feet away — something like the MOUT Shoothouse from the America’s Army training. I fast roped down, shot the plywood targets, ran down the stairs, hit another plywood mark, threw a flashbang, ran in, shot a couple more boards with faces, ran into another room, did the same, threw another flashbang, and killed the last wooden enemies. Once done — In record speed! — I sprinted out.

Thus marked the end of the basics. The bunch of joking bastards who had picked fun at my name brought me on a chopper to a mission on some freight ship. It was really just another ploy to teach me about the game a bit more. Some three quarters into the level, I discovered a Desert Eagle, which made everything okay. It’s just too bad that I ended up only accomplishing complete inaccuracy with it…I did hit close to a terrorist’s head, so I’m gonna go ahead and give myself that one :D

The game traverses through different acts and missions, in which one plays two different characters: ‘Soap’ MacTavish and Sgt Paul Jackson. I won’t get into the specifics of it, so as not to ruin the game for you, but I’ll tell you the quality of the game.

All the animations are very fluid and lifelike. To add to the realism, there are no cutscenes whatsoever! Everything is real-time, so one can feel very involved in its virtual reality. In one [real-time] scene, a Cobra Copter gets hit with an RPG. You watch this from a seated position in the back of another cargo chopper. The Cobra spins wildly around, but the animations run smoothly…Not choppy at all. It’s so wonderfully put together that I rarely can sound any complaint. Well, maybe two.

The storyline is short as fuck and the online play shitting out on me. Even if the online play worked, I’d be hard pressed to find another PS3 user playing CoD4 online at the exact time. Usually, it takes 30 minutes to find a server. The game has only been out for a few days, though…I can’t really complain about it not having enough people.

The single player missions have great replay value. There are always new routes to travel…You don’t have to go into that house, and you don’t have to use C4 to destroy the tank. You could potentially run from car to car, or use an RPG to eliminate the tank.

There are also many, many little things that add to the realism of the game. For instance, if you shoot someone in the leg, chances are they’ll live through it, but won’t be able to use that leg. With that in mind, the developers entered that into the game. When you hit an enemy’s leg, he’ll fall down, discarding his rifle for a pistol. He’ll start shooting you…Which is quite a nuisance, because those prone on the floor don’t contrast much to dead bodies. It becomes a search, further challenging you.

Another great thing is the knife animations. Instead of linear jabbing or slicing, CoD4 includes many different ways to shank someone. Depending on the enemy’s stance, your stance, and distance from the enemy, it will do one of these options: Slice like a madman (Like a with a machete), extend the arm straight into the enemy’s body, pounce forward and stab the enemy (Like a bayonet — This usually happens when you’re behind them, but can potentially occur in any position), slit their neck, et cetera…

Other than the two issues I stated, the game is absolutely, mind-bogglingly awe inspiring in the animation, gameplay, and visual categories. I’d recommend it to anyone, but especially to those on the 360, because the little time I did play online was a jolly romp. With more 360 owners, there’s bound to be more online players.

It is time to retire the keyboard for some, oh, I don’t know, donuts. They’re better than you.
theY4Kman, out.

P.S. This post totally wasn’t advertising to get the game and play online with me…
P.P.S. Buy CoD4 on the PS3 and play online. Now!

Update: As I expected, there are many, many more players online. It now takes two seconds to find a game. There are still some times when no one is on, or it takes 10 minutes to join a game…But for the most part I’d say it’s a huge improvement.

November 7, 2007

Team Fortress 2

Written by theY4Kman at 4:05 pm under Review and TF2

Lately, I’ve been playing Team Fortress 2 as if it were full of sexy women. There’s many great things about it, but they land into 3 main categories: Visual elements, Gameplay elements, and Team elements.

The initial burst of excitement that came when I first got the beta of the game was the visual aspect of it. It looked very comical, making it feel less realistic. Some would argue that being realistic boosts the interest for the game, but this is the opposite. Because it doesn’t adhere to the rules of realism, it can focus more on the gameplay, which brings me to the next point.

The point of the game is to win, as is the point in most games. To win in TF2, though, you either have to control all points or capture the flag a set amount of times. There are many mutations of these elements on each map, but the simplicity of the objectives makes the game easy to play for any newcomer, but can be complex enough for a veteran (Oh, there will be…)

None of the default maps handed out with the server are geared towards any one side, so it’s up to the players on each team to make the difference. The catch is that in order to be constantly successfully, you need to be just as diverse in class selection. A heavy can take out many players, but is pretty much as useless as a pyro in water without a medic. But medics are worth nothing without another player there to heal and offer defense. A demoman needs another player with a long range weapon, because he’d bit shit out of luck with an enemy sniper. You get the point…

Anyways, all that just proves that teamwork is a critical part of succeeding. I’m a very teamwork-oriented person (Especially in the sack. Rawr!), which is just another way of saying I suck ass. Despite that, this game allows me to excel and actually help the other players by just being the background guy who thinks ahead. I tend to pick the engineer class and build up at the points next in line to be attacked. (Check out my stats here)

In order to conclude this piece of crap article, I’ll say that TF2 is perfect for the thinking group of gamers, but still allows for the lone wolves. Thanks for reading; see you next time!

Next Page »

Powered by WordPress. Driven by caffeine.