Updating Dragon Knight Engine

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
User avatar
Kesstryl
Posts: 202
Joined: Sat Sep 22, 2012 5:27 am

Updating Dragon Knight Engine

Post by Kesstryl »

Update*

I finally have a working update of the old browser game Dragon Knight. I updated the code to mysqli and added some security improvements (I still won't call it secure, but there were definite wide open holes that I attempted to close. I'm sure there are more, but I've reached the limits of my knowledge on this project, and I didn't set out to rewrite the engine).

I'd like to fork it on Sourceforge, but before I do, I thought you guys could poke at it and see if I missed anything. The code is still all procedural based, and my changes are recorded in the changelog. I welcome any suggestions, but I won't be changing things to OOP or MVC because the goal was to just get it running on modern php5 and update depreciated code for people that still want to use it.

You guys can grab a copy here from my dropbox to take a look before I feel the ok to upload it to Sourceforge.

https://www.dropbox.com/sh/p5pjov304zpj ... xLY8a?dl=0
Last edited by Kesstryl on Sat Jul 01, 2017 4:32 pm, edited 1 time in total.
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Converting Dragon Knight to mysqli (need help)

Post by Jackolantern »

Unfortunately, while it is a valiant effort to learn mysqli by updating an old codebase, I think Dragon Knight is not a good candidate. The code is ancient (~2004 or so) and is actually written in an old version of PHP that is incompatible with the latest PHP engine. There were breaking changes made to PHP between PHP4 to PHP5. So even with mysqli lined-up, it would still be tons and tons and tons of work to get Dragon Knight running on a modern web server.

If I remember right, Halls even tried to modernize DK a couple of years back and finally had to throw the towel in after really realizing how much work it would take to get it running without errors.
The indelible lord of tl;dr
Winawer
Posts: 180
Joined: Wed Aug 17, 2011 5:53 am

Re: Converting Dragon Knight to mysqli (need help)

Post by Winawer »

What's in opendb()?
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Converting Dragon Knight to mysqli (need help)

Post by hallsofvallhalla »

Correct. There has been one or two other users attempting as well and it is truly a workload.

There are a few older PHP game engines I have converted but that is one that just became too painful.
User avatar
Kesstryl
Posts: 202
Joined: Sat Sep 22, 2012 5:27 am

Re: Converting Dragon Knight to mysqli (need help)

Post by Kesstryl »

It's too bad because I love the way the engine works as a game platform. What other engines did you update Halls? Do you have downloads for them somewhere?

I have thought about porting my game to NWE but the programming logic behind that engine is a bit beyond me. I get how it works in theory but to mod my own game with it is daunting. Dragon Knight was purely simple and I had gotten a lot of things to work on my own. However I want to update my hosting service to php5 and so that engine really needs to be updated if I'm to continue using it, which might not be possible.

As for what's in the Opendb () function, it's basically using a function to open the link to the database which MYQLi needs every time you use the database. I thought about getting rid of the abstraction layer for now and using standard msqli_query statements for the time being. At least until I get through the learning stage and get a better grasp on how to make a modern abstraction layer.
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Converting Dragon Knight to mysqli (need help)

Post by hallsofvallhalla »

I would need to go back through and find them, I was thinking you meant Legend of the green Dragon, I attempted both.

One is
http://sourceforge.net/projects/themerchant/

however that was some time ago so not sure if it needs to be done again. NWE is great once you get use to the hooks and DB calls and such.

I have browsed around multiple times for good open source code to build off of but what I realize is I am better off building it from scratch vs plowing through someone elses code.
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Converting Dragon Knight to mysqli (need help)

Post by hallsofvallhalla »

I might be interested in joining forces to really update Dragon Knight. Add a better map, more features ect. along with updating it. Most of the mods I found were crap or broken. Needs a good fresh start. Might be good for IR to build a fresh one and get people interested again. Only problem is in its license it says you can redistribute. WE would need to get with the creator and see if he would allow it or at least put a link on his site pointing back here.

Building it from scratch would not take long either and could use Ajax and bootstrap to make it much better. Keep it simple yet elegant. I always loved my first version of Forsaken Sanctum and was thinking of rebuilding it. It has had several thousand downloads. So many options.
User avatar
Kesstryl
Posts: 202
Joined: Sat Sep 22, 2012 5:27 am

Re: Converting Dragon Knight to mysqli (need help)

Post by Kesstryl »

That would be awesome Halls! I really do enjoy the simplicity of the DK engine and have learned so much already just from my messing with it. The updates I did really are very basic and you could probably make way better ones. I basically added in (and successfully fixed ones that were broke) some mods that the old DK community has on an archive site, and I updated the security of the code as best I could because there were some huge (and I mean really bad) security holes. I also added in some CSS to make the layout fluent, and added in some button links to the text links with the future goal of making the layout responsive, but that's still a ways off. The CSS really needs to be separated from the code in a big way, though it does have it's own templating system, there's still some mess in there with a little html mixed in the code. I have an older version up on my hosting site at http://rpg.sonyaireland.com You can compare that with downloading your own copy of the vanilla script (which may have lots of errors on a PHP 5 WAMP server) and seeing what I was able to add in and change.

For the license I don't think he ever made an official one, only wants to be credited if his engine is used. There's no license in the download files. His archived site can be found here: http://renderse7en.com/

As for learning to mod NWE, I really do need to sit down with it and dig into it. It's a great engine, and one that I will use for a future game, but what it currently has does not supply everything I want for my game. I think I feel like the things I need for my game are way to big for me to write into my own modules so it's going to be a much bigger learning curve. Good step by step concrete tutorials would be awesome, it is daunting to read some of the info on the engine already when you only have a basic understanding of programming. It's not that I can't learn it, it's just that it's going to be a much bigger learning curve than I can mentally tackle at the moment (college student, and seriously behind in my papers).

PS. I was looking to see if anyone ran a copy of the vanilla game and ended up finding all of these new games that are using the engine:

http://www.jurassicrpg.com/
http://www.fairywing-rpg.com/
http://www.cdbible.net/scud248/login.php?do=login
http://deadsocial.com/necrotopia/login.php?do=login
http://en.novigeroi.com/
User avatar
Kesstryl
Posts: 202
Joined: Sat Sep 22, 2012 5:27 am

Re: Converting Dragon Knight to mysqli (need help)

Post by Kesstryl »

I wanted to update this post because I decided to revisit this project, and I think time working on writing another game of my own with modern practices has cleared my head to where I am now able to successfully update this cute little game engine. I have successfully updated the installer, login, and much of the main page. I'm going to go through different parts of the game and update things as error messages pop up. I'm using WAMP 3 with php 5 so it won't take depreciated code like old mysql queries (I've updated the game to use mysqli). So far I don't need help, but I'll ask here if I do need it.

My goal is to get the game as is without error messages. I'm not restructuring it in any way except to get rid of depreciated code and improve some of the security. It's still going to have the crappy structure it always had, but honestly it's not bad for a beginner's game engine, it's easy to understand and learn from, it has a nifty admin panel built in for those who don't want to code much, and there are still games running out there using this. I want to finish the old game I started with this, just because it still begs to be done at the back of my mind.

I'll post the updated code somewhere so others can poke around with it when I'm done.
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Converting Dragon Knight to mysqli (need help)

Post by hallsofvallhalla »

very cool. Excited to see the end result. I had thoughts of redoing a lot of old games and posting source here but its a ton of work
Post Reply

Return to “Beginner Help and Support”