It is currently Wed May 22, 2013 11:22 pm Advanced search

Polyconsole (game dev tools)

Discuss particular games/prototypes/designs you are working on, get comments and feedback.

Polyconsole (game dev tools)

Postby mcc » Mon Apr 30, 2012 2:15 am

This thread's a little different, I'm actually looking for feedback on a game library basically.

I've spent the last few months moving my game development over to a library called Polycode. This is an open source library made by Ivan Safrin, who's a Tigsource regular. I think the library has a lot of potential but it's still in alpha, and out of the box it has a lot of quirks and is generally hard to get started with. Now that I've beaten Polycode into shape for my own use, I want to release the modifications and template code I've made (I'm calling my package "Polyconsole") in hopes people can just get started with the library instead of having to jump through the hoops I did. Hopefully this will help get a larger community of people exposed to Polycode.

Alas, I'm not sure if my toolset is actually any easier to use than Ivan's. I wrote it to my own use and to use the tools I had on my own system. So-- I'm not actually expecting anyone reading this to adopt Polycode for their game dev. But I'm curious if people could take a bit to try to install Polyconsole, see if it works, see if you can run the sample project or make some small modifications to it. If you couldn't get it to work, or couldn't figure out what to do once it was installed, I'd be curious where you got stuck.

(Note: the one big limitation is it only works if you have Mercurial installed and, obnoxiously, none of my build scripts currently work on Windows! Polyconsole games compile to Windows-- I use MinGW, directions for this are at the link below-- but in order to do the compile you need a copy of OS X or Linux. If anyone would be willing to help me test and get Windows development working, that would also be really helpful. I don't actually have a copy of Windows to test with myself.)

You can find Polyconsole and its documentation here.

In theory all you should need to do (assuming you're on a mac, and you have at some point installed Mercurial and CMake) is run this at the command line:

Code: Select all
hg clone https://bitbucket.org/runhello/polyconsole && cd polyconsole && ./manage.py install && open PolycodeTemplate.xcodeproj


And you'll have a working Polyconsole-based project up and running.

Here are the advantages I've found to working with these tools:

- Included scripts manage downloading and compiling Polycode and all the other dependencies you need, and quickly switching between and upgrading different versions of the libraries.

- Polycode APIs handle all the basic stuff, basic 2D and 3D scene management, 2D and 3D physics, resource and shader management

- Can easily mix C++ and Lua in a single program; the same APIs work in both, and there's an automated script to bridge the two

- Integrated Lua debug console:

Image

- Set up 2D scenes (including physics scenes) with SVG files

- Reload both Lua and resources (like SVG files) by hitting ESC, meaning you can try out changes in real time:

Image

- Attribution-only licensing on everything

The big deal for me, in moving to these tools, is living in a world where I have access to C++ levels of power but I don't actually have to write my game code in C++. I've written my last few game-jam games with Polyconsole, including Shadowland Prophesy and Breathe, and it's great to be able to prototype something fairly complex in like eight hours without ever really having to leave Lua. Of course this is an experience that I think people using Unity or Flash tools have had access to for a long time, but it's new to me, and I'm not sure it's an experience it's currently possible to get without relying on proprietary tools and frameworks (and, if you use Flash, largely giving up 3D).
User avatar
mcc
 

Re: Polyconsole (game dev tools)

Postby NiallM » Thu May 03, 2012 8:51 am

Finally had a chance to try this out (I'm really intrigued by the combination of c++ and lua), but I hit the following error:
Code: Select all
[ 45%] Performing download step (download, verify and extract) for 'zlib'
cd /home/niall/Programming/Polycode/Dependencies/Build_Linux/libpng/src && /usr/bin/cmake -P /home/niall/Programming/Polycode/Dependencies/Build_Linux/libpng/src/zlib-stamp/download-zlib.cmake
-- downloading...
     src='http://zlib.net/zlib-1.2.6.tar.gz'
     dst='/home/niall/Programming/Polycode/Dependencies/Downloads/zlib-1.2.6.tar.gz'
     timeout='none'
-- [download 100% complete]
CMake Error at zlib-stamp/download-zlib.cmake:6 (file):
  file DOWNLOAD MD5 mismatch

    for file: [/home/niall/Programming/Polycode/Dependencies/Downloads/zlib-1.2.6.tar.gz]
      expected MD5 sum: [618e944d7c7cd6521551e30b32322f4a]
        actual MD5 sum: [dd2232945efdd77cc1731b7517ceda78]

It looks like zlib-1.2.6.tar.gz isn't available anymore, and it should be zlib-1.2.7.tar.gz, but changing Polycode's CMake/ExternalPNG.cmake to point to the new zlib just gives me the error:
Code: Select all
ERROR: Working dir ../Polycode has local modifications; script can't build over that.

Tested on Mint Linux 12.
User avatar
NiallM
 
Location: Scotland

Re: Polyconsole (game dev tools)

Postby mcc » Thu May 03, 2012 4:36 pm

OK-- thanks much-- I have to run to work now so I don't have a chance to look at this, however, the way around the "local modifications" thing is to not use the "install" command. Instead try:

./manage.py detach
./manage.py rebuild -d --bindings-only --no-tools

This will turn off the build cacheing but it will build polycode and point the Polycode/ symlink to the build you just made.

Erg, that is pretty obscure :/ I probably should try to come up with a cleaner interface. If you wanna just wait until tonight I'll fix the 1.2.7 problem myself. Thanks!
User avatar
mcc
 

Re: Polyconsole (game dev tools)

Postby NiallM » Sun May 06, 2012 1:59 pm

Okay, the latest version fixes the zlib issue, but I now run into a problem compiling PolyMatrix4.cpp:
Code: Select all
/home/niall/temp/Polycode/Core/Contents/Source/PolyMatrix4.cpp: In static member function ‘static Number Polycode::Matrix4::generalDeterminant(const Number* const*, int)’:
/home/niall/temp/Polycode/Core/Contents/Source/PolyMatrix4.cpp:222:59: error: ‘malloc’ was not declared in this scope
/home/niall/temp/Polycode/Core/Contents/Source/PolyMatrix4.cpp:255:50: error: ‘free’ was not declared in this scope
/home/niall/temp/Polycode/Core/Contents/Source/PolyMatrix4.cpp:257:19: error: ‘free’ was not declared in this scope

It's easily fixed (is there a reason it uses malloc/free rather than new/delete though?), so I #included <cstdlib> and ran the detach/rebuild commands above. This gets me a working build, and running make in polyconsole/package/lin builds the example project correctly (which also seems to run as expected).

What I really wanted to try out was the integrated lua console, but I'm unsure how to activate it. I tried adding '-D_DEBUG' to the makefile, but I suspect I'm missing something, because although the project builds, it won't run, with the error:
Code: Select all
PANIC: unprotected error in call to Lua API ([string "project_util.lua"]:55: attempt to call global 'project_bridge' (a nil value))

(still testing on Linux Mint 12; I haven't attempted it on OSX)
User avatar
NiallM
 
Location: Scotland

Re: Polyconsole (game dev tools)

Postby mcc » Sun May 06, 2012 6:22 pm

OK-- thank you so much for doing this testing, I think I know what happened in both those cases and both come down to "I did something stupid". Let me test on my own Linux VM and upload another rev...
User avatar
mcc
 

Re: Polyconsole (game dev tools)

Postby mcc » Sun May 06, 2012 9:29 pm

Hi Niall, I did a couple things--

- I dumped a new revision on the Polycode tree that uses new/delete instead of malloc/free as you suggested (I only used malloc/free cuz that was code copypasted from the internet, and I didn't think about it very hard) this should fix your Linux problems

- I put a new version on the polyconsole tree which has better Linux compatibility, you can now build in debug mode just by building with "make DEBUG=1", also when you build in debug mode it will find the resources properly

You can get the new versions by either deleting the Polycode and polyconsole directories and re-cloning, or you could probably just go into your existing polyconsole directory and say
hg pull;hg up
(And maybe throw in an "hg revert --all --no-backup".) You probably won't need to rebuild Polycode itself since your cstdlib fix already has that working.

Once you get into the program, you can bring up the console by hitting "tab". I usually only use the console for very small things or for printing values, what i more often do is edit the lua files in media/overlay and then hit "esc" to reload them. As long as you're in debug mode all resources and lua will be loaded from disk.

Does that work? I'm sorry this is so complicated! One of the reasons I'm looking for testers in the first place is figuring out where the process of getting all this to work is uglier than it should be...

-----

Thinking out loud, some things i'm noticing:

- Expecting people to build things themselves is unreasonable, esp. because the build can fail because of stuff that has nothing to do with either me or Polycode (i.e. zlib changing the version on their site), it ought to be able to possibly download a precompiled version of Polycode
- I ought to have some way of, when you clone, you get a particular bookmark or a "blessed" version or something and not just whatever's at top of tree, bc the reason you got the Matrix4 failure is I pushed something unnecessary without testing it fully
- The commands on manage.py kinda suck, they're kinda low level and it being possible to get error messages like that "local modifications" thing (did file a bug about the fact you ran into that, though) is kinda dumb. There's already the simple "install" operation, maybe I should add some more operations that map to user intent better, like an "upgrade" (so people don't have to put up with me saying "oh, I added a new revision, uh, try running this series of hg commands?")
User avatar
mcc
 

Re: Polyconsole (game dev tools)

Postby NiallM » Mon May 07, 2012 3:35 pm

Yeah, it works! :) I had a play with the console, and editing/reloading the media/overlay files. Being able to set up object interactions via inkscape's xml editor is very cool; I can see a lot of potential there.
mcc wrote:- Expecting people to build things themselves is unreasonable, esp. because the build can fail because of stuff that has nothing to do with either me or Polycode (i.e. zlib changing the version on their site), it ought to be able to possibly download a precompiled version of Polycode

Yeah, a precompiled version would probably be a good idea. It'll obviously be different for other platforms, but running Linux I was a bit surprised to be building zlib etc. when I've already got those libraries sitting in /usr/lib
mcc wrote:- The commands on manage.py kinda suck, they're kinda low level and it being possible to get error messages like that "local modifications" thing (did file a bug about the fact you ran into that, though) is kinda dumb. There's already the simple "install" operation, maybe I should add some more operations that map to user intent better, like an "upgrade" (so people don't have to put up with me saying "oh, I added a new revision, uh, try running this series of hg commands?")

An upgrade operation would be good. I do use mercurial myself but most of my development is on Windows, meaning I use it via TortoiseHg, and I've never got round to learning the command-line for it.

My interest in this was to do with the combination of c++ and lua, which is something I've been thinking about off and on for a wee while now for my own framework (basically a 2d game framework, covering some of the same ground as polycode). It's definitely given me some food for thought; I'm trying to resist the temptation to get stuck into luabind when I should really be finishing off my opengl es renderer.
User avatar
NiallM
 
Location: Scotland

Re: Polyconsole (game dev tools)

Postby mcc » Sun Aug 12, 2012 8:05 pm

So, I rethought this a bit, I've posted a new version of these tools and this version is set up so you don't have to compile Polycode yourself, and potentially don't have to compile anything at all:

http://msm.runhello.com/?p=574
User avatar
mcc
 

Re: Polyconsole (game dev tools)

Postby NiallM » Wed Aug 22, 2012 8:55 pm

Just had a chance to try out Option 1 on Windows; it's far friendlier than the original approach.

I'm not sure I quite grasp how I would structure a game made with polyconsole, but I suspect that may be down to a combination of my unfamiliarity with lua and over-familiarity with my own c++ code framework (it's based around GameStates (e.g. title screen state, gameplay state), and I can't quite tell if a GameState is equivalent to a room or an overlay). One thing I think would be useful for beginners is a basic tutorial that just walks through the process of making a simple game. Like: here's a title screen, here's how you switch to the gameplay room on player input, here's how you create a player class and an enemy class, etc. Tutorials are always very time-consuming to write, but I think it could be really helpful in terms of explaining how the different parts work together.

Doing most of my development on Windows, Option 2 sounds pretty scary. Though there's probably not much you can do about that without access to a Windows machine yourself.
User avatar
NiallM
 
Location: Scotland


Return to Projects

Who is online

Users browsing this forum: No registered users and 0 guests