BBGameZone.net PBBG Network | BuildingBrowserGames | Top-PBBG
March 10, 2010, 07:22:47 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Our Scripts Vault contains many game scripts that you can use to create your own game!
 
  Home   Forum   Help Login Register  
Pages: [1] 2   Go Down
  Print  
Author Topic: BBG Framework Project v0.1.2 [17-July-2009]  (Read 1358 times)
karnedge
Level 17
*

Reputation: 4
Offline Offline

Posts: 170


ctrlHack provides the server, you bring the skill.


View Profile WWW
« on: June 26, 2009, 12:46:05 PM »

bbgFramework
 - Version 0.1.2 Alpha Release
 - Requires PHP 5+ and Apache 2+
 - Released under MIT or BSD licenses (choose what fits your game development)

Download zip or bz2 archives.

If you're fairly active in Coding Discussion, then you'll know that I've been working on a framework as drop-in solution for PBBG developers. The framework is considered to be in an Alpha stage and I wouldn't completely suggest it for a Production environment, although I am not discouraging it. To be certain of its security, it will take the minds of
developers and a collective contribution from the community to figure this out.

Take a look at the BBG Framework topic in the Coding Discussion to find out what all the framework has built in and what needs work.

Visit the project at SourceForge:
https://sourceforge.net/projects/bbgframework

From there you can download the framework (which is also available in .tar.bz2), check out the discussion forums for support and read/contribute to the Wiki provided. And please, if you have any suggestions/requests post them to the Project's forums, not here. If you wish to join the project please either message me or post a request on the Developers forum.

If you have any comments or want to let me know that you're going to try out the framework, feel free to reply to this topic. I just don't want to fill up the forums here with stuff that could be discussed at the project itself, but I would love to hear what you guys think here.

Thanks,
Dylan

EDIT: Added version and license information
17-July-2009: v0.1.2 should fully support subdirectories correctly, with fixes to database.php and updated Smarty to 2.6.26.
« Last Edit: July 17, 2009, 08:33:14 PM by karnedge » Logged

ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3
Crazy-T
Level 19
*

Reputation: 0
Offline Offline

Posts: 197

Building Games


View Profile
« Reply #1 on: June 27, 2009, 01:59:39 AM »

Code:
' FATAL ERROR: Could not find: /home/usr/public_html/game/modules/game/game.php

#0 {main}
I set up the database then put sql in. Edited the config to match. When i load the site i get that error ^. Any idea's why?
Posted in the other thread to.
Logged

Crazy-T
karnedge
Level 17
*

Reputation: 4
Offline Offline

Posts: 170


ctrlHack provides the server, you bring the skill.


View Profile WWW
« Reply #2 on: June 27, 2009, 10:13:00 AM »

Code:
' FATAL ERROR: Could not find: /home/usr/public_html/game/modules/game/game.php

#0 {main}
I set up the database then put sql in. Edited the config to match. When i load the site i get that error ^. Any idea's why?
Posted in the other thread to.

This is because for some reason I set it up for the root of the web-accessible folder. So technically, it can't be under /game/
I'm looking at how I can get it to allow the framework to be in a sub directory...
If you look at the index.php at line 26... it pulling the REQUEST_URI to explode the fake directories for usage

If you dont know, the reason its doing that at all is for (SEF sakes) it loads modules via the URL whatever the user puts in... so...
If you put in www.example.com/account/login it will load _PATHBASE/modules/account/login.php
or www.example.com  will load _PATHBASE/modules/home/home.php
or www.example.com/account/ will load _PATHBASE/modules/account/account.php
etc

I need to make it so the PATHBASE is excluded from the REQUEST_URI
Logged

ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3
karnedge
Level 17
*

Reputation: 4
Offline Offline

Posts: 170


ctrlHack provides the server, you bring the skill.


View Profile WWW
« Reply #3 on: June 27, 2009, 11:03:21 AM »

Alright, replace line 26:
Code:
$URI = explode('/',(string) $_SERVER['REQUEST_URI']);

To the following:
Code:
$URI = explode('/',(string) str_replace(dirname($_SERVER['SCRIPT_NAME']),'',$_SERVER['REQUEST_URI']));

Now you can use the framework outside of the root.

Also, there's a displaced apostrophe at the very end of config.php if you want to delete that. ha
Logged

ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3
Delifisek
Level 9
*

