I Need clarification and advice for Isometric map draw system

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
IsometricGames
Prole
Posts: 2
Joined: Sat Apr 01, 2017 12:56 pm

I Need clarification and advice for Isometric map draw system

Post by IsometricGames »

I'm creating game similar to age of empires 2 (on smaller scale of course). I have these isometric cubes and i have made algorithm that creates a diamond shaped map out of single cubes each cube is 80x80 -pixels and right now i'm using spritebatch for map creation. The game has to have following mechanics:

1)Camera system(Zoom In/Out to game map, Move camera around map with arrow keys or by mouse dragging)
2)being able to add Isometric: Tree,building,ArcherTower etc...onto cube or so called "tile" and specific location.
3)Render thing's that are off screen, when camera moves up/down/left or right the map render new tiles/cubes.

I will point out this: I will not be using Tiled map editor cause, for me its easier to use algorithms and my own system for specific task's.

Right now i'm using SpriteBatch, i used it cause it's very fast for creating larger maps with multiple cubes, but i want being able to resize the whole game when screen size changes. So should i use Canvas or how should i structure this game drawing system, if i want to create game with similar mechanics of Age of Empire 2?
pedrosgali
Party member
Posts: 107
Joined: Wed Oct 15, 2014 5:00 pm
Location: Yorkshire, England

Re: I Need clarification and advice for Isometric map draw system

Post by pedrosgali »

Hey there, I'm just writing an isometric camera system. I don't have much time to type right now but it does all the things you're looking for, here's a .love. The chunk camera module is in /Data/system/chunk_camera.lua It isn't really commented as yet, sorry about that but hopefully you can get some idea of how I did it.

WASD to move the camera, mousewheel to scroll, left/right to rotate the map and return will spawn a new random map.
Isometric Maps.love
Isometric Map Test
(67 KiB) Downloaded 300 times

Code: Select all

if not wearTheseGlasses() then
  chewing_on_trashcan = true
end
IsometricGames
Prole
Posts: 2
Joined: Sat Apr 01, 2017 12:56 pm

Re: I Need clarification and advice for Isometric map draw system

Post by IsometricGames »

Wow didn't expect that, this is one of the best map examples i have seen, thanks lot and and i like to see your game progress :)
pedrosgali
Party member
Posts: 107
Joined: Wed Oct 15, 2014 5:00 pm
Location: Yorkshire, England

Re: I Need clarification and advice for Isometric map draw system

Post by pedrosgali »

Thanks, if you have any questions just let me know. I still need to get the mouse picking up what tile it is over too so the functions you see in the example don't actually work yet.

Code: Select all

if not wearTheseGlasses() then
  chewing_on_trashcan = true
end
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: I Need clarification and advice for Isometric map draw system

Post by Sulunia »

pedrosgali wrote: Sat Apr 01, 2017 6:14 pm Hey there, I'm just writing an isometric camera system. I don't have much time to type right now but it does all the things you're looking for, here's a .love. The chunk camera module is in /Data/system/chunk_camera.lua It isn't really commented as yet, sorry about that but hopefully you can get some idea of how I did it.

WASD to move the camera, mousewheel to scroll, left/right to rotate the map and return will spawn a new random map.
Isometric Maps.love
Wow, that's pretty rad. Been trying to make an isometric map too, but different heights and optimizing draw calls are pretty much bugging me thus far. :rofl:
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
pedrosgali
Party member
Posts: 107
Joined: Wed Oct 15, 2014 5:00 pm
Location: Yorkshire, England

Re: I Need clarification and advice for Isometric map draw system

Post by pedrosgali »

Yeah, the draw calls are still a little slow on mine too. Especially when zoomed out. I did save a lot of frames by drawing to a canvas and only updating it when the camera moves / only drawing the meshes that are in the viewing window.
If people are interested I could release this as a library, I kind of assumed I was in the minority not wanting to use Tiled. Its a great program but I just needed some randomized maps.

Code: Select all

if not wearTheseGlasses() then
  chewing_on_trashcan = true
end
Post Reply

Who is online

Users browsing this forum: No registered users and 105 guests