Started Development :)

For announcing, describing and discussing code changes to BNT.

User avatar
TheMightyDude
Site Admin
Posts: 245
Joined: Thu Apr 17, 2014 9:15 am

Re: Started Development :)

Post by TheMightyDude » Sun Apr 09, 2017 11:00 pm

Well I have some good news and some bad news.

Well the new development is to be a complete recode and won't be a browser based game.

I do have plans in developing the server side in C# using multiple threads to support several thousands of connected users.
I am currently researching Node Clusters etc to support this amount of connected users.

Also at first the server code will be in house only, but may be released later on.

The client side will be written in Unity and I am hoping for it to all be in 3D a bit like Freelancer and Elite etc.
I am still looking into the transitioning from space to planet surface so that its seamless, which isn't an easy thing it seems LOL.

I am currently putting everything on hold to see what happens next month when the domain runs out, I am not too sure what Ron Harwood (Owner of Blacknova Traders) is going to do, plus due to health issues I haven't been around or doing much, so it wouldn't be right for Ron to renew it for another year if nothing gets done in that time span.

Now to-do with the state of the current code...

BTW what version of Linux, Apache, MySQL and PHP are you using?

Yep, its broken code, this is due to changes in PHP and MySQL over the last few years or so, its also due to ADOdb not being updated for many years, we did have plans to move over to PDO, but that all fell through.

So for number 1, yep I knew that would bite us in our backsides, I never wanted to force compression in the first place.
For number 2.1, that's because your database isn't setup and the query is returning a Boolean false (i.e. and error), 2.2 yeah, we are aware of that warning and have a fix for that, just search these forums, 2.3 yeah, there is loads, I even had issues getting the code to work on this server, hence the games being closed.

Now for number 3, using global variables isn't a bad thing, its all down to how its being used, there might be some bad places in BNT that has security issues.
As for that link you supplied, that has noting to do with global variables, that was due to not filtering the users inputs and was fixed many years ago.

You will probably find out that most of the issues fall back to ADOdb which is a 3rd party library which is now unmaintained by the owners.

As for the quality of the code, I totally agree with you on that one, over the years we have had loads of developers come and go, each having different coding styles.

I think BNT was first coded when PHP was at one time version 2 moving over to PHP 3 and each major version change caused loads of issues and I mean loads of issues.

And the only way to resolve those issues was to use code hacks, back then loads of people was doing it and back then was the only way, I know I wasn't proud of it.

You can get the code to work, but to be honest, its more trouble than its worth sadly.

I know when it got to a point where it became Impossible to add new stuff to the game, we did try several times to recode the bad parts, sadly in some areas it made it worse, plus we did have some disagreement which sadly resulted in stopping development on the old code.

I could go through each file line by line correcting errors etc, but that would take longer than coding the game from scratch.

And if I was to code the game from scratch I might as well change how the game is played to make it fun for all players, not just the old players etc, over the years I have seen loads of new players join the game to be wiped out by stronger players resulting in them just giving up and leaving.

This was why I wanted to change how the game is played and adding in new aspects to the game that should please most players.
This was why I was heading for a non browser based version that would need me to code not just the server but the client as well, and not just one client, but a few clients, PC, Linux, Mac and "maybe" Tablets later on.

Now whether I have bitten off more than I can handle, most probably, but it would be a fun trying.

But like I said this all depends of what the owner of BNT does next month, if the domain expires that's fine, I am currently the last active developer left the last time I checked, and also due to health issues I am happy for the game to get put on the shelves.

At the end of the day I have had a great time developing parts of BNT with the other developers that have come and gone and also chatting with the players for the last 15 or so years, even the players that wasn't nice LOL, it was a great learning curve and got me into Game Development which is a plus.
TheMightyDude::Blacknova Development.
Development Blog Twitter Twitch

thekabal
Posts: 91
Joined: Sat Apr 19, 2014 10:32 pm

Re: Started Development :)

Post by thekabal » Mon Apr 10, 2017 7:31 pm

Altcointrain wrote:After reading this it appears a new version of BNT is in the works.

Is this a correct assumption?
Sadly, no. Blacknova Traders has been in 'hibernation' of late, and will likely not see a new release soon. The last released version is non-functional on current PHP as you've discovered. I have continued with the code base, and have been working to modernize it (and shift the gameplay style a bit) over at https://github.com/thekabal/tki/ . To be fair, even Kabal Invasion (TKI) is not yet "ready for use".

