• Lucid Dreaming - Dream Views




    Results 1 to 7 of 7
    1. #1
      Christian youssarian's Avatar
      Join Date
      Dec 2007
      Gender
      Location
      Independence, Kansas
      Posts
      441
      Likes
      41

      Pass Variables Between JavaScript and C++/Python?

      I've been using these languages for quite some time now. I want to apply my skills by making a browser-based JavaScript game, albeit probably a simple one to start off with, but I want to be able to save the data (like any modern game has). Unless I'm mistaken, PHP is a server-side language that wouldn't save data on the player's machine. JavaScript has the FileScriptObject as part of the ActiveX, but I think I should stay away from that since it's proprietary and won't work in some browsers.

      So without learning any new languages, I figure my best options are C++ and Python. But, how can I pass data from JavaScript code to a C++ or Python program?

      Thanks!

      (Addition: I'm also pretty good in PHP, too)
      Last edited by youssarian; 12-14-2009 at 05:25 AM.
      Learn the art of lucid dreaming in a whole new way!
      LD Count: 37 (35 DILD, 2 DEILD)

      Hey Newbies! Did you read the main pages and the tutorials? It will help you immensely.

      Zenventive: art, health, philosophy
      You are dreaming!

    2. #2
      FBI agent Ynot's Avatar
      Join Date
      Oct 2005
      Gender
      Location
      Southend, Essex
      Posts
      4,337
      Likes
      14
      C++ or python won't help you very much for a browser based game

      Why not just store any save game data in a cookie?
      (\_ _/)
      (='.'=)
      (")_(")

    3. #3
      khh
      khh is offline
      Remember Achievements:
      1000 Hall Points Veteran First Class
      khh's Avatar
      Join Date
      Jun 2009
      Gender
      Location
      Norway
      Posts
      2,482
      Likes
      1309
      If you need to store variables in your server, you could use AJAX or something to communicate with the server, and store the data in a database or something. It shuold be possible to do with Python, but I think it would be easier with PHP.
      April Ryan is my friend,
      Every sorrow she can mend.
      When i visit her dark realm,
      Does it simply overwhelm.

    4. #4
      Christian youssarian's Avatar
      Join Date
      Dec 2007
      Gender
      Location
      Independence, Kansas
      Posts
      441
      Likes
      41
      The thing is, PHP and Python would store the data on the server's side. I'm trying to find a way to save the information on the client side, so that I don't get all sorts of little and not-so-little saved game data on the server. (I use a webhost and I have limited disk space allotted to me.)
      Learn the art of lucid dreaming in a whole new way!
      LD Count: 37 (35 DILD, 2 DEILD)

      Hey Newbies! Did you read the main pages and the tutorials? It will help you immensely.

      Zenventive: art, health, philosophy
      You are dreaming!

    5. #5
      khh
      khh is offline
      Remember Achievements:
      1000 Hall Points Veteran First Class
      khh's Avatar
      Join Date
      Jun 2009
      Gender
      Location
      Norway
      Posts
      2,482
      Likes
      1309
      Oh. Well, if you want to save data client side, then using cookies is your best bet. Like Ynot said.
      April Ryan is my friend,
      Every sorrow she can mend.
      When i visit her dark realm,
      Does it simply overwhelm.

    6. #6
      Christian youssarian's Avatar
      Join Date
      Dec 2007
      Gender
      Location
      Independence, Kansas
      Posts
      441
      Likes
      41
      That's embarrassing. Somehow in my reading of replies I missed the cookie part.
      Learn the art of lucid dreaming in a whole new way!
      LD Count: 37 (35 DILD, 2 DEILD)

      Hey Newbies! Did you read the main pages and the tutorials? It will help you immensely.

      Zenventive: art, health, philosophy
      You are dreaming!

    7. #7
      Member L815's Avatar
      Join Date
      Mar 2008
      Gender
      Posts
      78
      Likes
      0
      Cookies would work but can be a pain to implement since they are deleted every so often, so holding lots of data isn't always good.

      I'd say hold only the most important and crucial data on the server, load that up into the session, and then use some clever javascript/ajax to generate the rest of the data, client side.
      http://i30.tinypic.com/j79u05.jpg

    Bookmarks

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •