How would you implement a map system like WoW?
28. Květen 2024 v 22:22
I'm really struggling with a 'resonable' technical implementation of the map system used by the popular MMO World of Warcraft. Not really sure on a data structure format and how to save/store it in a SQL relational DB. I've come up with an idea below, but wondered if anyone had any better ways?
A brief summary of the map system used by World of Warcraft:
- Loading up the map starts with a blank outline of a continent
- Each continent has multiple 'zones', which are outlined, but blank
- Selecting a 'zone' zooms into the zone, but it is initially blank
- As the player explores the zone, certain areas within the zone will 'be discovered' and will be coloured and detailed in
- Players need to explore the whole zone for it to be fully discovered and show a 'complete' map
- Players can discover any area of the map in any order
- Maps and areas are not rigid, they can be complex and different shapes and sizes
My current thinking:
- Use a 2D tool to create the following 2D assets
- The blank outline of a zone
- Multiple transparent layers with a certain area 'coloured', which could be overlayed onto the blank outline
- Assign an integer ID to each area layer
- When a player discovers a zone
- Attempt to find the correct corresponding layer and assigned 'integer'
- Add this integer to an array corresponding to a zone
- When a player logs off
- save this array to a string, seperating the integers with a underscore
- save this string to a seperate SQL table, using the character ID as a primary key
- When a player logs on
- load all rows using the character ID as a lookup
- Load all of the integers sperating them out with the underscore
- use the integers as a ID reference to the transparent layers to show as visible
Thoughts?