On the other hand, your hosting company made some.. interesting conclusions and statements, but I won't argue them point by point. The code is not functional on current PHP, and we do not currently have a new release of BNT planned.
Altcointrain wrote:If a new version is 3-4 months out I may hire a programmer to review this version and try to debug it. Please let me know.
I'm doing my best to continue the BNT tradition over at TKI. We've eliminated global variables, have been converting from ADODB-> PDO, have aggressively pursued security improvements, and welcome contributors. The game plays very much the same as BNT did, and I hope to release in the future.
TheMightyDude wrote:Well the new development is to be a complete recode and won't be a browser based game.
Is it really going to be Blacknova Traders though? I don't begrudge you discussing your new project, but you've described not only a different architecture (not browser based), but also a very different play style. What elements are going to be similar to Blacknova Traders?
TheMightyDude wrote:Now for number 3, using global variables isn't a bad thing, its all down to how its being used, there might be some bad places in BNT that has security issues.
Global variables are a bad thing (due to variable scoping, security, and testability), and the PHP community and most PHP books published in the last five years agree on this point. There isn't a single place in BNT where they were needed.
TheMightyDude wrote:But like I said this all depends of what the owner of BNT does next month, if the domain expires that's fine, I am currently the last active developer left the last time I checked, and also due to health issues I am happy for the game to get put on the shelves.
I am still actively developing. While the project name is different (because I wanted BNT to continue separately), it is still based on the same original codebase. Gameplay has changed very little even in the development branch of TKI. I've offered several times to continue Blacknova Traders, and would be happy to do so if you choose not to do so and if Ron wants to keep it going.
TheMightyDude wrote:At the end of the day I have had a great time developing parts of BNT with the other developers that have come and gone and also chatting with the players for the last 15 or so years, even the players that wasn't nice LOL, it was a great learning curve and got me into Game Development which is a plus.
On this, we totally agree! :) The community, the players, the admins, the developers.. all have been fantastic through the years. I've enjoyed the ride, even with some bumps on the way.

User avatar
TheMightyDude
Site Admin
Posts: 245
Joined: Thu Apr 17, 2014 9:15 am

Re: Started Development :)

Post by TheMightyDude » Tue Apr 11, 2017 3:44 pm

thekabal wrote:
TheMightyDude wrote:Well the new development is to be a complete recode and won't be a browser based game.
Is it really going to be Blacknova Traders though? I don't begrudge you discussing your new project, but you've described not only a different architecture (not browser based), but also a very different play style. What elements are going to be similar to Blacknova Traders?
Well one of the versions that I am aiming for won't be for sure, but there was also going to be a Classic BNT like we know now.

The only difference would be they won't be browser based games, the classic version should be the same it is now, but played over a game client instead of a browser, this was so that the client can get information when it happens from the server without spamming the server every second for any updates.

I have delayed doing the game stuff while I was working on the network stuff this end which links all our games to here and possibly allow later on for 3rd parties to add their games to our list.
And these 3rd party servers would be like WoW's Realm Servers which would get listed in regional group lists etc.

So the classic version will still reset every X Months, all account information will be persistent and stored our end.

As for the version I am aiming for is a more of a MMO version with XP Levelling System, Questing, loads of Races to choose from and so on, this version was never to be reset.

Both of these versions will be using my own Network Library which will be using TCP Connections allowing for the server to send to the client whenever it has data for them reducing for the client having to request the server every second or so for any updates.

I was planning to do both versions side by side, but the Classic version was to be released first due to its simplicity compared to the MMO version.

But like I said, it all depends of what Ron Harwood does next month to-do with the domain.
It also depends on how many people are still interested in BNT, I still like the game myself, well parts of it anyway, but to me it doesn't make sense working on something if only 10 people will play it.
Now if there was loads of players that was still interested in BNT then maybe it would be worth it.

