• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
FantasyVII

Creating a map editor like Warcraft 3

6 posts in this topic

Hello everyone,

 

I have created a 2D tile based map editor. It's perfect for me. I love it and it gets the job done. However I was watching this video and I didn't understand one thing. When the user place multiple tiles of the same type, how does the editor merge them into one? I just can't understand how to program this feature.

 

BTW I know that the map editor is in 3D.

 

http://youtu.be/dzS_qpHsQAc?t=5m

 

Can someone please explain how this works?

 

Thank you smile.png

0

Share this post


Link to post
Share on other sites

Every time a tile is placed, you scan the tiles around it, and if they meet certain criteria, you replace them with the appropriate tiles.

eg: If you drag road tiles into another road tile going the other direction, you replace it with a T junction tile. If the user drags a road into the other end of the T junction, it becomes an intersection.

The T Junction and Intersection tiles already exist in memory, but they are not user place-able. The user can only place the road, and the program will insert the T junctions and intersections as required.

 

 

Thanks. That make sense :D

 

One last question. I have a small problem. If I try to draw more than 500 - 1000 2D tiles/ 3D objects my FPS drops. Now I know that you shouldn't draw more than 350 - 500 2D tiles/ 3D objects because the CPU can't send all those data fast enough to the GPU to process them.

 

So I put in a if statement and said if the camera can see these objects, draw them. if not, then don't draw them. and that helped a lot. However if I try to zoom out, you can see almost the whole map. and the map has more than 4000 tiles. so my FPS drops a lot. Is there a solution to my problem? The CPU just can't keep up. 

 

How do all of these game render more than 1.3 million triangles and I can get 4000 tiles to be sent to my GPU fast enough? The only solution I can see is not to let the player zoom out that much.

0

Share this post


Link to post
Share on other sites

To get the most out of your rendering speed you have to optimize everything.

Models are uploaded to the GPU's memory and drawn directly from there. There is nothing to send except the draw command.

Polygons are sorted by state to reduce the amount of times that drawing has to stop so states can be changed (rendering modes, material settings, textures, etc...)

Textures and tiles are atlased into one big image to reduce texture state changes.

Many other things, but I can't rewrite the whole book in a post, etc..etc... smile.png

So you could load up all your tiles onto 1 big texture, then create a static model of your map and upload it to the card. Then you just need to make 1 draw call to render the map. If needed, you can split the mesh up into smaller meshes. Like you said, you have 4000 tiles. Maybe split it up by 5 or 10 to get smaller renderable chunks.

I'm guessing you are drawing your tiles one by one?

 

yes I'm drawing my tiles one by one?

 

How can I send all my tiles directly to the GPU so I don't have to draw them one by one? I'm using XNA.

0

Share this post


Link to post
Share on other sites
1) Put all your tiles on a bigger sheet, and remember where they are, so you can figure out what their coordinates are. Bascially you should have a list that has every material, and what coords it was assigned on the sheet.

2) Make a data structure that consists of 4000 quads (or however many you need for you map, I'm using 4000 because you said 4000). GO find a tutorial somewhere that will tell you how to make one, or use a modeling application. Remember that each quad will need it's own set of uv coords. They can't be shared.
struct quad
{
   vector3 [4] vertex;
   vector2 [4] uv;
}
3) Go through the quads and assign them the uv coords from your texture atlas. Refer to the list from step one.

4) Use XNA to create a vertex object out of your data from your struct.

5) When drawing, load the tiles texture atlas, and then just draw your map out in 1 call, as one model.

Drawing your map til by tile means you are sending over 4000 draw calls per frame. That's about ~3500 too many!
2

Share this post


Link to post
Share on other sites

1) Put all your tiles on a bigger sheet, and remember where they are, so you can figure out what their coordinates are. Bascially you should have a list that has every material, and what coords it was assigned on the sheet.

2) Make a data structure that consists of 4000 quads (or however many you need for you map, I'm using 4000 because you said 4000). GO find a tutorial somewhere that will tell you how to make one, or use a modeling application. Remember that each quad will need it's own set of uv coords. They can't be shared.

struct quad
{
   vector3 [4] vertex;
   vector2 [4] uv;
}
3) Go through the quads and assign them the uv coords from your texture atlas. Refer to the list from step one.

4) Use XNA to create a vertex object out of your data from your struct.

5) When drawing, load the tiles texture atlas, and then just draw your map out in 1 call, as one model.

Drawing your map til by tile means you are sending over 4000 draw calls per frame. That's about ~3500 too many!

 

yah I know :D

 

thanks. I will try that.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0