Map preview of randomly generated Shoppa maps
Sun, 2014-02-16 19:17
Hi,
why is there no preview for randomyl generated Shoppa maps, when there is one for "normal" randomly generated maps? Is this something that would be doable?
Thanks!
To my (limited) knowledge the custom shoppa maps use a script to generate custom landforms. Since scripts run on mission load, it's impossible to create a preview image.
Proud member of Death's Angels for 3 billion years.
Yep, that's pretty much it.
Well, preview image generation could run the script I guess...
Someone would have to teach it how to do this safely.
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
OK, I still don't get it, but I guess I'll just believe you
Thanks!
Normal map generation is using code inside the hedgewars game itself to make a map. This code is run twice. Once to make a preview image, then once again when the game is launched. All within the engine, so preview knows 'sactly what to do.
The shoppa map generation is, at present, a lua script that hooks into game on startup, and sends a bunch of draw commands using:
https://code.google.com/p/hedgewars/wiki/LuaDrawing
But, that's on actual startup, not preview startup. So the preview code does not get this drawing.
For it to work, we'd either have to call the normal startup lua hook in preview, which could be problematic, or add a preview hook that lua could use.
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
https://code.google.com/p/hedgewars/source/detail?r=fa5c83fd0ad9b6b87a3ee4961e25d6bf1b85ee3a
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
OK, thanks for the explanation!
Anyways, if it's ever possible that would be a nice feature! It's annoying when you want to play a quick Shoppa game, but you get a map without any water and the game takes forever.
Uuuummmm...
That revision commit above added it, if you'd followed the link it had a comment mentioning this.
http://m8y.org/hw/luamap.png
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
Oh, cool. But this also has a slight regression: Whenever you change the script, the preview image reloads, weather it invokes onPreviewInit() or not. Which is slightly annoying, as the game re-calculates the same pseudorandom map again and again.
From the commits I can see that onPreviewInit is new here. But I don’t see the point of this function, if the game updates the preview anyways.
Wouldn’t it make more sense to only update the preview image if onPreviewInit is actually called?
Hi, I am a Hedgewars developer.
Would be interesting if you could describe how that engine/frontend interaction should occur, Wuzzy, keeping in mind that the engine is, at present a separate execution per preview launch. Best guess I can figure is you are proposing frontend loading lua, which it doesn't do right now.
I was considering adding a line to the lua cfg to inform of lua doing terrain gen, but not doing it right now. The cost isn't too terribly high.
--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev
I think simple regexp could be enough for frontend to check if script messes with map generation.