Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: c++ Looking for idea how to make a map/multy layer difficult  (Read 4568 times)

0 Members and 1 Guest are viewing this topic.

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
Hello. (c++ sfml)
Why em i making this post?
Well the reason is, i wanna talk to my fellow "everyone" about and how to do the following thing:

2D tile based map that needs a few things:
Need to generate it at random
It needs to hold a info what type each tile is (because of gathering, mining, digging)
Should be able to stream it (during runtime save peaces of map that are far from user and open the ones hes gonna cross up to (if nothing to load, generate)
A height (aiming about to 0(bottom) to 3-10(top) height of land from bottom to far top)
Able to manipulate the terrain ( Because of digging, mining...)

If you are willing, think about it and gimme a helping hand if you had experience in doing this.
I am gonna probably make a tutorial with what i end up.

What i am gonna do first.
Think off what the base for a map needs to be in code
How i am gonna save it (format)

Then
Get to display/draw it in code
Get to generate most simple of map

Then
Manipulating the terrain
Streaming during runtime

Then
Improve!
« Last Edit: July 14, 2013, 03:25:56 pm by BaneTrapper »
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

Anonymouseable

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: c++ Looking for idea how to make a map/multy layer difficult
« Reply #1 on: July 16, 2013, 12:14:52 am »
So basically what you want is a multi-dimensional infinite-size storage/search scheme... Right?

also looks to me like you're trying to clone Dwarf Fortress/Towns/Gnomoria :P

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
Re: c++ Looking for idea how to make a map/multy layer difficult
« Reply #2 on: July 16, 2013, 12:55:27 pm »
So basically what you want is a multi-dimensional infinite-size storage/search scheme... Right?
About right.

also looks to me like you're trying to clone Dwarf Fortress/Towns/Gnomoria :P
About right. Except you are gonna be playing(controling) only one "thing" and struggle for a quest.
During that quest you will need to survive the wilderness and what comes upon dust.
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

Gobbles

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Re: c++ Looking for idea how to make a map/multy layer difficult
« Reply #3 on: July 16, 2013, 07:24:32 pm »
The first question I have to ask is what kind of view are you going to be using? you plan on using flat side view (Terraria style), a flat top down view(old rpg style) or a fake 3D view (Gnomaria) ? Each view brings different challenges when it comes to 2D maps.

A lot of  the stuff you mention comes with basic map setup and I'll try my best to explain the points the best I can.

Need to generate it at random
It needs to hold a info what type each tile is (because of gathering, mining, digging)
Should be able to stream it (during runtime save peaces of map that are far from user and open the ones hes gonna cross up to (if nothing to load, generate)
Able to manipulate the terrain ( Because of digging, mining...)

For this stuff some basic map chunk setup should be enough to set up a good map with everything you want here.

What is a chunk? well a chunk is just a group of blocks in some format: 64x64(x64 if we are faking 3D)
That's all it is. Simple!
Each block in a chunk is your basic block, has a type ( could be dirt, grass, rock, wall.. whatever) which can be set any way you want. I prefer to use enums.

Now that we have a chunk, we have a manageable chunk of data we can work with, even replicate. A ChunkManager class will allow us to create and destroy chunks, draw them, manipulate them and let the magic happen.

This just scratches the surface of it. Once you have this very basic setup complete, you can start performing more magic to your work.

I will expand on this stuff a bit later, work just seems to keep piling up and I can't ignore it forever.
Good luck with this though, A proper map generator can be an amazing piece of work!

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
Re: c++ Looking for idea how to make a map/multy layer difficult
« Reply #4 on: July 16, 2013, 10:28:54 pm »
The first question I have to ask is what kind of view are you going to be using? you plan on using flat side...
Thank you for interesting and help.
And i am sorry for the lack of information!

What i am making is top down 2d view. 32x32 format(tile size).
Currently i just done the map loading(as one big peace). I am using sf::VertexArray for drawing the actual map, but i hold tile information in sf::vector. Ive done editing tiles (when i press Z button i replace the tile i am standing on with a water tile, this is just base to see it all in action.
I will require to build a huge manager to track all those stuff when editing tiles EX:

I am counting to have 3 buttons to use for commands and 1-9 for hotkeys on items...
I am still wondering how i will do the following, imagine the scene (Player standing on "grass" tile, on witch there is "Berry bush", the player pressed "Collect/Harvest"

There is allot of code i need to do, damn it c++ is slow ^^.
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

Gobbles

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Re: c++ Looking for idea how to make a map/multy layer difficult
« Reply #5 on: July 17, 2013, 01:29:46 am »
Quote from: BaneTrapper
Thank you for interesting and help.
And i am sorry for the lack of information!

No problem, always glad to help.

Quote from: BaneTrapper
I am counting to have 3 buttons to use for commands and 1-9 for hotkeys on items...
I am still wondering how i will do the following, imagine the scene (Player standing on "grass" tile, on witch there is "Berry bush", the player pressed "Collect/Harvest"

There is allot of code i need to do, damn it c++ is slow ^^.

My recommendation is to try and scale back what you are trying to achieve. Scope creep (as I like to call it) is probably one of the most common way projects become overwhelming and dumped.

Try and narrow your focus down to a specific goal, a map generator is a lot of work and takes time to get right.

Once you have a specific task in mind and you need some help I will more then gladly give you a hand at it :)

Good Luck!

 

anything