Reputation: 0
Offline Offline

Posts: 45


View Profile
« Reply #4 on: June 27, 2009, 03:32:23 PM »

I download and check.

It was very simple and had very clean coding.

Good work.
Logged
karnedge
Level 17
*

Reputation: 4
Offline Offline

Posts: 170


ctrlHack provides the server, you bring the skill.


View Profile WWW
« Reply #5 on: June 27, 2009, 04:13:33 PM »

I download and check.

It was very simple and had very clean coding.

Good work.

Thank you, the index.php isn't as clean as I would like but it's the best atm.
Logged

ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3
Darklandz
Level 5
*

Reputation: 0
Offline Offline

Posts: 19


View Profile WWW
« Reply #6 on: June 28, 2009, 11:15:04 AM »

Just download it and installed, however when i click one of the links i always get an url error:

Not Found
The requested URL /account/login was not found on this server.


apache error log:
[Sun Jun 28 18:40:37 2009] [error] [client 192.168.0.100] File does not exist: /var/www900/account, referer: http://192.168.0.10:900/


My test server runs on port 900, could that cause the trouble in your code ?
« Last Edit: June 28, 2009, 11:43:18 AM by Darklandz » Logged
karnedge
Level 17
*

Reputation: 4
Offline Offline

Posts: 170


ctrlHack provides the server, you bring the skill.


View Profile WWW
« Reply #7 on: June 28, 2009, 12:43:41 PM »

Just download it and installed, however when i click one of the links i always get an url error:

Not Found
The requested URL /account/login was not found on this server.

apache error log:
[Sun Jun 28 18:40:37 2009] [error] [client 192.168.0.100] File does not exist: /var/www900/account, referer: http://192.168.0.10:900/

My test server runs on port 900, could that cause the trouble in your code ?

It looks more like the htaccess is not being used or parsed. The Apache error is showing that it's actually looking at the subdirectory /account so its not loading the index.php controller.

You may want to check that Apache has rewrite_module enabled.
Logged

ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3
Darklandz
Level 5
*

Reputation: 0
Offline Offline

Posts: 19


View Profile WWW
« Reply #8 on: June 28, 2009, 01:25:34 PM »

rewrite mod is enabled, now i don't get the error anymore , but i just keeps showing the index page with links even if i click the links ...

edit: did some more tests, rewrite mod works fine ... i changed .htaccess to :

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^register modules/account/register.php

and when you point to http://192.168.0.10:900/register it executes the modules/account/register.php.
« Last Edit: June 28, 2009, 02:08:43 PM by Darklandz » Logged
karnedge
Level 17
*

Reputation: 4
Offline Offline

Posts: 170


ctrlHack provides the server, you bring the skill.


View Profile WWW
« Reply #9 on: June 28, 2009, 02:41:37 PM »

Go to the index.php... and try doing putting the following in the beginning:

echo "<pre>";
print_r($_SERVER['REQUEST_URI']);
echo "</pre>";

then go to: http://192.168.0.10:900/account/register

see what shows up...
Which should be '/account/register'
Logged

ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3
Darklandz
Level 5
*

Reputation: 0
Offline Offline

Posts: 19


View Profile WWW
« Reply #10 on: June 28, 2009, 03:50:34 PM »

Go to the index.php... and try doing putting the following in the beginning:

echo "<pre>";
print_r($_SERVER['REQUEST_URI']);
echo "</pre>";

then go to: http://192.168.0.10:900/account/register

see what shows up...
Which should be '/account/register'

/account/register  shows up fine ...
Logged
karnedge
Level 17
*

Reputation: 4
Offline Offline

Posts: 170


ctrlHack provides the server, you bring the skill.


View Profile WWW
« Reply #11 on: June 28, 2009, 05:09:53 PM »

hmm well, it's loading the index.php and htaccess is working...
After line 27 try putting in...

echo "<pre>";
print_r($URI);
echo "</pre>";

...to make sure the URI parsing is working.

If it's showing an array for /account/register as

Code:
Array
(
    [1] => account
    [2] => register
)
« Last Edit: June 28, 2009, 05:15:38 PM by karnedge » Logged

ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3
Darklandz
Level 5
*

Reputation: 0
Offline Offline

Posts: 19


