Jacbil Gobbet

xplosion28

  • *
  • Posts: 257
I have been working on a 2D version of Minecraft the past few days and have made some tremendous progress.  I took this project mostly to gain the experience in tools that I have not used yet, such as the Tile API and using a map.

2D Minecraft
In this first game I used the Tile API to create and remove tiles.  By checking whether a tile is next to the actor in the specified directions allows the player to move freely and move blocks/place blocks on the go.  I have found that the collisions of the tiles sometimes cause the player to get stuck on what seems to be nothing, which I'm looking into to try and fix.  Using simple boolean attributes allows the user to select a number(1-5) to select a block to be placed (if the user has a block of that type).  Also the map terrain is randomly generated.

http://www.stencyl.com/game/play/34414

Minecraft Crafting System
I also went ahead and wanted to add another feature, the crafting system of Minecraft.  More so to see if it was possible/practical.  Here I used a map in order to add values for specific slots.  I only made 4 slots (just as Minecraft has without a crafting table) and the user can make 3 different items from wood (crafting table, plank, and sticks).  In this variation I made it separately from the tile game, meaning you won't collect the blocks yourself, rather I just provided 5 wood when created to test it out.  The cool think I found was the ability to create items in any orientation, like Minecraft.  For example, you can place wood in any of the 4 crafting spots and it will create planks, I was worried I would only be able to make it in the top-left corner, but adding the extra booleans for the different slots makes this possible.

http://www.stencyl.com/game/play/34415

Looking Ahead
I want to add trees to be randomly generated on the top layer, will require some tricky loop statements.  Mostly due to the branches attached to the tree trunks, I could probably create a few preset tilesets to create the tree.  Also need to add some sort of deadly obstacles, such as lava, deep holes, etc.  Once I have the trees spawning I'll look into adding the crafting system into the actual game.  If anyone has some unique ideas they want me to look into adding into it I'm all ears.

Updates
-Just added a save function to save all the tiles, blocks in the players inventory, and the players location.  Sadly you must press enter to save, because I didn't want to place it in an updating block as that could cause performance issues.
-Added trees to be spawned, made it so that when the trees are spawned they are placed on a layer in front or behind of the player adding some depth to the game.

Gameplay
https://youtu.be/BKxJVqdSAcA
https://www.youtube.com/watch?v=JrAUCXBMQnQ

« Last Edit: July 30, 2016, 08:52:08 pm by xplosion28 »

merrak

  • *
  • Posts: 1958
I played the Minecraft Ceosol demo. It works pretty well, but I see a potential issue. Maneuvering through the world is tedious, since every pit is an obstacle and cannot be walked around. I can think of a few ways to get around this--building your way out, using one-way platforms to name a couple.

xplosion28

  • *
  • Posts: 257
You can build your way out, by moving and pressing spacebar towards a tile will remove the tile and put it in your inventory.  From there just jump, press down and spacebar quickly will put a block underneath you.  Make sure you have a block selected in order to place it, do this by pressing numbers 1-5.

I may add a function where you can just press the down arrow key and it will create a tile in place of your character, moving your character up.  This would make it easier than pressing down and spacebar quickly.

xplosion28

  • *
  • Posts: 257
Was really hoping that the scene could be made quite large and not have too much of a FPS drop.  However whenever I go any bigger than 100 tiles wide and 60 tiles tall, the FPS drops to around 5.  Therefore I will most likely add scenes to act as different biomes, still giving the game a feeling that it is quite large but not requiring it to all fit in one scene.

Meestar

  • Posts: 652
Was really hoping that the scene could be made quite large and not have too much of a FPS drop.  However whenever I go any bigger than 100 tiles wide and 60 tiles tall, the FPS drops to around 5.  Therefore I will most likely add scenes to act as different biomes, still giving the game a feeling that it is quite large but not requiring it to all fit in one scene.
Actually, there are work arounds.  You need a chunk management system like in Minecraft, then you'll have no problem with larger scenes.  You said you already have saving of tiles and stuff done, right?  Well, if you break up the world more and create it on the fly, off screen, then you can generate a larger world.

To expand on this more, you need to decide on a good size for each chunk of the world.  When you are about to leave a chunk, you check to see what direction is being headed in and how many chunks you'd need to load and how many you could unload.  You'd want to do the loading and unloading off screen so the player doesn't notice.

Edit:

