This programmable game competition would be perfect in Codea

http://blog.codecombat.com/a-31-trillion-390-billion-statement-programming-war-between-545-wizards

It’s a great idea, and I’m sure someone here could produce something better than their graphics and gameplay! Lua would be a perfect scripting language for gamers to program their strategy.

That… is amazing. I never liked travelling salesman back in college it was so strenuous with pen and paper, programmes are a different story though.

That is a great idea!

@SkyTheCoder yes broadly what I was thinking. I think the simplistic local func = loadstring(xxx) isn’t sufficient, I want to leave the door open to more complex code with sub functions/recursion/whatever, but I think I have a workable scenario.
Haven’t quite nailed down the setfenv piece for safety yet, but I think I at least understand it a bit better now.

I might try and work up at least a proof of concept for myself over the next couple of evenings.

@spacemonkey You could prevent variable hacks like this:

local func = loadstring(code)
setfenv(func, api)
pcall(func)

code as the Lua string, api as an _G (i.e. a table containing every API you’ll need, and no access to anything else).

Hmm, played through the tutorial. This could work well with Codea, and lua as the script.

I guess it get’s more interesting later in multiplayer, but the tutorial was a bit hard coded. I like the idea of getting the players to build simple AI/rules rather than just putting in moveXY etc.

Then you could have modes/types of competition, eg race (shortest distance/quickest), collectables (time to collect them all), hunting (search and destory) etc…

Thinking about it some more, coroutines could be a great way to seperate the players control from the main operation of the game. Setup an API on the controller class for methods the player can use.

Then with yields stuck into the appropriate bits in the API you would be under a reasonably flexible control. I think the main issue would be protecting the wider app from players putting in code outside of the intended API, for instance they could try and hack the global variables or override the draw function or something…

They just added Python and lua ! :slight_smile:

As long as you compete with open source it shouldnt be a problem, and more educational as well!

I was thinking about building something turn based with hexagon grids based on this
http://codea.io/talk/discussion/4614/hexagons
Which has support for field of view and range calculations for players. But I havent had any time to create the game logic and rules. :slight_smile: