ROChargenPHP - Free PHP Character Viewer

Awesome! Thank you very much KeyWorld!
You're welcome !

I forget to talk about three known problems related to PHP GD (it sucks !).

I show you this problems in only one monster : The Bloody Knight !

 
1268.png


[*]Do you see the fire ? There is a white rectangle around. this problems occurs on RGBA images in Sprite files when you try to merge them with the main image.

[*]Check the shield, there is a white border around it. When rotating an image it's possible to have this problem : the image border is merging with the transparent background (which is white) and cause this bug. I replace the transparent background by a transparent white background to avoid getting a magenta border (or other flashy border).

[*]Check the shield again, poor quality ! Due to image rotation + image scale.

The problem n°1 just occurred in some monsters (effects), I don't think there is one hat or character using RGBA frames for now in RO.

The problem n°2 and 3 can occurred in all monsters/characters, depend of the scale and rotation.

To conclude, PHP GD sucks, I have noone of this problems in javascript (<3).

 
Addded a debug mode to trace errors in the latest version if you have problem installing it.

Just open index.php and uncomment the line:

// Set on the debug//Debug::enable();
Once it's done you will have access to all debugs, infos and errors:

debug.png


Hope it helps
default_smile.png


 
awesome release Keyword
default_happy.png
 ... where to upload the grf's?

 
Last edited by a moderator:
Updates :

  • Correct 3rd job file name.
  • Robes are now fully working (it was missing the inherent job list).
  • Background color can be change in RORender::$background_color.
  • Add htaccess to avoid access to client directory (if you have content you don't want to share...)


Suggestions ? Bugs ? Problems ? Report it
default_smile.png


 
Hello,

i have little problem when i try to make any image it's says:

The image http://xxx.com/rochar/avatar/hemagx cannot be displayed because it contains erros

:/

EDIT:

Error Log :/

Code:
[02-Aug-2013 09:49:44 America/New_York] PHP Notice:  Undefined variable: _D in /home/xxxx/public_html/rochar/index.php on line 52[02-Aug-2013 09:49:55 America/New_York] PHP Notice:  Undefined variable: _D in /home/xxxx/public_html/rochar/index.php on line 52[02-Aug-2013 09:50:34 America/New_York] PHP Notice:  Undefined variable: _D in /home/xxxx/public_html/rochar/index.php on line 52[02-Aug-2013 09:51:44 America/New_York] PHP Notice:  Undefined variable: _D in /home/xxxx/public_html/rochar/index.php on line 52[02-Aug-2013 09:51:51 America/New_York] PHP Notice:  Undefined variable: _D in /home/xxxx/public_html/rochar/index.php on line 52[02-Aug-2013 09:51:51 America/New_York] PHP Fatal error:  Call to a member function prepare() on a non-object in /home/xxxx/public_html/rochar/core/class.Controller.php on line 95[02-Aug-2013 09:52:03 America/New_York] PHP Notice:  Undefined variable: _D in /home/xxxx/public_html/rochar/index.php on line 52[02-Aug-2013 09:52:03 America/New_York] PHP Fatal error:  Call to a member function prepare() on a non-object in /home/xxxx/public_html/rochar/core/class.Controller.php on line 95[02-Aug-2013 09:53:40 America/New_York] PHP Notice:  Undefined variable: _D in /home/xxxx/public_html/rochar/index.php on line 52[02-Aug-2013 09:53:41 America/New_York] PHP Fatal error:  Call to a member function prepare() on a non-object in /home/xxxx/public_html/rochar/core/class.Controller.php on line 95[02-Aug-2013 09:55:52 America/New_York] PHP Notice:  Undefined variable: _D in /home/xxxx/public_html/rochar/index.php on line 52
 
Last edited by a moderator:
@hemagx
You should at least check what you wrote in the configs, the error is from you, not from me.

@all
Fix an error on the lastest version with doridori and body animation.
Add a generator, to create your own characters, can be used in a char simulator for example:
Just complete the url: /generate/body=M-0-0/hair=0-0-0/hats=0-0-0/equip=0-0-0/option=0/actdir=0-0-0
Info: /generate/body=<sex>-<job>-<clothes color>/hair=<hair style>-<hair color>-<doridori>/hats=<hat top>-<hat middle>-<hat bottom>/equip=<weapon>-<shield>-<robe>/option=<option>/actdir=<direction>-<action>-<animation>

Have fun~

 
Happy to see you like it !
default_smile.png


where can i put the custom display can someone teach me
 Without using the core files and controllers, you have to do this (good to build a char simulator as ratemyserver has) :

Code:
<?php
 
define('__ROOT__', dirname(__FILE__) . '/'); 
 
 
// Loading CORE files
require_once( __ROOT__ . 'core/class.Controller.php');
require_once( __ROOT__ . 'core/class.Cache.php');
require_once( __ROOT__ . 'core/class.Client.php');
require_once( __ROOT__ . 'core/class.DB.php');
 
 
// Initialize the client (load GRF, load DB, etc.)
Client::init();
 
 
// What do you want to display ?
// Full Character ?
// So include the render needed
require_once(  __ROOT__ . 'render/class.CharacterRender.php' );
 
 
// Set up the header
header('Content-type:image/png');
 
// Since you use class.CharacterRender, use it :
$chargen                 = new CharacterRender();
 
// Set your datas here
$chargen->action         = CharacterRender::ACTION_READYFIGHT;   // You can see constants in
$chargen->direction      = CharacterRender::DIRECTION_SOUTHEAST; // render/class.RORender.php
$chargen->body_animation = 0;
$chargen->doridori       = 0;
$chargen->sex            = "M";
$chargen->class          = 4002;
$chargen->clothes_color  = 0;
$chargen->hair           = 5;
$chargen->hair_color     = 12;
$chargen->head_top       = 0;
$chargen->head_mid       = 0;
$chargen->head_bottom    = 0;
$chargen->weapon         = 0;
$chargen->shield         = 0;
$chargen->robe           = 0;
$chargen->option         = 0;
 
 
// Generate the image and display it
$img = $chargen->render();
imagepng($img);
 
?>
I tested that script, its not working.

At first there was an error about missing class.debub.php, which was easy to fix.^^

now all i get is an empty white square on my screen. Any ideas how to fix that ?

 
@snowflake1963

Just add your fullclient informations to be able to load and extract files ?

//- ClientClient::$path = __ROOT__ . "client/" ; // Define where your client path is (where you put your grfs, data, etc.)Client::$data_ini = "DATA.INI" ; // The name of your DATA.INI (to locate your grfs, if not set: grfs will not be loaded)
Thank you guys
default_smile.png


 
Hi man thanks for this incredible tool !!!!!  But only one little question .... 

Could the character avatar has movement ? Using which url ?

To show a monster is :   index.php/monster/poring ?

Thanks in advance

 
I was trying but i don't see if it's possible to get an animated image.... 

 
Last edited by a moderator:
Not possible currently to generate an animated image. Some reasons for it:

- too intensive and memory consuming to generate X images for an animation.

- gif can contain only 256 colors when a sprite is 256 * elements (without talking about rgba frames).

- not possible to know when to loop the animation since each animated elements (body, hats) have a differents animation duration.

It can be done client side using javascript but downloading spr/act pal is already too much in my opinion.

To display monster it's the id you have to use : /monster/1002

 
@snowflake1963

Just add your fullclient informations to be able to load and extract files ?

//- ClientClient::$path = __ROOT__ . "client/" ; // Define where your client path is (where you put your grfs, data, etc.)Client::$data_ini = "DATA.INI" ; // The name of your DATA.INI (to locate your grfs, if not set: grfs will not be loaded)
Thank you guys
default_smile.png
I used the script as YOU posted it in #9: ( I allow myself to quote it again
default_smile.png
)

<?php define('__ROOT__', dirname(__FILE__) . '/'); // Loading CORE filesrequire_once( __ROOT__ . 'core/class.Controller.php');require_once( __ROOT__ . 'core/class.Cache.php');require_once( __ROOT__ . 'core/class.Client.php');require_once( __ROOT__ . 'core/class.DB.php'); // Initialize the client (load GRF, load DB, etc.)Client::init(); // What do you want to display ?// Full Character ?// So include the render neededrequire_once( __ROOT__ . 'render/class.CharacterRender.php' ); // Set up the headerheader('Content-type:image/png'); // Since you use class.CharacterRender, use it :$chargen = new CharacterRender(); // Set your datas here$chargen->action = CharacterRender::ACTION_READYFIGHT; // You can see constants in$chargen->direction = CharacterRender::DIRECTION_SOUTHEAST; // render/class.RORender.php$chargen->body_animation = 0;$chargen->doridori = 0;$chargen->sex = "M";$chargen->class = 4002;$chargen->clothes_color = 0;$chargen->hair = 5;$chargen->hair_color = 12;$chargen->head_top = 0;$chargen->head_mid = 0;$chargen->head_bottom = 0;$chargen->weapon = 0;$chargen->shield = 0;$chargen->robe = 0;$chargen->option = 0; // Generate the image and display it$img = $chargen->render();imagepng($img); ?>
AND since i am a php-n00b/newbie i hoped this script will work without further edition.

mfg

Snowflake

 
@snowflake1963

There were some updates since this post, it require now to include the Debug class, and define where is locate your fullclient:

Code:
<?phpdefine('__ROOT__', dirname(__FILE__) . '/');// Loading CORE filesrequire_once( __ROOT__ . 'core/class.Controller.php');require_once( __ROOT__ . 'core/class.Cache.php');require_once( __ROOT__ . 'core/class.Client.php');require_once( __ROOT__ . 'core/class.DB.php');require_once( __ROOT__ . 'core/class.Debug.php');  Client::$path         =     __ROOT__ . "client/" ;   // Define where your client path is (where you put your grfs, data, etc.)Client::$data_ini     =     "DATA.INI"           ;   // The name of your DATA.INI (to locate your grfs, if not set: grfs will not be loaded)Client::init();  // What do you want to display ?// Full Character ?// So include the render neededrequire_once(  __ROOT__ . 'render/class.CharacterRender.php' );  // Set up the headerheader('Content-type:image/png'); // Since you use class.CharacterRender, use it :$chargen                 = new CharacterRender(); // Set your datas here$chargen->action         = CharacterRender::ACTION_READYFIGHT;   // You can see constants in$chargen->direction      = CharacterRender::DIRECTION_SOUTHEAST; // render/class.RORender.php$chargen->body_animation = 0;$chargen->doridori       = 0;$chargen->sex            = "M";$chargen->class          = 4002;$chargen->clothes_color  = 0;$chargen->hair           = 5;$chargen->hair_color     = 12;$chargen->head_top       = 0;$chargen->head_mid       = 0;$chargen->head_bottom    = 0;$chargen->weapon         = 0;$chargen->shield         = 0;$chargen->robe           = 0;$chargen->option         = 0;  // Generate the image and display it$img = $chargen->render();imagepng($img);?>
 
Back
Top