I am wishing I started the recode several years ago when there was hundreds of players playing, the last game I run on here had 161 accounts that had used at least 1 turn, so maybe it is worth the time :)
thekabal wrote:
TheMightyDude wrote:Now for number 3, using global variables isn't a bad thing, its all down to how its being used, there might be some bad places in BNT that has security issues.
Global variables are a bad thing (due to variable scoping, security, and testability), and the PHP community and most PHP books published in the last five years agree on this point. There isn't a single place in BNT where they were needed.
Global / Super Global Variables are only bad if used wrong, if the server has register_globals enabled then yeah, anything the user enters via GET or POST and possibly COOKIE also gets put in as a GLOBALS.

Example we have an initialization section at the top of the file which sets all required global or super global variables.
Now if anyone tries to inject anything its over-witten, so no issues there at all.

Now if we didn't null out or set those global or super global variables at the start, then yes this will be an issue and if we used global $fubar within a function that would also be able to be injected into.

Now to make things even better is the fact most if not all versions of PHP now comes with register_globals disabled, so if a user tried to inject via the URL bar it will only end up in the $_GET and possibly $_REQUEST if that's also enabled.
And stuff tried to be injected via a web form will end up in $_POST and possibly $_REQUEST if that's also enabled.

All that said, if you do all your code the right way like using OOP style classes etc, you would never really need to use gloabl within the class functions.

Also I always try and stay away from using global especially super globals.

I was just trying basically say using globals isn't the issue, the issue is seuper globals used with register_globals turned on.

https://dev.blacknova.net/dev11359/test ... ctme=fubar

Code: Select all

<?php

echo "<pre>[register_globals]\n". var_export( ini_get("register_globals"), true) ."</pre>\n";

echo "<pre>[debug]\n". print_r($GLOBALS, true) ."</pre>\n";

function Testme()
{
    global $injectme;
    echo "<pre>[injectme]\n". var_export($injectme, true) ."</pre>\n";
}
Testme();

echo "<pre>[debug]\n". print_r($GLOBALS, true) ."</pre>\n";

?>
Let me know if you can get it to inject anything, maybe I am missing something.
thekabal wrote:
TheMightyDude wrote:But like I said this all depends of what the owner of BNT does next month, if the domain expires that's fine, I am currently the last active developer left the last time I checked, and also due to health issues I am happy for the game to get put on the shelves.
I am still actively developing. While the project name is different (because I wanted BNT to continue separately), it is still based on the same original codebase. Gameplay has changed very little even in the development branch of TKI. I've offered several times to continue Blacknova Traders, and would be happy to do so if you choose not to do so and if Ron wants to keep it going.
Oh, I thought you was just working on your TKI code base, that's good to know, so we will have my Classic and MMO versions and your Browser versions of BNT and TKI, so we should be able to please most of the people.

I know my new versions will most probably affect players that play at work due to most companies don't allow for installing stuff, or running stuff off a USB Stick.

BTW are you sticking to the current look of classic in your version of BNT or has it changed much?

I have no issues continuing for now, but like I said its all down to if Ron renews the domain which runs out sometime next month, I am sure he will renew it.

I know due to ill health I had to take a break from development, but I have been slowly getting back into it, hence the development direction.
thekabal wrote:
TheMightyDude wrote:At the end of the day I have had a great time developing parts of BNT with the other developers that have come and gone and also chatting with the players for the last 15 or so years, even the players that wasn't nice LOL, it was a great learning curve and got me into Game Development which is a plus.
On this, we totally agree! :) The community, the players, the admins, the developers.. all have been fantastic through the years. I've enjoyed the ride, even with some bumps on the way.
Agreed.
As far as I can see BNT was added onto SourceForge on 2000-11-06 and I joined SourceForge on 2001-07-24 where I then joined the team, so I have been here for over 15 years, wow that time goes by so fast doesn't it LOL.
TheMightyDude::Blacknova Development.
Development Blog Twitter Twitch

User avatar
TheMightyDude
Site Admin
Posts: 245
Joined: Thu Apr 17, 2014 9:15 am

Re: Started Development :)

Post by TheMightyDude » Tue Apr 11, 2017 8:44 pm

Hey all

Just a quick update...
Good new on the domain side, I just spoke to Ron and he is renewing the domain :)
TheMightyDude::Blacknova Development.
Development Blog Twitter Twitch

thekabal
Posts: 91
Joined: Sat Apr 19, 2014 10:32 pm

Re: Started Development :)

Post by thekabal » Wed Apr 12, 2017 10:40 pm