Have you considered using Mouse Clicks to remove/place tiles?  It's really simple to convert the mouse to a tile location, simply by adding the camera position to the mouse then dividing by tile size.  You can also keep track of the last tile clicked if you want to progressively "break" a tile.  If the tile clicked isn't the last tile clicked, then you stop breaking the first tile.  You can use another layer + tile API to add a break graphic tyo the block based on the block's id.

Also, if you use the image api to write your own collision detection method, you can get even more performance out of the game.

I have a fairly good understanding of Minecraft's code (I've been able to recreate it in a 3D game engine, plus I've made several mods for the Java version), so if you have any questions, I can certainly help you out, especially with Stencyl code.

« Last Edit: June 14, 2016, 11:57:23 am by Meestar »
PM me if you require help.  I'm always glad to help out!

letmethink

  • *
  • Posts: 2538
I suggest using simple physics if you are currently using box2d.
~Letmethink

xplosion28

  • *
  • Posts: 257
I actually thought about creating the world as needed, just haven't gotten around to doing it yet but thanks for the advice!  As for the clicking, I started the project using clicking to break the blocks which worked great, but I was actually making the game for someone else and they preferred not to use the mouse.  Which is why I changed it to using the spacebar.

I haven't used the image API, especially for anything like this, just from what I heard I figured using tile API would be the best.  Although I'll look into it now to try and boost the performance.

Thanks a lot Meestar!  Don't worry I will definitely take you up on that advice sooner or later ;D

Ahh totally forgot about changing the physics, that should also help the performance.  Thanks  letmethink!

Meestar

  • Posts: 652
I actually thought about creating the world as needed, just haven't gotten around to doing it yet but thanks for the advice!  As for the clicking, I started the project using clicking to break the blocks which worked great, but I was actually making the game for someone else and they preferred not to use the mouse.  Which is why I changed it to using the spacebar.

I haven't used the image API, especially for anything like this, just from what I heard I figured using tile API would be the best.  Although I'll look into it now to try and boost the performance.

Thanks a lot Meestar!  Don't worry I will definitely take you up on that advice sooner or later ;D

Ahh totally forgot about changing the physics, that should also help the performance.  Thanks  letmethink!
Well, the tile api will definitely help on the performance front, but if you learn how to do collisions based off of the image api in addition, you can definitely speed things up and won't need Stencyl's physics system at all.  It'll be especially easy since the world is made of flat lines as opposed to curves and the like.

Even without using the mouse, you can still do the breaking over time thing.
PM me if you require help.  I'm always glad to help out!

xplosion28

  • *
  • Posts: 257
Yeah I know the tiles can have the break over time effect, just haven't got around to making that yet.  I've only been working on the game for 3-4 days now, I've been trying to get the main mechanics working and adding a inventory and crafting system.  Once that is complete I'll come back with a fine tuner and add those little aspects of the game.

xplosion28

  • *
  • Posts: 257
Debating whether to make a crafting system like Minecraft or just be able to create items based on if you have the required resources.

The crafting system Minecraft has would require a lot more work and has potential negatives such as players having to try random resource combinations to make  different items.  While this could be fun for some, others may find it more annoying.  The other side to this would be I would have to make a website or something to let people know how to make certain items who don't want to waste time to figure it out themselves.

Just wanted to get some other opinions to sway me in a certain direction haha :P

ceosol

  • *
  • Posts: 2196
If it is more difficult to program and most players would not understand it without some wiki or tutorial information, then I think you have your answer. It would still be based on a combining the correct number of things. People who look to figure out the combinations would still enjoy doing that part regardless of "position based" crafting.

Maybe in a later version you could have a secondary goal of having the correct position - giving some type of bonus or achievement.

rob1221

  • *
  • Posts: 9153
Terraria has a guide NPC that tells you what you can make out of any material you give him.

Justin

  • *
  • Posts: 3956
Minecraft is awesome. Minecraft's crafting system sucks.

For Live Support: Join our discord channel and ping me @justin.

xplosion28

  • *
  • Posts: 257
Well I think we have the answer then (scratch minecraft crafting system), so ideally if you could describe your "perfect crafting system" how would you guys want it?

OGMG

  • Posts: 17
It might be a little hard to implement, but I'm a pretty big fan of the crafting system in Craft the World. The workbench shows a template of what's needed for each craftable item - then you can add the required items if you have them. You can find videos online.
I have no idea what I'm doing.