Jump to content
xisto Community
Feelay

3d And Php

Recommended Posts

Hey!I wanted to know if I could mix 3D and PHP.Because I want to do the following thing:I want to make a text based game. Butthis time, I wanted to do it special.I was wondering if there is a way to make a 3D scene execute when I press a form button?and if yes, is it possible to do it, without updating the whole page?example:I press the fight button. Then a scene, with two characters appear, in 3D. then, outside of that window, there is a html coded attack form button. I press that button, and then the PHP script make another scene appear, without updating the page, where my character attack the other character, and then again it return to the first scene. I am not sure if this can be done in PHP. but I think it is possible. If not, can anyone please tell me what language I need to use?And OFC :mellow: can anyone please tell me how to do it (A)

Edited by Feelay (see edit history)

Share this post


Link to post
Share on other sites

I suppose you could have the Fight button open an iframe or div or something that calls a Flash "movie" with a 3D scene with controls within the Flash movie. You can program a small close button on the top of the div/iframe with JavaScript to close the 3D scene. This way the whole page doesn't have to reload.

Share this post


Link to post
Share on other sites

sorry :mellow: but i didn't understand that much =/my friend is designing in maya, and I have no idea if it is possible to make a flash movie out of maya scenes. and how can I open an iframe? what is an iframe :D?and I guess the window that will open, have nothing to do with the actual server scripts. I don't know. I'm kinda newbie.I mean the hp and stuff. will they reload from the database after every attack, and be visible in the window?

Share this post


Link to post
Share on other sites

