Avatar Mod
Moderator: General Moderators
Avatar Mod
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
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.
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.
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.
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.
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
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
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
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"
?>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
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
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.
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.
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
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
which would come out linking to h1_s3_p1.jpg for example..
if u know what i mean
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..
PHP image manipulation would be best.. but its tough..
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">";
?>if u know what i mean
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..
PHP image manipulation would be best.. but its tough..
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
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
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
That's a good questionO yeah, what keeps you guys going even though you have to write thousands and thousands of lines?
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).