View Profile WWW
« Reply #12 on: June 30, 2009, 06:38:01 AM »

hmm well, it's loading the index.php and htaccess is working...
After line 27 try putting in...

echo "<pre>";
print_r($URI);
echo "</pre>";

...to make sure the URI parsing is working.

If it's showing an array for /account/register as

Code:
Array
(
    [1] => account
    [2] => register
)


ok, just tested it and the output i get is:

Array
(
   
  • =>
)
Logged
Qwerty
Level 12
*

Reputation: 0
Offline Offline

Posts: 90



View Profile
« Reply #13 on: July 06, 2009, 06:36:42 PM »

Well, I get lots and lots of errors, but I'm running PHP 6...

Code:
Strict Standards: Redefining already defined constructor for class Authenticate in C:\AppServ\www1\includes\authenticate.php on line 18

Strict Standards: Non-static method Database::query() should not be called statically, assuming $this from incompatible context in C:\AppServ\www1\includes\settings.php on line 18

Strict Standards: Non-static method Database::getResults() should not be called statically, assuming $this from incompatible context in C:\AppServ\www1\includes\settings.php on line 19

Strict Standards: Non-static method Database::getType() should not be called statically, assuming $this from incompatible context in C:\AppServ\www1\includes\database.php on line 78
Logged

- "I sentance you to life"
- "You moron I'm already alive"
karnedge
Level 17
*

Reputation: 4
Offline Offline

Posts: 170


ctrlHack provides the server, you bring the skill.


View Profile WWW
« Reply #14 on: July 07, 2009, 09:00:45 AM »

I haven't tested it with php 6 yet. That would make sense about the redeclared authenticate since the entire object seems to repeat itself from the module initialization and I don't know why.
Logged

ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3
karnedge
Level 17
*

Reputation: 4
Offline Offline

Posts: 170


ctrlHack provides the server, you bring the skill.


View Profile WWW
« Reply #15 on: July 07, 2009, 04:13:21 PM »

I never realized you should be declaring functions in a static class all static. If you add "static " to all the functions names it should get rid of all those Non-static method errors...

ie; Line 58 in /includes/database.php

