Jump to content
Ding

Coding a Hatchery

Recommended Posts

I was considering possibly building a hatchery site. I have a fare bit of html/css coding and such under my belt and wanted to know what exactly went into coding a automated hatchery for eggs and hatchlings.

 

I tried looking it up on the internets and couldn't really find anything substantial. So I was wondering if anyone had any links to say tutorials on coding a hatchery or any place where building one is discussed in detail?

I also tried doing a forum search here on the DC forums and didn't find much either. Also, I hope this is the right place to post this question, if not, my apologies.

 

Any advice would be much appreciated. biggrin.gif

 

 

 

EDIT:

 

 

 

Thought I’d share some links and such for PHP coding, MySQL, setting up servers, etc that we’ve found so far:

 

 

 

 

 

 

 

Soti-Dragon supplied links for guides on PHP and MySQL:

 

http://www.php.net/

(Great for simplistic a intro to PHP coding)

 

 

http://www.pantz.org/software/mysql/mysqlcommands.html

(Lots of commands you can use through PHP and Perl to access your MySQL server)

 

 

 

Ext3h supplied links for HTML and PHP coding:

 

http://selfhtml.org/

(Great for getting your feet wet with HTML coding)

 

http://tut.php-quake.net/en/

(PHP tutorials)

 

 

Some other helpful links:

 

 

 

PhPacademy on YouTube

(Basic to advanced tutorials on coding with PhP)

 

 

http://www.webdevelopersnotes.com/tutorials/sql/index.php3

(Handy MySQL beginners guide. How to access, make databases, make tables, add entries to tables, etc using the command prompt directly in a MySQL server. )

 

 

http://www.tizag.com/mysqlTutorial/mysqldatabase.php

(Guide to using PHP coding to access, change entries, etc to a MySQL server.)

 

 

http://www.tagbytag.org/tutorials/getting-...mp-installation

(WAMP is an all in one package I found that sets you up for your own MySQL server. I found it’s pretty easy to use. I’m using this right now as a learning tool because basically it will make your computer a server…which is awesome but not practical in the slightest if you want to host your own site and handle any sort of traffic. Once again, just something to learn with.)

 

 

http://dragcave.net/api.txt

(This a link to the API guide for when you want to set up your fansite to work with DC. This is all of course after you get access to the API key from TJ.)

 

 

http://www.w3schools.com/

(W3 has been teaching anything and everything about coding for as long as I can remember.)

 

 

More to come!

Edited by rubyshoes

Share this post


Link to post

I don't know of any place that will assist you in making your own hatchery, but I'm guessing that you can learn from this:

 

http://www.jaemeia.net/er/geter.php

 

It gives you codes so you can add an ER to a page, although this can easily be used as just a regular hatchie if I'm not mistaken.

 

Hope that helps!

Share this post


Link to post

I would say your coding language depends on which platform your host will provide.

 

Also, amke sure you use a host that allows a lot of traffic, because if you code it well, and if people get into it, you can end up doing a lot of traffic.

 

If you are using windows, you could code in ASP and other such languages.

 

I prefer *nix based systems. The server I own uses linux. But unix works just as well.

 

If you are using a *nix based system, the easiest to code in is PHP, although you could probably use java or some other sort of language, such as perl even bash if you can code the cgi well enough.

 

PHP can also be used on some windows boxes.

 

So first find a host that will allow you to run the coding languages you chose to use.

 

My site was coded in PHP. So that is what I would recommend learning.

 

HTML and CSS coding is good to make it pretty, but you are going to want one of the languages above to do some server side programming. HTML and CSS will still be required to display to the webrowser.

 

You might also want to use a database such as MYSQL or ORACLE or POSTGRESQL. Again I use MYSQL, but there are a lot of one to use.

 

The basic setup ...

 

ENTERING INFO TO THE SITE

 

Create a form in html

Send info to PHP file

run any checks on the code that you want to perform.

enter into the database

display error or success message.

 

DISPLAYING INFO FROM THE SITE

 

create php script to grab information from the database

display on page

 

 

That's basically it.

 

If you chose to use PHP as I did, and as most sites do (including DC), then you can have a look at this site: http://www.php.net/

 

If you want some mysql help, I would say have a look at this site: http://www.pantz.org/software/mysql/mysqlcommands.html

 

But with those two links, plus some html (css optional), then you can make a self serve hatchery.

Share this post


Link to post

I've been wondering on how to make a hatchery myself too. There's one thing in particular I have been wondering about: Do you NEED API access? I assume that you'd need it to automatically read scrolls and display the sprites?

 

Thanks for the help!

Share this post


Link to post

API access gets you a lot of details, there were always more details that I wanted in the API, but it gets you a lot of them.

 

The other alternative is page scraping, that will also get you the information you need.

