Saturday, May 31, 2008

Dragon Knight For Dummies

Well, I got Dragon Knight up and running and I been jacking around with it for a while now, adding mods to it and reading through everything and figuring out how it all works and where everything is located and making lists of things I wanna fool with, its totally fun to screw with DK compared to something like Mount&Blade where you gotta wait for your crap to load for five minutes before you get the pleasure of bug testing some tiny little change you made to the game that won't even show up until you siege eight cities or something.

Y'know, this editing web page stuff is sweet, you can do it on the fly while you are playing the game, I can totally dig that heh.

And after seeing how easy it was to set up with Dundee's tip about using XAMPP insteada going through the torture of installing PHP and MySQL and Apache separately like a total gear-head, I figured I'd do a little thing here in case there's one of you apes that wanna play around with it too, 'cause its super easy to play around with, yer just editing web pages and maybe messing around with the database a little bit, you don't need to be a systems engineer to do that junk, and you might actually be able to do something cool with it (or maybe you just wanna play the damn thing).

Oh, and its all free open source stuff that you are gonna use to do this, there ain't no part of this where I'm gonna suddenly say that you need to buy something heh.

And I'm gonna assume you are doing this in some version of Windows 'cause if you were in Linux you prolly wouldn't need my crappy help ahaha.

So first off, you should prolly download and install Firefox if you ain't done that yet, and you should start using that instead of Internet Explorer, 'cause that'll spare you some headaches with more than just this DK thingie, eventually.

That's just easy and fun to do, Firefox is slick.

