Resultados 1 al 1 de 1

Tema: Mr Blender web services

  1. #1
    Fecha de ingreso
    Apr 2002
    Mensajes
    25,945

    Mr Blenders web services

    mr. Blender web services
    By - Hamed zaghaghi.

    In this article you can learn how todo use web services with Blender todo make games or walk-throughs that are able todo interact with resources on the internet. Ill assume that you have some background of xml, Python, and php.

    Bellow you can read my interview with mr: Blender.

    Me: hello mr: Blender.

    Mr: Blender: hey you.

    Me: - Im Thinking about making a game or walkthrought that interacts with others on the internet.

    Mr: Blender: ok, what the problemí you can do it using Python scripting.

    Me: yes i know that i can do it, but. I dont know how.

    Mr: Blender: do you know about web services?
    Me: web services?
    Mr: Blender: yes. It about exchanging data between a web server and a client.

    Me: hm. Can you explain more about web services?
    Mr: Blender: web services are methods you write or se in programs. Both are called with local programs, but the diference is that methods in local programas run locally and use local system resources, while methods in web services run on servers and use server resources. This isnt a complete definition of a web service, but it close enough.

    Me: can you give me some examples of using a web service in Blender?
    Mr: Blender: ok. For example, you might want:
    • users of your game todo register on your web site and then login into the game using their user name and password (you can se this in almost all online games).
    • your game todo chek for a newer versión when starting and prompts the user todo update.
    • to make a 3d presentation of a house for sale and users can chat with the house Owner and ask him/her some questions, or Many other examples.

    Me: oh, well, y think that when users must register their user name and password, y should have a database that contains user data, but what is the relation between Blender, Python, web service, and a database?
    Mr: Blender: have a look at the following picture, i think that it Will help you find the answer.


    blender. & web services.

    Me: ok, can you go step by step todo make a complete example?
    Mr: Blender: yes. Let make a game with versión checker, step by step.

    Me: ok.

    Mr: Blender: first of all we ned a game. You can use your previous games, or make a simple game, or Simply use the standard Blender scene with a Cube at the center as a game and continúe.

    Me: ok, ill use a new Blender scene.

    Mr: Blender: first we add an always sensor, and unchek both true and false pulse mode.

    Me: ok.



    Mr: Blender: now make a new file in the text editor and name it check_versión without quotes, then add a Python controller and set script parameter todo check_versión without quotes again, then connect the always sensor todo the Python controller.

    Me: and then?


    Mr: Blender: before doing anything else in Blender, we ned todo configure our web service server. I use apache as my web server, php for writing web services, the xml-rpc protocol for my web service, and Keith devens implementation of xml-rpc on php. You can find xml-rpc implementations in other programming lenguajes at http://www.xmlrpc.com/directory/1568/implementations
    Me: oh, and then?
    Mr: Blender: for setting the web service up, first download Keith devens implementation from http://www.keithdevens.com/software/xmlrpc/source, then upload it somewhere todo your web server.

    Me: ok, im downloading it and uploading todo http://en, Blender, ir/webservices
    Mr: Blender: then write this code in a text editor and save it as a php file in the same directory that you uploaded the xml-rpc implementation. Let call it server, php.
    <? Php #1)include Keith devens implementation include (kd_xmlrpc, php), #2)web service methods $xmlrpc_methods = array(), $xmlrpc_methods[currentversion] = getcurrentversion; $xmlrpc_methods[method_not_found] = xmlrpc_method_not_found;
    #3)web service server.
    $xmlrpc_request = xmlrpc_parse ($htp_raw_post_data),
    $methodname =
    Xmlrpc_getmethodname ($xmlrpc_request),
    $parámetros = xmlrpc_getparams($xmlrpc_request),
    If(.isset($xmlrpc_methods[$methodname])){
    $xmlrpc_methods[method_not_found]($methodname),
    }else{
    $xmlrpc_methods[$methodname]($parámetros),
    }
    #4)web service methods implementation.

    Function getcurrentversion($parámetros){
    $returnversión[versión] = 3.60;
    $returnversión[minor]=60;
    $returnversión[major]=3;
    Xmlrpc_response (xmlrpc_prepare ($returnversión)),
    }
    Function xmlrpc_method_not_found($methodname){
    Xmlrpc_error(2, the method you requested, $methodname, was not found.),
    }
    ? >

    .
    Me: i can do it, but i dont know what the code is for.

    Mr: Blender: this code setups an xml-rpc server using Keith devens implementation, with two methods, getcurrentversion and method_not_found. The first method is the one we want todo call from Blender, and the second one is for requested methods that this server doesnt support. In the first section of code we include the xml_rpc implementation, and in the second section we setup an array that is used with the server code todo find an implementation of the requested method. For example when in line 2 section 2, we say that if a method named currentversion exists, the requested server should run the getcurrentversion method implemented in section 4.

    Then, in the third section, parse the request and extract the requested method name and its parameters. Finally, chek if the requested method name was implemented, and if not, run method_not_found instead.

    Me: oh. I think that After we write this code and save it on server, php, we can then send a request method name and its parameters todo server, php, and this code Will run the requested method and respond with its value.

    Mr: Blender: yes, that right. As a short explanation, the getcurrentversion method responds with a structure of thre Fields - Versión, minor and major. Every time my programa gets updated we change those numbers. In these methods, we can connect todo databases and get some información from them.

    Me: and then from Python send a request todo server, php todo run getcurrentversion. But how can we do it in Python?
    Mr: Blender: this section is easier than the previous one. Python has a library named xmlrpclib, and we can use it todo send requests and receive responses. To se what this library can do, paste this code in the Python text editor of Blender, then press p.

    .
    Import xmlrpclib.

    This_versión = 1.3
    Server =
    Xmlrpclib. Server(http://en, Blender, ir/webservices/server, php)
    Current_versión = server, getcurrentversion()
    If(current_versión[versión] > this_versión):
    Print go todo programa web site and download updated.

    Versión.

    Else:
    Print programa is updated.
    Me: ill do it, but where i can se the results?
    Mr: Blender: you can se the printed line in the terminal/command Prompt of Blender.

    Me: thank you, señor Blender, for your time.

    Mr: Blender: youre welcome.

    Interviewer - Hamed zaghaghi, msc. Student of algorithms and computation, enginering Science department, university of tehran.

    Email - hamed, zaghaghi@gmail.com. www.blenderart.org.
    Miniaturas adjuntas Miniaturas adjuntas Clic en la imagen para ver su versión completa. 

Nombre: 1.jpg 
Visitas: 445 
Tamaño: 8.3 KB 
ID: 107938   Clic en la imagen para ver su versión completa. 

Nombre: Páginas desdeblenderart_Jan08_Issue14.PDF - Adobe Acrobat Pro Extended_Página_1_Imagen_0006.jpg 
Visitas: 485 
Tamaño: 8.6 KB 
ID: 107940   Clic en la imagen para ver su versión completa. 

Nombre: Páginas desdeblenderart_Jan08_Issue14.PDF - Adobe Acrobat Pro Extended_Página_1_Imagen_0007.jpg 
Visitas: 434 
Tamaño: 13.5 KB 
ID: 107941  
    |Agradecer cuando alguien te ayuda es de ser agradecido|

Temas similares

  1. Unity Gaming Services
    Por 3dpoder en el foro Videojuegos
    Respuestas: 0
    : 23-10-2021, 19:12
  2. Ofertas de Trabajo Profile software services ofertas de trabajo
    Por Stratos en el foro Oferta y demanda profesional
    Respuestas: 6
    : 31-05-2019, 09:38
  3. Ofertas de Trabajo Inbenta professional services busca artista 3d generalista
    Por Stratos en el foro Oferta y demanda profesional
    Respuestas: 2
    : 08-02-2018, 08:38
  4. 3d visualization services
    Por covono en el foro Oferta y demanda profesional
    Respuestas: 0
    : 08-09-2008, 06:33
  5. Problema al instalar services packs en 3ds Max 8
    Por thenewmoran en el foro Programas de Diseño 3D y CAD
    Respuestas: 2
    : 07-11-2007, 14:59