Share this post


Link to post

So... For a simple display (Hatchery/ER) you wouldn't need an API access key?

 

I've checked the API file and at the moment I'm not really sure I'd want to include all the extra information. First I'd like to make a Hatchery/ER/Viewer to simply display the dragons and give people the chance to click them.

 

Or do you need to be able to determine if an egg is fogged/dead/adult?

 

Thanks again for the help!

Share this post


Link to post
But with those two links, plus some html (css optional), then you can make a self serve hatchery.

Soti you are awesome! Thanks so much for all the info. Yeah I had a pretty good feeling some advance coding was going to come into play for building a hatch site. My knowledge of PHP is extremely limited so this will be a great chance to learn it and hopefully sometime soon come out with something polished.

 

Thanks again!

Share this post


Link to post
Soti you are awesome! Thanks so much for all the info. Yeah I had a pretty good feeling some advance coding was going to come into play for building a hatch site. My knowledge of PHP is extremely limited so this will be a great chance to learn it and hopefully sometime soon come out with something polished.

 

Thanks again!

I am not offering to code it for you, I have too many other things going on right now, but if you do get stuck, then feel free to send me a message, and I will have a look and see what help I can give you.

Share this post


Link to post

@Soti

I tried page scraping and TJ has blocked all access that way.

 

@Sheriziya

No, you do not need to have API access to start a hatchery. You can have them manually enter the codes and someone would have to go in and manually remove them. You won't have any of the neat features of getting a person's dragons by their scroll name, or posting what time they have left, etc. Until recently on Pets Galore, that's how we ran our hatchery and er. People put them in, we had to go in and clean them out at least twice a day, preferably more often. The images you just use the html code for the image and replace the code from the database so the image loads.

Share this post


Link to post
@Soti

I tried page scraping and TJ has blocked all access that way.

Odd, because it works in the ER that I setup.

Share this post


Link to post

Odd, because it works in the ER that I setup.

Well, all I can say is that it worked on my personal site, but not on PGS. The API access works though. So maybe he actively blocked out sites with not API access from scraping? Still, for someone starting a Hatchery, I wouldn't suggest it as an only option. Sorry, that is what I was trying to mean.

 

Edit: Since that made little sense, the scraping I tried before I got API access and was denied. With the new API, I was given access and haven't tried scraping since.

Edited by zamirathe

Share this post


Link to post

I wasn't suggesting that page scraping was the only way, or the best way, it really all depends on what they are trying to do, and as to whether they want to use the API.

 

TJ does on occasion block sites from page scraping, trying to force them to use the API.

 

Once he blocks the ER I setup from page scraping, that is when I will withdraw all support and assistance to DC, and will consider it just another chapter finished. Kind of like when Boramir gets killed in the Lord of the Rings, we hear mention of him again from time to time, but no-one really cares, cos the character is dead.

Share this post


Link to post
I am not offering to code it for you, I have too many other things going on right now, but if you do get stuck, then feel free to send me a message, and I will have a look and see what help I can give you.

Oh no I wasn't suggesting that you were nor did I expect that you were going to biggrin.gif . I was just saying you were awesome for sharing your methods with me. Which I appreciate you taking the time to do.

 

 

Totally, if I run aground at some point, which I more then likely will lol, I'll send it your way.

 

 

Quick question...lets us say hypothetically this site does get popular and sees a lot of traffic, how much bandwidth would you say it should have to meet the demand? Like what's a good amount to aim for when looking for a host?

Share this post


Link to post

Does anyone know a good HOST to make the site on? If anyone does I'll be the happiest person in the DC! biggrin.gif

Share this post


Link to post
Oh no I wasn't suggesting that you were nor did I expect that you were going to biggrin.gif . I was just saying you were awesome for sharing your methods with me. Which I appreciate you taking the time to do.

 

 

Totally, if I run aground at some point, which I more then likely will lol, I'll send it your way.

 

 

Quick question...lets us say hypothetically this site does get popular and sees a lot of traffic, how much bandwidth would you say it should have to meet the demand? Like what's a good amount to aim for when looking for a host?

My server did anywhere between 150-200 GB of traffic a month when the Soti Fansite was running ... admittedly I have other things on the server as well ... but about 95% of my traffic was DC related.

 

So I would look for something that lets you do that much traffic.

Share this post


Link to post

Hey Soti and Zamirathe,

 

Thanks for all the great help! I've decided to go ahead and build a hatchery. I'll be coding in PHP smile.gif I think I'll start with a hatchery where people can add the 4-digit codes themselves. If that works, I'll progress to asking API access and reading people scrolls. Now that last part is a neat puzzle to look forward too!

 

The only thing I'm really puzzled about is the viewer part.... I'll have to figure out a way to display a certain amount of dragons at the same time, preferably random smile.gif I think that will be the hardest part of the puzzle to figure out. But hey, that's all part of the fun smile.gif

 

Good to know I'll need a host who will allow about 200 GB transfer monthly. Who knows how it will all work out!

 

@Ding: Have fun coding!

Share this post


Link to post

Viewers are easy.

 

A simple database query in PHP

 

$blah = mysql_query("SELECT * FROM table_name ORDER by rand() LIMIT dingo");

 

The blah is your variable to grab the information. Parse it through mysql_fetch_array or mysql_fetch_object and a loop if need be.

 

table_name is your database table

rand() is to give you random ones to be fair on everyone

dingo is the limit you want to set.

 

bingo! viewer made ...

 

Can use JavaScript to make the page refresh, the problem with that is ... a lot of people disable javaScript because JavaScript is designed to use the users browser and the users os to manipulate the page. For a guarenteed way, even if JS is disabled on the users PC, is to place a refresh into the meta tags.

 

<meta http-equiv="refresh" content="5;url=bob.php">

 

bob.php should be the name of the page you want refreshed. This is also a good way to do a redirect after a certain period of time.

 

Hope that helps.

Share this post


Link to post

@Soti

Ow, wow! Thanks smile.gif I had no idea it would be that easy! I guess it's really time to build that table now. Working on that. I'll need to decide how many items I want to include in the table. I'm thinking about:

Dragon ID (is the four digit code)

Address of dragon page (automatically filled in by the script with addition of the dragon code)

Address of image (automatically filled in by the script with addition of the dragon code)

That's about it, I guess, for a simple hatchery display

 

Of course for the future (in case of API access) it would be:

Scroll name

Address of Scroll

Dragon ID

Address of dragon page (automatically filled in by the script with addition of the dragon code)

Address of image (automatically filled in by the script with addition of the dragon code)

And all the other information that would be handy to display.

 

Thanks everyone for the great help! It's wonderful that everyone's so willing to help out with the coding questions smile.gif

 

edit to add: Well, it turns out API is out of the question. The free host I found doesn't give API keys. Too bad sad.gif

Edited by Sheriziya

Share this post


Link to post
@Soti

Ow, wow! Thanks smile.gif I had no idea it would be that easy! I guess it's really time to build that table now. Working on that. I'll need to decide how many items I want to include in the table. I'm thinking about:

Dragon ID (is the four digit code)

Address of dragon page (automatically filled in by the script with addition of the dragon code)

Address of image (automatically filled in by the script with addition of the dragon code)

That's about it, I guess, for a simple hatchery display

 

Of course for the future (in case of API access) it would be:

Scroll name

Address of Scroll

Dragon ID

Address of dragon page (automatically filled in by the script with addition of the dragon code)

Address of image (automatically filled in by the script with addition of the dragon code)

And all the other information that would be handy to display.

 

Thanks everyone for the great help! It's wonderful that everyone's so willing to help out with the coding questions smile.gif

 

edit to add: Well, it turns out API is out of the question. The free host I found doesn't give API keys. Too bad sad.gif

I think you have to get the API key from the dragcave owner not your webhost.

Share this post


Link to post

@Derek: Yeah, I've misread TJ's file about it. I've just reread it and the Key thing I have to give is something different.

 

But first I'm gonna make a system where people can add/remove codes from their dragons. And from there on I'll progress smile.gif

 

Anyway, thanks for your help!

Share this post


Link to post

@Sheriziya thanks for the well wishes, good luck to you as well!

 

 

I've been looking at so much PHP code I think my head is going to explode haha. But I'm learning a ton so it's pretty awesome.

 

Here's a question I can't seem to find the answer to...let's say I wanted to have this hatchery site automatically remove eggs from the database after like 3 days or so, how exactly do I go about that?

 

Is it something where I log a time stamp entry when a viewer enters their egg data, then create a script that runs every three days or runs all the time checking if an entry is three days old and then removing it automatically?

 

I mean granted I could just have users remove their eggs by hand after three days or do it myself. But if I could figure out some sort of auto purge system that would be really neat.

 

 

Share this post


Link to post

Hello. I am making an ER and Hatchery for DC and I have API Access. I have my own website that can handle PHP. I just don't know how to USE the API. (Nor how to code an ER and such) Can anyone help me?

Share this post


Link to post
Hello. I am making an ER and Hatchery for DC and I have API Access. I have my own website that can handle PHP. I just don't know how to USE the API. (Nor how to code an ER and such) Can anyone help me?

How did you get API? I am needing that for my site.

Share this post


Link to post
How did you get API? I am needing that for my site.

I requested access. I got it but I don't know what to do from this step. sad.gif

Share this post


Link to post

  • Recently Browsing   0 members

    No registered users viewing this page.