Allowing user to create tile map "in-game"..where tiles are dynamic objects

Started by
4 comments, last by Alberth 8 years, 1 month ago

Hey all! (i'm new here after lurking for a while)

I am making a garden simulator (generally a bit lost as to how to advance).I'd like the user to plot out their space on screen by drawing a box.

Inside that box they will then place tiles to represent a vegetable (either individually or cluster) these tiles will represent objects and will grow according to their methods/attributes.

I have seen a number of tile editors, but they all seem to focus on creating a map BEFORE, to allow a character to roam around etc.

This doesn't have to be beautiful , but the nicer the better! 2d , 2.5d or 3d, whatever will suit best! it is more to act as a garden advisor and to try engage school kids into growing/gardening.

I am thinking Unity with C#. I am still in research mode so this is open to change.

Architecture: Thinking a web server (service?) where the database driven business logic is done and pushed out to the android app/web app, mostly to allow data persistence and reduce the load on the app itself. This way new crops and features can be added as time goes on.

(to paint a picture, think age of empires/ civilization, with a top down view. You have a vegetable patch is interactive, place, water, harvest.. affected by real weather information)

All help appreciated! :)

Eoin

Advertisement

Hi, unlurker :)

You don't seem to have specific questions (or I am missing them in your text), so I'll just comment on the general idea.

I believe the idea is very feasible. You display an area of tiles on the screen, and a list of vegetables you can select from. Also add a "blank" tile (eg just earth) to the tile set. Initially, the entire map are such tiles (ie an empty garden). By selecting a vegetable from a list, and then clicking on a blank tile, you change the map to the selected vegetable, and display a tile with crops of the selected vegetable.

Most games are about exploration or discovery. Also, many have obstacles to overcome. If you have an in-game editor, you must be able to see and change the entire world. This implies that discovery of new areas is not possible any more, nor is overcoming obstacles (I can edit the world, so the simplest way is to simply delete the obstacle :p ). With such games, an in-game editor would kill the game. Another issue is that in a game, time progresses. Things decay, or resources are taken away by a player or an AI. In such an environment, it is hard to make a proper setup to be played at a later date, since anything you prepare can change while you focus elsewhere :)

Maybe you can make a game out of that though :p

As for the web technology, I don't know about that stuff.

Hey thanks for replying!

(for anyone with similar problems, i am making a blog so others can learn from my findings/mistakes ... http://eoinpayneproject.blogspot.ie/ ... it's crap, but maybe it can help someone!)

Yea i am trying to hone in a little further to allow me to ask SPECIFIC questions, but your reply has helped with that! For some reason i overlooked the idea of just using a "regular earth" tile, (this could be a prerequisite for any veg to be planted).

I will not be aiming for a in world discovery feel, more of a simulation, where you are rewarded for when you water/plant/harvest at the right times, or plant things together that help eachother grow etc... So i guess it would start off with an "infinite" grassy background (or something the user can choose on the map load out) and then they can design their garden and plant crops as they see fit.

The idea of "decay" will be incorporated for sure, as time passes crops grow and become dryer etc. I *think* i will be able to handle the programming logic fine enough for most of this. What i am inexperienced with is the "game" aspect... how i can visually simulate this.

So my specific question would be: Are there any suitable assets or packages that could help with this? If not, what is the general area i should be researching to get a start on this badboy?

Ways i see this working:

Most simply

Ideally - i have a feeling getting it to look like this would be very difficult, but the garden in the first scene is a good representation.

ProTile map editor for unity - This could work if i could a) make the tiles act as a vegetable tile that are affected by the movement of time. b) if the tile placement could be done by the user in game.

UniTile3d for unity - very similar to above

Think age of empires, where you can interact with the environment by placing tiles that are in the side bar to the ground, and then they are objects you can interact with. Even less complicated, as it will be limited to squares/rectangles!

277315-age_of_empires.jpg

Ways i see this working:

Most simply

Ideally - i have a feeling getting it to look like this would be very difficult, but the garden in the first scene is a good representation.
These are different techniques. The first one is a set of 2D pictures (think PNG files made with a pixel editor, or a paint program), where you program to blit images at the right position. Even your "ages of empire" dimetric screen is that. It looks 3D-ish, but it's just flat PNGs with a weird shape. Obviously, dimetric view gives bigger challenges in rendering and position calculations.

Your "Ideally" is a 3D world. You use software like 3Dmax or Blender, which results in a 3D model, which you then dump onto your video card to render. (At least, that's what I know. I have never done anything 3D yet, firmly stuck in the 2D dimetric, and hexagon worlds :p )

As for assets, read the pinned articles in the "Visual arts" forums, there is a list of publically available free art sets/sites there. You should check the license of a set before use, to avoid surprises.

What i am inexperienced with is the "game" aspect... how i can visually simulate this.
The technical term for the thing you are looking for is the model-view-controller pattern. While it's useful to read it, it's so abstract that you probably won't get much wiser from its description.

To make it more concrete:

You need a model, a world like a (2D) grid with vegetables, just think a 2d array of Vegetable objects. Each object contains the information of the plant at its position, amount of water, age, how much sun it got, did you talk enough to it, etc, just everything relevant to the game.

Next, you need a view. You want to display that world to the user. Build code that can draw some graphics (eg select a PNG image) based on the Vegetable object, and draw the selected image at the spot of the vegetable, to the screen.

Do that for the entire 2D array, and you have an area filled with vegetables.

Now, since the renderer only uses the Vegetable object data, and nothing else, changing a vegetable is easy. Just change the Vegatable object, and ask the screen to redraw that vegetable. Done!

The "changing" part is the controller, pieces of code that change the data, eg after time has passed.

A user interacts with the screen, and clicks at something. The controller receives the click, and performs the action in the world. It asks for a redraw, and done!

Of course it all sounds very simple in the few lines that I write, reality will be harder :)

But I think this is the direction that will work.

I haven't looked at your Unity links, as I don't know it. I do know it's quite good at 3D modeled graphics. If you aim for 2D PNG images instead, you may not need such a tool (but I don't know for sure.)

Ok, this all helps to narrow things down a bit! I am not locked into using unity just yet, as i still need to work out how i can actually approach this before learning what tech to learn...


You need a model, a world like a (2D) grid with vegetables, just think a 2d array of Vegetable objects. Each object contains the information of the plant at its position, amount of water, age, how much sun it got, did you talk enough to it, etc, just everything relevant to the game.

Could I hassle you to go into this a little further?.. Do you mean upon creating the initial world, create it with a default "Vegetable" (maybe like a blank Vegetable) with all required stats like water, age, sun etc etc? I ask because when you say:


Next, you need a view. You want to display that world to the user. Build code that can draw some graphics (eg select a PNG image) based on the Vegetable object, and draw the selected image at the spot of the vegetable, to the screen.
Do that for the entire 2D array, and you have an area filled with vegetables.

i am not sure if you mean to predefine all Vegetable objects and just let the user change them. ... My objective is to start out with a blank "garden" then the user can define the are to be grown in, then place the vegetables within that space.


Now, since the renderer only uses the Vegetable object data, and nothing else, changing a vegetable is easy. Just change the Vegatable object, and ask the screen to redraw that vegetable

This seems like a very nice way to allow each tile to "grow". insert logic based on time and rain etc to change the specific instances of the a vegetable accordingly via the MVC!

However i don't see what you mean by "since the renderer only uses the Vegetable object data, and nothing else" ?

Thanks again for the responses smile.png

Edit: might not be your area of expertise, but the game Dungeon Keeper has the feel i am looking for (except mine would be simpler as there would be no actual characters to worry about, which means no path finding... just the environment manipulation seen in this video , mostly the multi selection of tiles and the conversion of tiles from one type to another. Also see the way certain tiles end up being "active".

Could I hassle you to go into this a little further?.. Do you mean upon creating the initial world, create it with a default "Vegetable" (maybe like a blank Vegetable) with all required stats like water, age, sun etc etc?
I hadn't really thought things through, but your idea of a blank vegetable sounds like a nice solution to me. That way you always have a vegetable at every position, just the blank ones don't grow very fast (<evil-idea>hmm, maybe they should becomes weeds :p </evil-idea>).

Setting a new vegetable then also means you always replace a previous one. Makes things easier :)

However i don't see what you mean by "since the renderer only uses the Vegetable object data, and nothing else" ?
I meant to say that the Vegetable object contains all data necessary to draw it. Any change in appearance of the vegetable to the user is achieved by changing the Vegetable object, and then asking it to render it again.

In particular, there is no other separate data about what is currently being shown to the user (except maybe meta information like scrollbar positions etc).

This topic is closed to new replies.

Advertisement