TheMightyDude wrote:Hey all

Just a quick update...
Good new on the domain side, I just spoke to Ron and he is renewing the domain :)
Woohoo!

thekabal
Posts: 91
Joined: Sat Apr 19, 2014 10:32 pm

Re: Started Development :)

Post by thekabal » Wed Apr 12, 2017 11:10 pm

TheMightyDude wrote:Well one of the versions that I am aiming for won't be for sure, but there was also going to be a Classic BNT like we know now.
Oh, very cool!

TheMightyDude wrote: Global / Super Global Variables are only bad if used wrong
That is simply false. They make debugging very difficult due to their infinite scope, they make testing nearly impossible (or at least unreliable), and -- this is the important part -- there isn't a single place they are needed in BNT. You should try the argument the other way - find a justification for why you SHOULD use them when the industry and every major PHP book in the last few years all suggest against them.
TheMightyDude wrote:I was just trying basically say using globals isn't the issue, the issue is seuper globals used with register_globals turned on.
*Both* are bad.
TheMightyDude wrote:Let me know if you can get it to inject anything, maybe I am missing something.
Let me know if you can find a reason to use them, a way to use unit tests with them, and a way to limit their scope to make debugging possible. Or if you find a single place in BNT that they are needed.
TheMightyDude wrote: Oh, I thought you was just working on your TKI code base, that's good to know, so we will have my Classic and MMO versions and your Browser versions of BNT and TKI, so we should be able to please most of the people.
In the TKI codebase (which is really just BNT, with changes), there is a "Classic" and an "Advanced" setting. Right now, only Classic is actively developed, but the plan is to have both available eventually.
TheMightyDude wrote:I know my new versions will most probably affect players that play at work due to most companies don't allow for installing stuff, or running stuff off a USB Stick.
That is true, I was surprised at the volume of users that played during the "work day".
TheMightyDude wrote:BTW are you sticking to the current look of classic in your version of BNT or has it changed much?
Right now, my focus has been on the backend - code correctness, migrating from Adodb to PDO, fixing bugs, that sort of thing. The only real cosmetic changes so far has been in create universe, languages (Not Using Capitals For Every Word Oh My Gosh), and tiny little cosmetic bits here and there that were mostly to fit them into css & templates. CU is likely to get the cosmetic treatment first, as it is now fully PDO and relatively well-behaved. I suspect it's a solid year or more away, as each file migration from Adodb to PDO is taking outrageous amounts of work between determining what the code was meant to do to migrating it, and improving it, and in many cases fixing bugs that have been around for years(!). It's like opening the Attic, going through the boxes of old stuff, and shining it up for sale. ;)
TheMightyDude wrote:I have no issues continuing for now, but like I said its all down to if Ron renews the domain which runs out sometime next month, I am sure he will renew it.
With him renewing it, I am VERY excited to have it continue! Yay to both of you! Here is to hoping we will see a BNT game running again some day soon.
TheMightyDude wrote:As far as I can see BNT was added onto SourceForge on 2000-11-06 and I joined SourceForge on 2001-07-24 where I then joined the team, so I have been here for over 15 years, wow that time goes by so fast doesn't it LOL.
IT REALLY DOES! I've gotten married, had a kid, evolved from Systems Administration to DevOps Engineering, and moved cross country in that time. Can't wait to see what the future holds, it's been an amazing ride.

User avatar
TheMightyDude
Site Admin
Posts: 245
Joined: Thu Apr 17, 2014 9:15 am

Re: Started Development :)

Post by TheMightyDude » Wed Apr 12, 2017 11:22 pm

thekabal wrote:
TheMightyDude wrote:Hey all

Just a quick update...
Good new on the domain side, I just spoke to Ron and he is renewing the domain :)
Woohoo!
Yeah, I was relieved.
TheMightyDude::Blacknova Development.
Development Blog Twitter Twitch

User avatar
TheMightyDude
Site Admin
Posts: 245
Joined: Thu Apr 17, 2014 9:15 am

Re: Started Development :)

Post by TheMightyDude » Wed Apr 12, 2017 11:57 pm