Change:
Code:
public function query(){
To:
Code:
public static function query(){

As for the Redefining the constructor... I don't know why it's being redeclared. I noticed it this weekend when I was working on a Session based shopping cart for the in-game stores. When I have it do a GET for the item ID to add to the cart and I have it add +1 to the quantity, it ends up adding 2 instead.

This is obviously very bad, it's also a waste of execution time and resources. The strange this is... if it's repeating itself twice, why don't I see any echo statements more than once? I really need some fresh eyes on the framework.
Logged

ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3
JGadrow
Level 35
**

Reputation: 16
Offline Offline

Posts: 870



View Profile
« Reply #16 on: July 07, 2009, 09:27:42 PM »

The redefined constructor is this line:
Code: (php)
abstract function authenticate ();
In PHP4, constructors were defined using the name of the class and this was retained in PHP 5 for backwards compatibility.

Thus, you define 2 constructors in your class:
__construct ()
authenticate ()
Logged

Idiocy - Never underestimate the power of stupid people in large groups.

karnedge
Level 17
*

Reputation: 4
Offline Offline

Posts: 170


ctrlHack provides the server, you bring the skill.


View Profile WWW
« Reply #17 on: July 07, 2009, 11:29:36 PM »

Thus, you define 2 constructors in your class:
__construct ()
authenticate ()

Omg, you're absolutely right. It's such an empty class, I never even thought about it. All it does is act as a single source to whatever Auth's the specific module uses (ie; Logged in or not) and returns a boolean.

So if you delete line 18 in /includes/authenticate.php you won't have that redeclaration.

Although, I'm still having the problem with the Session int variables going up by 2 instead of 1.

Perhaps, I am not allowed to do this:
Code:
$_SESSION['cart'][$entity['id']]['quantity']++;

It goes up by two when i refresh the page with the $_GET retrieved item ID.

Let me know if you have any other issues. I've noticed there seem to be problems with the in-game links because I set them all locally...
ie; <a href="/account/login">login</a>
And when you load the framework into a subdirectory, this effectively doesn't work as it tries to load from the root of course. Basic HTML 101 I guess.
Logged

ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3
travo
Level 18
*

Reputation: 2
Offline Offline

Posts: 186



View Profile
« Reply #18 on: July 07, 2009, 11:38:51 PM »

Maybe ull have to go thru your code, and everywhere where that variable is even mentioned, print, and see where it is it gets the 2nd from
Logged

JGadrow
Level 35
**

Reputation: 16
Offline Offline

Posts: 870



View Profile
« Reply #19 on: July 07, 2009, 11:54:56 PM »

Let me know if you have any other issues. I've noticed there seem to be problems with the in-game links because I set them all locally...
ie; <a href="/account/login">login</a>
And when you load the framework into a subdirectory, this effectively doesn't work as it tries to load from the root of course. Basic HTML 101 I guess.
There is a simple fix for this. Supply a settings file that is configurable by the end user. Create an entry that allows them to specify a sub directory that the framework resides in. Then you simply supply this with a base tag in the document header:
Code: (html)
<base href="/[sub-directory]/" />
Logged

Idiocy - Never underestimate the power of stupid people in large groups.

Crazy-T
Level 19
*

Reputation: 0
Offline Offline

Posts: 197

Building Games


View Profile
« Reply #20 on: July 08, 2009, 02:32:29 AM »

Quote from: karnedge
Code:
$_SESSION['cart'][$entity['id']]['quantity']++;

I've read a few places that ++$something; is faster then $something++;
Code:
++$_SESSION['cart'][$entity['id']]['quantity'];
If im right someone correct me plz Wink
Logged

Crazy-T
Zeggy
Global Moderator
Level 35
*****

Reputation: 10
Offline Offline

Posts: 1,148



View Profile WWW
« Reply #21 on: July 08, 2009, 02:38:40 AM »

Yes, you are right, but I doubt the difference will ever be noticeable. Smiley
(Unless you are very good with stopwatches)
Logged
Crazy-T
Level 19
*

Reputation: 0
Offline Offline

Posts: 197

Building Games


View Profile
« Reply #22 on: July 08, 2009, 02:48:50 AM »

Yes, you are right, but I doubt the difference will ever be noticeable. Smiley
(Unless you are very good with stopwatches)
Yeah, but its faster Tongue
Logged

Crazy-T
Nox
Level 28
**

Reputation: 10
Offline Offline

Posts: 414



View Profile
« Reply #23 on: July 08, 2009, 03:59:39 AM »

Quote from: karnedge
Code:
$_SESSION['cart'][$entity['id']]['quantity']++;

I've read a few places that ++$something; is faster then $something++;
Code:
++$_SESSION['cart'][$entity['id']]['quantity'];
If im right someone correct me plz Wink

This is called premature optimization... Smiley I was also reading about these things in past but then after one clever post on another forum I realized it's not worth it

....you probably know this and this was just a tiny thing, but I believe it wouldn't hurt to post it here anyway

Quote from: bukaj
What you wrote is called "premature optimization". (aka you focus on nonsense instead of writing functional code). In early stage of project it is important to create a design and write. Optimization in this phase consist of using proper date structures and algorithms. Usually when focusing on these details you omit the complex view on application. Sometimes you really try hard to optimize something only to discover that the bottleneck is somewhere else. Remember the rule 80-20 - 20% of code takes 80% of time of program run. If you discover these and optimize them, you speed up the program much more significantly than when you fiddle about with these insignificant details. Maybe you save a few thousandths, but believe me, it's not worth it. Besides, you can always buy better hardware. And even if the application is still causing performance issues, these little changes will not save it.

(translated ...was from discussion about php/html code performance http://diskuse.jakpsatweb.cz/index.php?action=vthread&forum=9&topic=79397 (I think that from the codes you get the image what is it about))
Logged

Bookmark worthy: Sirlin.net (game design)

Zeggy
Global Moderator
Level 35
*****

Reputation: 10
Offline Offline

Posts: 1,148



View Profile WWW
« Reply #24 on: July 08, 2009, 04:49:04 AM »

Yes, you shouldn't worry about that kind of stuff, like using single quotes or double quotes, and other small issues like that. You won't make a difference.

Also note that in this case, ++$var and $var++ also behave slightly differently. ++$var will increment $var before the rest of the expression is evaluated, while $var++ will increment $var after the expression is evaluated.
Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
SimplePortal 2.2 © 2008-2009
Valid XHTML 1.0! Valid CSS!