Archived

This topic is now archived and is closed to further replies.

Exellon

Embedding the Python Interpreter in Games

Recommended Posts

Guest Anonymous Poster
quote:
Original post by Exellon
Is this possible, or would it even work? Would it be beneficial?


Depends, depends, depends.

It would help to know which language you''re willing to embed Python into, how and what for, and what you''re expecting to do with it.

Python can be embedded, but wasn''t meant to be. It means it is not the easiest interpreter to embed (nor the hardest one, for that matter). Now if all you''re willing to do is run Python scripts from your C program, it''s very easy. If you need both languages to interact, it gets tougher. If you want to map C++ classes to Python objects, it becomes quite harder.

Hope this helps.

Share this post


Link to post
Share on other sites
http://www.lua.org , combined with SWIG or any of the other binding generators.



Don''t listen to me. I''ve had too much coffee.

Share this post


Link to post
Share on other sites
I''ve been playing around with Simkin on a simple game project in my spare time. It is really easy to make an object sciptable. It''s not perfect, but I had it hooked up to a gameobject and was controlling it through scripts in short time.

You have to email to Simon with a request for Simkin - but you get the source and all - you can''t beat it.

Dave "Dak Lozar" Loeser

Share this post


Link to post
Share on other sites
There''s a library available in Boost that lets you use C++ classes in Python.

Magmai Kai Holmlor

"Oh, like you''ve never written buggy code" - Lee

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]

[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows| Spirit(xBNF)]

Share this post


Link to post
Share on other sites
quote:
Original post by blueEbola
You can consider LUA (its the easiest to embed I''ve ever seen), but its not object oriented.

But it can simulate object-orientation quite easily, and ends up looking very similar to Python or java-script. Which is nice. You just have to have some discipline when using it.



[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]

Share this post


Link to post
Share on other sites
quote:
Original post by Kylotan
But it can simulate object-orientation quite easily, and ends up looking very similar to Python or java-script. Which is nice. You just have to have some discipline when using it.



Yeah, I've actually done something like that before when I was giving LUA a test drive. The resulting object constructor isn't that pretty though

LUA is very extensive, using its tag methods you can simulate operator overloading on an object (table).



[edited by - blueEbola on August 17, 2002 5:58:21 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Check out SeeR, it is easy to embedd and easy to extend c++ classes into SeeR, dont have the url handy, use search

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The game Freedom Force embeds Python into the game so it is definitely possible and it runs fast enough.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
The game Freedom Force embeds Python into the game so it is definitely possible and it runs fast enough.


It is very possible, it just takes a lot of code to get it up and running

Share this post


Link to post
Share on other sites