Page 1 of 1

Avatar Mod

Posted: Thu Jan 15, 2004 7:49 pm
by dr4gon
Hi, I'm new to php and I came across this site http://www.go-gaia.com and the developer coded a mod of his own somehow where users select an avatar and as they gain more gold they buy items from the shop to dress their avatar. Very few of anyone can in the develpment community can code somethign liek this and I was wondering if you guys can tell me the basic outline on how I would start. Thanks

Posted: Thu Jan 15, 2004 10:26 pm
by Gen-ik
The actual coding required to do this isn't too difficult to do, it's a simple case of recording the players (users) progress and updating/changing the avatar based on the players status etc.

The difficult bit, or part which will take the most time, is creating all of the individual images required to build the various avatars and in-game graphics.

Building the actual avatar image can be done by loading the required images into PHP and using something like GD (for example) to build a single/new image from all of the smaller graphics.

If you a new to PHP though then this probably isn't going to be easy for you to do and I would suggest starting with something a bit more easy before you jump into a project of this size.

Posted: Fri Jan 16, 2004 12:00 am
by dr4gon
Man, I really needed this mod for my site so users can make custom avatars. I have all the images and stuff ready such as clothing and stuff, i just need the script where users earn gold with participation and customize. Can anyone help me out, I promise i'll owe you one :)

Posted: Fri Jan 16, 2004 2:31 am
by McGruff
If you want help with programming in php post queries about script problems in this board.

If you are looking for someone to write a script for you try the project help board (for volunteers) or job hunt board (you pay).

Promising "I'll owe you one" comes in as project help I think. I doubt if that will be a tempting prospect.

Posted: Fri Jan 16, 2004 5:13 am
by malcolmboston
doing something like this as your first php program is not advisable as it will only end in tears

i suggest if you really want to do it yourself, do simple stuff and work your way up to loops, expressions etc, at least things that are'nt

Code: Select all

<?php
print "Hello World"
?>
isnt that example the lamest ever!?

anyway, image manipulation is a notoriously difficult area of PHP, and even i wont attempt it yet as i know ill end up throwing my PC out of the window, and yes i need to be able to do things with images as well

what im trying to say is take note of what these guys area saying, they know what theyre talking about, dont attemp it without any prior experience, also i very much doubt you will find any software like that for download as it is highly customised

just my 2 cents

Posted: Fri Jan 16, 2004 5:42 am
by Straterra
He he he, forgot your ; after Print "Hello World!"

Posted: Fri Jan 16, 2004 6:09 am
by malcolmboston
it doesnt matter there was nothing after it, lolol

Posted: Fri Jan 16, 2004 6:41 pm
by dr4gon
umm, i said i was new to php but i already knew most those basics, i can't write basic hit scripts, and ad management scripts and stuff. I just don't know how to like make it so this accesses this, then outputs this and jumps around and stuff.

Posted: Fri Jan 16, 2004 6:49 pm
by Gen-ik
You need to think about how it's going to (or should) work before you get stuck into the coding... especially with a project like this.

I guess the basics would be...
>> Load user info from database.
>> Check the value of the avatar info.
>> Build avatar using GD (or similar).

Starting points would be [php_man]mysql[/php_man] and [php_man]GD[/php_man]. Check'em read'em learn'em.

Posted: Fri Jan 16, 2004 7:40 pm
by d3ad1ysp0rk
if there werent too many options (ie. maybe 3 shirts, 3 pants and 3 hats) then you could have 27 different images..

h1_s1_p1.jpg
h1_s1_p2.jpg
h1_s1_p3.jpg
h1_s2_p1.jpg

etc

and then store the variables as "hat" - "shirt" - "pants" in the db (a #, 1-3) and then echo out

Code: Select all

<?php
echo "<img src="imgs/avatars/h" . $hat . "_s" . $shirt . "_p" . $pants . ".jpg">";
?>
which would come out linking to h1_s3_p1.jpg for example..

if u know what i mean :P

but anymore than 3 of each and it just gets ridiculous.. cuz i dont think u wanna spend hours in photshop copying and pasting all the outfits together.. :P

PHP image manipulation would be best.. but its tough..

Posted: Fri Jan 16, 2004 7:55 pm
by dr4gon
Yeh that sounds good enough on the outfit thing using gd commands. I'll get started and I'll coem back when i reach the part about connecting it with the shop mod. Thanks

Edit:
Ok here's how i see.
1) I have to define a few variables. A few for the clothing pieces, and the final variable as the output of the final image for their avatar.
2) I need to create an html page where users select their items and stuff and put it onto their character, and the final image will be saved and outputted as the avatar, which will later be pulled up onto the screen where the avatar variable is placed.

Here are a few things i'm uncertain about
1) In their inventory they'll have a save button where each time they save it, the image will be outputted and saved in the database.
2) How do I connect zarath's shop mod, so that items will be identified as hat shoes shirt or whatever and will be generated by gd in the proper spot.

O yeah, what keeps you guys going even though you have to write thousands and thousands of lines?
Thanks

Posted: Fri Jan 16, 2004 9:39 pm
by d3ad1ysp0rk
O yeah, what keeps you guys going even though you have to write thousands and thousands of lines?
$$? wanting to make something for the fun of it? It's our jobs? :P

Posted: Fri Jan 16, 2004 9:50 pm
by Gen-ik
O yeah, what keeps you guys going even though you have to write thousands and thousands of lines?
That's a good question :)

For me personally it's a creative thing, I like composing/producing music, I like creating interactive websites and games using Flash/JS/PHP. Trying to come up with something new and fresh/original is also something that keeps me going.

I think programmers fall into one of two areas... those who simply do it for money (soul-less robotic programming) and those who do it just because they like doing it (creative freestyle experimental programming).

Posted: Fri Jan 16, 2004 10:08 pm
by dr4gon
Well, do what you like, why would you wanna be stuck with a job you hate.