thekabal wrote:
TheMightyDude wrote:Well one of the versions that I am aiming for won't be for sure, but there was also going to be a Classic BNT like we know now.
Oh, very cool!
I am hoping so.
thekabal wrote:
TheMightyDude wrote: Global / Super Global Variables are only bad if used wrong
That is simply false. They make debugging very difficult due to their infinite scope, they make testing nearly impossible (or at least unreliable), and -- this is the important part -- there isn't a single place they are needed in BNT. You should try the argument the other way - find a justification for why you SHOULD use them when the industry and every major PHP book in the last few years all suggest against them.
I wasn't referring to the issues debugging them, we was talking about it wasn't safe to use them and my response was its all down to how you use it.

And I have seen loads of stuff use it the wrong way, at one time BNT used it badly.

The way I see it, if you cater for using it then you "should" be fine.

But like I said, I wouldn't use it myself even though this server has the bad parts disabled, TBH I would just use classes and pass the required information into that class.
thekabal wrote:
TheMightyDude wrote:I was just trying basically say using globals isn't the issue, the issue is super globals used with register_globals turned on.
*Both* are bad.
Well normal global variables only puts the variable and value in the GLOBALS var, so you still have to access it directly, whereas super global variables create actual variables accessible outside the GLOBALS var.

So I wouldn't use Super Globals, but then again I wouldn't use global variables.
thekabal wrote:
TheMightyDude wrote:Let me know if you can get it to inject anything, maybe I am missing something.
Let me know if you can find a reason to use them, a way to use unit tests with them, and a way to limit their scope to make debugging possible. Or if you find a single place in BNT that they are needed.
Well as a whole, if the code was done the correct way, then you wouldn't use them, I never said we should use them.
thekabal wrote:
TheMightyDude wrote: Oh, I thought you was just working on your TKI code base, that's good to know, so we will have my Classic and MMO versions and your Browser versions of BNT and TKI, so we should be able to please most of the people.
In the TKI codebase (which is really just BNT, with changes), there is a "Classic" and an "Advanced" setting. Right now, only Classic is actively developed, but the plan is to have both available eventually.
Ah, right :)
thekabal wrote:
TheMightyDude wrote:I know my new versions will most probably affect players that play at work due to most companies don't allow for installing stuff, or running stuff off a USB Stick.
That is true, I was surprised at the volume of users that played during the "work day".
Well the last job I worked at before I became ill, I worked on making Naval Radar Systems for the M.O.D around the world, all machines that had internet access was locked down like hell, my PC had no internet access so I could do what I liked (within reason that is), sadly no BNT for me LOL.
thekabal wrote:
TheMightyDude wrote:BTW are you sticking to the current look of classic in your version of BNT or has it changed much?
Right now, my focus has been on the backend - code correctness, migrating from Adodb to PDO, fixing bugs, that sort of thing. The only real cosmetic changes so far has been in create universe, languages (Not Using Capitals For Every Word Oh My Gosh), and tiny little cosmetic bits here and there that were mostly to fit them into css & templates. CU is likely to get the cosmetic treatment first, as it is now fully PDO and relatively well-behaved. I suspect it's a solid year or more away, as each file migration from Adodb to PDO is taking outrageous amounts of work between determining what the code was meant to do to migrating it, and improving it, and in many cases fixing bugs that have been around for years(!). It's like opening the Attic, going through the boxes of old stuff, and shining it up for sale. ;)
Yeah, I knew ADOdb haunt us later, I wanted to move away from it years ago, but there is so much code that needs to be changed.
I had huge issues even getting the latest release code working on this server, took me several hours over a few days, and it turned out to be an issue in header.php on this line

Code: Select all

<html lang="<?php echo $l->get('l_lang_attribute'); ?>">
That code will always fail when there is no tables created in the database, hens the white screen.