PHP is a server-side language so if you want to change something via php then the whole page has to be re-rendered by the server. What you need is a client-side language like Javascript. With Javascript you can have the html code altered on the fly.However, you're creating a text-based game so you'll probably be using a database to store the data and I guess you're doing that everytime a player attacks or makes a move, not ? So basicaly it's easier to reload a page with the animation you want (correct me if I'm wrong :mellow: ).

Share this post


Link to post
Share on other sites

ok then.. if updating the page everytime is the only solution, I think thats the only thing I can do.. but how can I make it load very fast then? and.. how can I make the 3D scene get connected to the buttons?I want it to look like it's only 1 scene (hope you understand..). you know almost like a final fantasy game, but text based.

Share this post


Link to post
Share on other sites

The best that you can hope for to Programmatically display a video of what ever you wish displayed. These videos, however, will have to be pre-rendered. Thus what ever you wish to have displayed you wil have t o have a video or image for already made, loaded to the server and loaded to the player when needed.

 

 

example:

 

I press the fight button. Then a scene, with two characters appear, in 3D.

Pre-rendered scene loads to client PC. This video will have to be in a frame or iframe or something of the sort.

 

Then, outside of that window, there is a html coded attack form button. I press that button, and then the PHP script make another scene appear,

Page reloads

without updating the page,

It willwhere my character attack the other character,

Another video has to be loaded to the frame.

and then again it return to the first scene.

Page and video reloads.

There would have to be a good deal of loading and reloading as described.

It Could be done though it would neither be quick nor effective nor elegant.

 

As stated Java script would be a better solution or Java or even Flash and ActionScript.

 

Maya does not allow an animation to be rendered as a Flash video. Thus any animation would need to be rendered to an AVI or quicktime file then that file would ned to be converted to a Flash movie in Flash or a separate utility.

Share this post


Link to post
Share on other sites

:S

sorry.. but I really am a total noob when talking about this. I can't understand what I am supposed to do, even after your explanations.

Pre-rendered scene loads to client PC. This video will have to be in a frame or iframe or something of the sort.

I don't even know what any of that is.

As stated Java script would be a better solution or Java or even Flash and ActionScript.

How can this be done in javascript? can anyone please give me an example? I don't know JAVA, and I can't afford Flash.

Maya does not allow an animation to be rendered as a Flash video. Thus any animation would need to be rendered to an AVI or quicktime file then that file would ned to be converted to a Flash movie in Flash or a separate utility.

If I make every scene into AVI files, it would look ugly, because I would have to make the movie reload every time. like you said it would take time, and wouldn't look nice. Anyone knows a better solution.. it feels like I am asking for the impossible.. but I live after the rule that nothing is impossible, and if I knew anything about what I am asking for, I am sure I would be able to explain more. but I am really sorry. All this sounds like chineas to me, and I don't know that language.. I am really noob at this, and hope that you understand what I want, and can help me learn.


Thanks //Feelay

Share this post


Link to post
Share on other sites

Not to discourage you or anything, but maybe you should try experimenting with smaller projects before building a text-based game. Building a text-based game is lots of work and could take many weeks or even months. If you don't know what you are doing, please try out things such as JavaScript and PHP by using various functions that you might use to see how they work.

Share this post


Link to post
Share on other sites

Hey!

 

I wanted to know if I could mix 3D and PHP.

 

Because I want to do the following thing:

 

I want to make a text based game. Butthis time, I wanted to do it special.

 

I was wondering if there is a way to make a 3D scene execute when I press a form button?

and if yes, is it possible to do it, without updating the whole page?

 

example:

 

I press the fight button. Then a scene, with two characters appear, in 3D. then, outside of that window, there is a html coded attack form button. I press that button, and then the PHP script make another scene appear, without updating the page, where my character attack the other character, and then again it return to the first scene. I am not sure if this can be done in PHP. but I think it is possible. If not, can anyone please tell me what language I need to use?

And OFC :mellow: can anyone please tell me how to do it (A)

As far as i know my answer is yes, you can mix 3D and PHP.

 

So, i think that for your mix you can use a combination of PHP, HTML, Javascript and for your 3D scenes you can use a language called VRML (Vitual Reality Modelling Language) or 3DMLW (3D Markup Language for Web).

 

VRML is a language that you can use for creating 3D scenes. In this scenes or worlds you can define shapes like spheres or polygons with colors for it's surface, apply some transparency, etc. This worlds are able to interact with the user or may response to events, also, you can add Java or Javascript code with the use of a special script node that VRML files have.

 

VRML files are standard text files that are saved with the .wrl or .vrml extensions and as .wrz files when you compress it with gzip.

 

3DMLW is another language for creating 3D or 2D interactive content, it is similar to XHTML, supports style sheets and as VRML has scripting capabilities.

 

3DMLW files are also standard text files that are saved with .3dmlw extension, and one difference with VRML is that is based on the XML standard 1.0.

 

More information:

VRML (Vitual Reality Modelling Language) Website

VRML - Wikipedia

3DMLW (3D Markup Language for Web) Website

3DMLW - Wikipedia

Best regards,

Share this post


Link to post
Share on other sites

thanks TavoxPeru :mellow: I just love your answers and links :D I'll check them out when I can ^^@firefoxrocks: who told you I've never created a text-based game before? I've just never tryed to mix 3D with a textbased game before. Actually, I've never even tried to mix 3D with a web-page before.. but if I do that with a text based game, or with a normal site, doesn't matter. because I think I would hav to do the same thing.

Share this post


Link to post
Share on other sites

You are welcome Feelay, thanks.Now, one thing i forgot to mention in my previous post is that the only way a browser can be able to show your 3D content is by using a plug-in, which will handle that function. This happens with both, VRML and 3DMLW.BTW, glad to hear that i'm helpful.Best regards,

Share this post


Link to post
Share on other sites

hmm..I've been looking at VRML for a while now. I checked out their tutorials, and I found"Tutorial about web 3D creation using 3ds max and Director".do this mean that I will be able to save the file as a VRML file? Because I can't find any place that says that on the site. only the title of the tutorial..And if it works with 3DS Max, do you think it works with maya?also.. how can I include these VRML files into my PHP files, and make them interact with my HTML coded form buttons?because I didn't find anything in their tutorials section.acctually, I didn't find much about HOW to do these things. only information about VRML :mellow:I am sure that there is something on the site.. But I'm an idiot :D I don't know what to search for when I want to learn new things (languages etc).sorry guys for asking so much :o but all this 3D with PHP ;) I really know nothing about it ;) (BTW.. isn't there any kind of tutorial that explains this from the beginning? how to include 3D scenes into a page, and make them interact with HTML coded buttons.)

Edited by Feelay (see edit history)

Share this post


Link to post
Share on other sites

I'm not sure about this but i guess that if those programas supports that functionality, Yes you can be able to save your files as VRML directly from them. Do you use 3ds max or director??? if yes, i suggest to check the export capabilities and save as option of each software.

 

What is Maya????

 

The VRML scenes can be added to your PHP pages in the same way you include Html or Javascript code, for example you can do the following:

 

<?php/*php codephp codephp code*/?><html><head><script type="text/javascript">function vrmlScene() {vrml= open("", "displayWindow","width=500,height=400,status=yes,toolbar=yes,menubar=yes");// open document for further outputvrml.document.open("x-world/x-vrml");vr= vrml.document;// create VRML-scenevr.writeln("#VRML V1.0 ascii");// start vrml code /*vrml code vrml code vrml code */// end vrml code // close the document - (not the window!)vrml.document.close();}</script></head><body><h1>VRML on the fly Example</h1><form><input type="button" value="VRML on-the-fly" onclick="vrmlScene()"></form></body></html>
Also, instead of create the scene on the fly like in the example above, you can be able to open any VRML file directly as you open any other kind of file, but, as i said in my previous post, to be viewable this content in your browser you will need a plug-in.

 

Visit the VRML Plugin and Browser Detector to verify if your browser has installed a VRML plug-in, if you don't have any VRML plug-in installed this page contains some links from where you can download it.

 

Feelay, as you i'm also a newbie in this area.

 

I just create a VRML Examples page, especially check the last option.

 

Best regards,

Edited by TavoxPeru (see edit history)

Share this post


Link to post
Share on other sites

I recently found a Javascript library called JavaScript VectorGraphics that may be can help you. This library provides graphics capabilities for JavaScript which you can use to draw circles, ellipses, lines, triangles, rectangles, etc. dynamically into a webpage. Usage of this Javascript library should be easy even if you don't have JavaScript experience.

This library is available for download here and you can view a nice animation example here.

Best regards,

Share this post


Link to post
Share on other sites

hmm.. how can I make it like this..when I attack the player, some math will happen in a variable. and another scene will appear. but the page will NOT reload. only the scene.. There must be some way to do it.. JavaScript, XML, DOM?? any language?and can someone please be kind and tell me how xD

Edited by Feelay (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.