[Closed] Extracting images/pictures for flash game from a database?

VioletYuki

  • Posts: 27
Edit: Project is over ~ and of course i didn't do the extracting of database thing.
*Thread close*


I'll do what the teacher had requested,
extracting images from the database for the game so that when 3rd party changes the images in the database, the game's images also changes.

I now need to know/learn how to use stencyl to extract images from a database.
E.g. Extracting an actor(image) that would be used/call upon by the behaviors.

Please teach/guide me. Or any tutorial links.
I have no knowledge on actionscript3 , and was happy that i can even create a flash game with stencyl.


Is stencyl works able to extract the game's pictures/images from a database?

For example,
This flash game shows the items needed to make a product.
And sometimes, the items needed changes,
instead of re-importing a new image for the item,
is it possible to extra the new image from a database.
.
.
.
P.S. My school teacher asked me this question when my group presented the flash game.

« Last Edit: February 03, 2012, 12:09:18 am by VioletYuki »
Must complete my flash game for my major project ! RAWR!

RayonMazter

  • Posts: 123
Yes, it is possible to work with databases in flash - therefore stencyl as well no doubt.

However, flash files are local to the client, while databases are usually serverside. This would allow the client to have access to the security information to the database, which is obviously not ideal, but if you limited user interaction to the database to read-only, I suppose it wouldn't be too much of an issue.
Personally, I think it might be better (and easier to implement) to retrieve database information through a php script query that's executed through the flash client though, as you would be able to edit that without making changes to the game client.

Are you looking for assistance on doing this? or just theory behind it?

VioletYuki

  • Posts: 27
oh wow.. the difficulty.
It seems extremely difficult.
My school teacher said that it would be good if i could link the flash to the database.

Because at the end of the day, the flash game created would be handed to a 3rd party.
so if the 3rd party wanted to add a new/edit product, they can edit it from the website/database.

My project also have a website that uses php query to take out information for login issue.

So...
if i want to implant it,
i would have to write my own codes because the design blocks can't initiate it right? 

Edit: My team members asked, our site uses php codes to run the flash game.

So my question is , how do you use the php codes to retrieve info and to "link" it to the game?

« Last Edit: December 07, 2011, 01:11:43 am by VioletYuki »
Must complete my flash game for my major project ! RAWR!

RayonMazter

  • Posts: 123
Hi there.

Quote
the flash game created would be handed to a 3rd party

Strange that your teacher says that. If you were to get a sponsor (and get paid for it), the sponsor would usually just ask you to change the image. Linking a flash game to an external database when the game itself could travel onto 100,000 flash portals seems like an odd way to go.

But to answer your question,
you can link to a remote image in flash, using a loader to the php file.

In the php file, you would connect to the database, retrieve the imagedata, and OUTPUT the data 'as' an image (php is great like that).

Take a look at: http://php.net/manual/en/function.imagepng.php
So at the end of the script you put the 'imagepng($imagedata);' and the script 'acts' as a direct image.

Quote
because the design blocks can't initiate it right? 
It can be done directly from flash (without requiring php). It's just it requires secure connections, so isn't the best solution in my opinion.

VioletYuki

  • Posts: 27
oh no .. that means using adobe flash ?
or editing from stencyl "codes" area ?

my brain can't get the linkage between stencyl to php database.

Quote
If you were to get a sponsor (and get paid for it), the sponsor would usually just ask you to change the image
maybe i could use this to "argue" back with the teacher.
it's the game is one of the products for my major project.

i'm thinking because, it would means "you are still locked into the project" instead of "being free from the project". 
Must complete my flash game for my major project ! RAWR!

RayonMazter

  • Posts: 123
Quote
oh no .. that means using adobe flash ?
or editing from stencyl "codes" area ?

It's possible in either.

I just don't understand the database approach for a (assuming: Single player) game.

You could have the game load local files that the company/sponsor could just replace as well, or a config file..

I have 2 multiplayer rpg flash games out there using databases for account/character/log storage [serverside], but for holding image data? No way.

It's possible, but to no meaningful client-side purpose for a flash game.

ShivaFang

  • Posts: 248
It makes sense for a multiplayer game with a lot of images, such as a card based game or a game with lots of monsters/areas to reduce initial loading times.  You could then load the images on the fly and only what you needed.

However you are right for single player games.  Single player games are supported by ads, and it's more profitable to send them to as many portals as possible - to load images from your server would be a terrible waste of bandwidth!  (Not to mention if your server goes down for any reason your whole game is worthless, wheras imbedded issues don't have that problem)

It's possible in a classroom setting that this is a theory excersise with little practical use.  A "This is what you'd do if you have a client who asks you to produce a product with this feature", rather than "This is the best way to program a game."
Justin "ShivaFang" White
Aquamentos Games - The origin of challenging Strategy and Role-Playing Flash gaming!
Visit our Developer Blog and Google+ Page!

VioletYuki

  • Posts: 27
well. . i'll just do what the teacher had requested. Please teach/guide me on how to do it .

I just need to know how to use stencyl to extract images from a database.
E.g. Extracting an actor(image) that would be used/call upon by the behaviors.

I'm totally clueless on it. .
Must complete my flash game for my major project ! RAWR!

VioletYuki

  • Posts: 27
Bump ~

I'm left with just 2 weeks to solve this issue on extracting actors/image from a database(MySQL) into the flash game with Stencyl..
Must complete my flash game for my major project ! RAWR!

docskull

  • Posts: 65
Connecting flash to MySQL through PHP ain't hard, I have done it before, but it's not done with stencyl blocks (unless you mean the "code" block of course), you will need to write the code. Just google "connecting flash to MYSQL with PHP" should help ya.

You will need a host server with PHP installed to test it. (a local Apache might do)