You should of seen me cursing at it for 3 days LOL.
Have you done traderoute.php yet LOL (CRINGES)
thekabal wrote:
TheMightyDude wrote:I have no issues continuing for now, but like I said its all down to if Ron renews the domain which runs out sometime next month, I am sure he will renew it.
With him renewing it, I am VERY excited to have it continue! Yay to both of you! Here is to hoping we will see a BNT game running again some day soon.
Well I cannot say anything at the moment until Ron says its ok, but I am sort of excited.
thekabal wrote:
TheMightyDude wrote:As far as I can see BNT was added onto SourceForge on 2000-11-06 and I joined SourceForge on 2001-07-24 where I then joined the team, so I have been here for over 15 years, wow that time goes by so fast doesn't it LOL.
IT REALLY DOES! I've gotten married, had a kid, evolved from Systems Administration to DevOps Engineering, and moved cross country in that time. Can't wait to see what the future holds, it's been an amazing ride.
Well I have had two jobs (working at local college while studying there for free :P, then M.O.D Stuff and the last 4 or so years I have been ill, but currently on the mend with the new meds.

I can still remember the day I sent a message to Ron asking if I could join the development team (even though I knew nothing about PHP coding), at the time I saw very promising potential in the game, it took me over a year looking through the code learning to see what each part of the code did, then I got brave and did some fixes hoping I didn't break anything, once that stress was over with I was finer :)
TheMightyDude::Blacknova Development.
Development Blog Twitter Twitch

thekabal
Posts: 91
Joined: Sat Apr 19, 2014 10:32 pm

Re: Started Development :)

Post by thekabal » Thu Apr 13, 2017 2:54 am

TheMightyDude wrote: Well the last job I worked at before I became ill, I worked on making Naval Radar Systems for the M.O.D around the world, all machines that had internet access was locked down like hell, my PC had no internet access so I could do what I liked (within reason that is), sadly no BNT for me LOL.
I wouldn't play during work, but I was commenting on the massive volume of players that played during the "Eastern Time (US)" work day 9-5. It was easily 2/3rd's of my traffic when I was running games. Of course, Estonia was at least 1/2 of the players, so.. I dunno what to make of it. :)
TheMightyDude wrote:Yeah, I knew ADOdb haunt us later, I wanted to move away from it years ago, but there is so much code that needs to be changed.
On that, we agree!! I've gotten it down to 776 lines, but even two lines of DB code migration can take hours. I just did one yesterday, and it took four hours between discovering old bugs, fixing them, redoing them in a more secure way, and so forth. It's an undertaking! Plus where possible (and where it doesn't destroy the load), I try to reduce SQL calls in loops, using FetchAll and similar more often. We did that in BNT too, just not in many places.

Oh! I should mention that the scheduler IS substantially different. I haven't finished it yet (probably a few weeks out), but it runs as a command-line php program. No more "Do you have wget/lynx/curl/etc". Just php newscheduler.php , and done (works in crontabs as well).
TheMightyDude wrote: I had huge issues even getting the latest release code working on this server, took me several hours over a few days, and it turned out to be an issue in header.php on this line

Code: Select all

<html lang="<?php echo $l->get('l_lang_attribute'); ?>">
That code will always fail when there is no tables created in the database, hens the white screen.
Good catch. The "database is/isn't available" handling was a huge PITA to engineer, but it was critically important. It's now very solid, although once TKI is 100% PDO, I'll take another pass at refining it.
TheMightyDude wrote:Have you done traderoute.php yet LOL (CRINGES)
It's always Traderoutes, ain't it!

Traderoutes is very much a work in progress. I split it into 8 classes so far (and the parent file), and all of them now have strict typing enforced, and defined types for the majority of the function/method arguments. Many have some Adodb->PDO conversion work, but none (of traderoute) is fully converted yet. It is still quite terrible code, but it is becoming more managable. It's still my least favorite part of the code. :)

Super happy to hear you are on the mend.
TheMightyDude wrote:I can still remember the day I sent a message to Ron asking if I could join the development team (even though I knew nothing about PHP coding), at the time I saw very promising potential in the game, it took me over a year looking through the code learning to see what each part of the code did, then I got brave and did some fixes hoping I didn't break anything, once that stress was over with I was finer :)
For me, it was finding a tiny bug, suggesting the fix, and it landed next release. Then I suggested a new feature (The last ship seen device!), and the team invited me to commit to the tree directly. It has been bumpy at times, but it has always been a lot of fun. :)

thekabal
Posts: 91
Joined: Sat Apr 19, 2014 10:32 pm

Re: Started Development :)

Post by thekabal » Thu Apr 13, 2017 2:58 am

Also, this issue:

https://github.com/thekabal/tki/issues/48

Turned into my favorite so far. A whole class of problems had been created (by me!) when I converted to PDO without using data types. I fixed that (took a while), and now the code is so much more predictable. It's uphill, but it's worth it.

Post Reply