And then you need to download the XAMPP Windows 1.6.6a installer and install that (just go with all the defaults, I've got mine installed in C:\xampp and that'll work fine and make it easier for you to follow me 'cause I'm gonna pretend that's where you installed it no matter what you decide to do heh).

XAMPP is gonna install Apache and MySQL and the PHP programming junk on your machine without freaking you out by asking you ten million things about 'em that you ain't gonna know the answers to.

Toward the end of the install it oughta ask if you wanna fire up the XAMPP Control Panel, do that, and "Start" your Apache (web) and MySQL (database) server from the control panel (the only buttons you are ever gonna need to mess with on the control panel are "Start" and "Stop" for your Apache and MySQL servers and the "Admin..." button for Apache, you won't ever need to fool with any of the other buttons or learn what any of the rest of it is all about).

They should "green light" and say they're "Running."

You can turn 'em on and off all you want but you wanna get 'em both on and hit the "Admin" button for your Apache web server to make sure the junk is working, it'll load up a "XAMPP for Windows" web page (off your new web server) that lets you fool around with it.

The only really important thing on that initial XAMPP for Windows admin web page thingie is the phpMyAdmin() button under Tools on the left, you are gonna need to go there if you wanna donk around with the database (you could make a bookmark for it, but its only gonna work when you got your personal web server and personal database fired up).

You are gonna need to go there now though, just this one time (if you don't wanna mess around with the guts of your database), 'cause you need to make a database for DK to use, which is easy to do, so don't freak out heh.

On that first page of phpMyAdmin, under "localhost" in the middle of the page, about halfway down the pile of text boxes and stuff, is a "Create New Database" section, with a blank field where you can enter text, a field that says "Collation" next to it, and a gray button next to that that's says "Create."

Type "dk" in the box (that's gonna be the name of your DK database) and hit "Create."

Congratulations, you are done with all the database stuff you gotta do heh.

Now you need to switch to PHP 4 ('cause XAMPP comes with both PHP 4 and PHP 5 installed, but its using 5, and you need to use 4).

You gotta "Stop" your Apache and MySQL server from the Control Panel to do this part.

Once you stopped everything, get a command prompt (go to start->run or whatever) and type C:\xampp\php-switch.bat

That'll run a little program where, after a couple seconds, you'll need to enter the number "4" on your keyboard and hit enter to switch your PHP programming stuff from PHP 5 to PHP 4.

It should do a bunch of junk and tell you it worked at the end yay!!!

You are pretty much done with all the scary stuff now ahaha.

Okay, now go and download the "Full Game" DK files, and unzip 'em and copy the "dk1111" directory into your "C:\xampp\htdocs\" directory.

That "c:\xampp\htdocs\" directory is your webserver, the DK stuff in that "dk1111" folder is just a bunch of web pages.

Now you need something that you can edit PHP files with so that it isn't a total pain in the ass to look at 'cause of the way its formatted, I use Notepad++ for all that kinda garbage (that ain't the only thing that could do it, if you are some kinda programmer that has some kinda IDE he likes better, but Notepad++ is nice for dummies).

So download and install the Notepad++ npp 4.9.2 installer, if you gottta, and open Notepad++ (or whatever), and open up the file C:\xampp\htdocs\dk1111\config.php (or you could browse there and right click on config.php and select "Edit with Notepad++" or whatever from the menu, too).

The only thing you need to do in there is add in the name for your database at line 7....

From this:
"name" => "", // MySQL database name.

To this:
"name" => "dk", // MySQL database name.

... and then you can save that file and you are done "programming" heh.

Okay, now "Start" your Apache and MySQL servers from the XAMPP Control Panel again.

And open up your Firefox browser.

And type https://localhost/install.php in your browser.

That'll run some stuff that makes a bunch of tables for the game in your MySQL database and an admin account and some other "game setup" junk like that.

After you finish that, you need to get rid of the C:\xampp\htdocs\dk1111\install.php file or the game will see it and be angry with you (you can delete it or rename it or move it out of that directory or whatever you wanna do with it but its gotta go).

Oh, the thing might grump a little about the way you don't have an email server set up but don't worry about that, DK has some email code to it so that Users can pester the admin and create their own accounts and get verification emails and stuff, but you don't need that working for anything and it won't break nothing.

And now you are done, you can play the game anytime you want (single-player) just by starting up Apache and MySQL with the "Start" buttons in your XAMPP Control Panel, opening your browser up to "https://localhost/dk1111/" and logging in on the admin account you made.

Might as well make a bookmark for that too.

There's an admin panel on the left that'll let you cheat and see all the monsters and items and stuff in your database.

And you can hack all the files in the "C:\xampp\htdocs\dk1111\ directories to jack around with way the game works and add mods and stuff, if you wanna do that.

And you could run this thing on the internet multiplayer and stuff too, it has its own code for forums and a really simple chat box and everything, but then you gotta get an internet accessible website running somewhere to chuck your modified DK1111 PHP web page stuff on (or just share your files with somebody who is doing that) and a working email setup and some place (or somebody) to host your DK database if you can't do that kinda thing from home (or work or whatever) and you definitely need to have a password on your database (you don't, if you've done what I said so far, but then half of the databases in the world don't have passwords on 'em, so its not like you are all alone in that, heh, and don't worry about hackers, trust me, your DK database isn't all that interesting to anybody as long as all you got in there is monster garbage).

Oh the mods for it are over here, mostly the "mods" are people just explaining what edits you'd need to make to the php web pages in your "c:\xampp\htdocs\dk1111" folder to add something new to the game.

The cool thing is that if you get all this crap working (and it ain't that hard), then you'll prollly be able to hack around with the web pages and crap and do something that everybody can enjoy just by sharing what you did, I mean, even if you don't really "get" php at first, jacking around with a game is the funnest way to learn it.

Plus its fun to be an "admin" and cheat your ass off in an RPG game (and probably break the hell out of it) if you ain't never done that kinda thing before (and you can always delete your "c:\xampp\htdocs\dk1111" directory and copy a fresh "dk1111" folder in there if you totally dork stuff up beyond repair and you wanna just start over).

I was in the middle of editing my admin page so that it would be able to add and delete users and monsters and items and all that junk when I came over here, and when I finish that, I'll throw up an explanation of all that so that you can do that too.

And then if you do something cool, you can trade it with me, you selfish bastard.

I mean, there's all kinds of junk you can play with in there, forum code, a chat box thingie, its all super simple and short and perfect to go crazy on if you don't mind learning a little "web programming" and database crap.

Which ain't gonna hurt you none to know, y'know?

Yah here's a new admin.php and ./templates/admin.php for your dk1111 folder that adds add-n-delete stuff to your admin panel so you can add and edit monsters and items and all that and then delete 'em if you don't like 'em while you are playing the game without having to jack around with the database.

No comments: