non-tiled world

18 views
Skip to first unread message

syndicatedragon

unread,
Jun 11, 2013, 4:16:47 PM6/11/13
to gummw...@googlegroups.com
Is grummworld2 appropriate for a non-tiled world? I'd like to have a big scrolling world, but I think I'll have to render stuff manually since I want a hexagon grid. How would you go about setting it up?

B W

unread,
Jul 27, 2013, 6:59:13 PM7/27/13
to gummw...@googlegroups.com
Howdy.

I can think of a few minor problems to overcome concerning hex grids: rendering, map loading, and hex spatial (model) logic.

Rendering:

In general a hex-tile world will render very slowly if you attempt to use one hex rendered per rectangular tile. I say this because the hex does not use all of the rectangular surface. The tiles would necessarily overlap, and one would have to use surface- or per-pixel alpha which can be very CPU-intensive and slow.

I would highly recommend, whether using Gummworld2 or another implementation, to pre-render the hexes onto some background tiles. The pre-rendered background tiles are then what you'd render in real-time. I hope this makes sense. If you choose to do this, then Gummworld2 would be able to handle a scrolling display of the world quite well.

If, on the other hand, you absolutely need to work with hex tiles on overlapping alpha surfaces, I can't think of any easy way to do this out of the box using Gummworld2.

Map loading:

The version of DR0ID's Tiled TMX Loader that Gummworld2 uses does not support Tiled hex maps. You'd need to incorporate or create your own map loader. If your map will be procedural then you won't encounter this problem.

Hex spatial logic:

Converting between mouse/map/pygame coordinates and a hex grid should be pretty convenient if you create your hexes as PolyGeometry objects and put them in a SpatialHash. This would facilitate collision detection versus a rect and picking versus a point. See gummworld2.geometry and gummworld2.spatialhash, respectively.

If you have any more questions, don't hesitate to ask.


On Tue, Jun 11, 2013 at 1:16 PM, syndicatedragon <g.thre...@gmail.com> wrote:
Is grummworld2 appropriate for a non-tiled world? I'd like to have a big scrolling world, but I think I'll have to render stuff manually since I want a hexagon grid. How would you go about setting it up?

--
You received this message because you are subscribed to the Google Groups "Gummworld2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gummworld2+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Gummbum

unread,
Aug 22, 2013, 7:08:52 PM8/22/13
to gummw...@googlegroups.com
Howdy again. Your question stimulated me to revisit a feature I had in a parking lot, an optimized renderer to sit between the tile map and the screen. In casual consideration it may seem like a case of more blits resulting in slower rendering, but it actually results in fewer blits per frame--I was pleasantly surprised to get such outstanding performance from it, even with 400 alpha (transparent) tiles on screen. What this means for your question is that irregular maps, such as a hex map, no longer require you to invent an intermediate renderer per case. In version 0.4.4 there is an example of a hex map: 31_hex_map.py. Check it out.

Hope this helps.

Gumm
Reply all
Reply to author
Forward
0 new messages