cave game - generic terraria clone

Show off your games, demos and other (playable) creations.
User avatar
josh_uu
Prole
Posts: 9
Joined: Sat Aug 24, 2019 12:35 am

cave game - generic terraria clone

Post by josh_uu » Sat Aug 24, 2019 12:50 am

Hey there. This is my first time posting.

I have been working on a "clone" of games like Terraria and Minecraft for about a month now. I figured it was time to show off progress a little bit.

The world is generated in chunks, and is effectively infinite (rounding errors make the game spaz at ~2-billion tiles out). Right now the basics of world generation, physics, collisions, and player controls are in place. Crafting, combat, and lighting have been partially implemented. Other things such as lighting, enemies, and world saving/loading are planned as well.

Constructive criticism and ideas are welcome, and encouraged, for both the game and the code. If you have any questions or issues please let me know.
Thanks for your time :)

If you want to keep up with progress, bookmark the itch.io link. I post updates frequently to that page.
https://cavegame.itch.io/play

Controls:

A, D - move
Space - Jump
Click - use item
Scrollwheel - change item
Escape - open inventory
Tab - open console


Edit: reuploaded the .love with a few bug fixes.
Edit 2: putting up newest edition of the project, along with some new info.
Edit 3: bumping about major updates.
Attachments
cavegame-0.3.love
(454.52 KiB) Downloaded 127 times
Last edited by josh_uu on Fri Sep 20, 2019 6:13 pm, edited 2 times in total.
epic epic epic discord: joshuu#6360

bobbyjones
Party member
Posts: 720
Joined: Sat Apr 26, 2014 7:46 pm

Re: cave game - generic terraria clone

Post by bobbyjones » Sat Aug 24, 2019 10:11 am

Well, I fell through the floor when switching active windows. I believe it is a derivative of the bullet tunneling problem. It is repeatable if you grab the window and shake it while over a cavity in the ground. If the frame rate drops a sufficient amount you will fall through the ground. You can also get stuck in a space not big enough for the player by doing that. You should add a keyboard method to change items. Some crazy people play games on a laptop with no mouse. Otherwise, this is very good so far.
Do you frequently have great ideas but immediately lose them? Check out the MVP for my website called IdeaVault. It is designed to solve that problem. Desktop browsers only currently.

User avatar
josh_uu
Prole
Posts: 9
Joined: Sat Aug 24, 2019 12:35 am

Re: cave game - generic terraria clone

Post by josh_uu » Sat Aug 24, 2019 5:20 pm

Yup, that's exactly right. I've looked into finding a fix, but honestly just haven't gotten around to it yet.

For the keyboard-swapping, I suppose the standard 0-9 keys are a logical choice. I'll go ahead and add that today.

Thanks!
epic epic epic discord: joshuu#6360

User avatar
pgimeno
Party member
Posts: 1885
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

Re: cave game - generic terraria clone

Post by pgimeno » Sat Aug 24, 2019 5:27 pm

Capping dt should work as an easy fix. It's probably also a sensible fix.

User avatar
josh_uu
Prole
Posts: 9
Joined: Sat Aug 24, 2019 12:35 am

Re: cave game - generic terraria clone

Post by josh_uu » Sat Aug 24, 2019 5:35 pm

pgimeno wrote:
Sat Aug 24, 2019 5:27 pm
Capping dt should work as an easy fix. It's probably also a sensible fix.
Hey, thanks for the tip. It seems to fix issues caused by lag or window scaling/dragging. Now I just need to fix collision solving having a tendency to teleport you randomly if you get stuck inside tiles, as well as tunneling from massive velocities.
epic epic epic discord: joshuu#6360

bobbyjones
Party member
Posts: 720
Joined: Sat Apr 26, 2014 7:46 pm

Re: cave game - generic terraria clone

Post by bobbyjones » Sat Aug 24, 2019 6:08 pm

If I recall correctly tunneling is caused by predicting the location after movement and if there is no collision then you are allowed to move. If the next location is extremely far away you can travel through walls because you are only testing the target location and not everything in-between. Large delta times and velocities both cause this. You can cap the velocity in the game very easily. You then only have to worry about the delta time. The solution for this I believe is a fixed time step. Essentially you set an acceptable delta time for your game to run at. If the fps is higher causing a lower delta time you skip the update callback to get to the target delta. If the fps is too low you would call the update callback more than once. You would probably have to set the max velocity to where at most you move only one block per time step. Raytracing might also be a solution for things that have to move fast.

Example of fixed timestep:
https://gist.github.com/Leandros/98624b9b9d9d26df18c4
Do you frequently have great ideas but immediately lose them? Check out the MVP for my website called IdeaVault. It is designed to solve that problem. Desktop browsers only currently.

User avatar
josh_uu
Prole
Posts: 9
Joined: Sat Aug 24, 2019 12:35 am

Re: cave game - generic terraria clone

Post by josh_uu » Sat Aug 24, 2019 7:27 pm

Awesome, thanks for the tips. For now i've made naive adjustments by clamping velocity and deltatime before passing them to the physics solver. In the meantime, I also just finished up the fluid mechanics. Open the console and type

Code: Select all

give water_tile 999
if you want to try to break it. Here's the new .love file.
Attachments
cavegame.love
newer version Aug 24
(424.41 KiB) Downloaded 61 times
epic epic epic discord: joshuu#6360

User avatar
josh_uu
Prole
Posts: 9
Joined: Sat Aug 24, 2019 12:35 am

Re: cave game - generic terraria clone

Post by josh_uu » Sun Aug 25, 2019 3:19 am

Another progress update. Implemented rope climbing, and partially implemented lighting. My flood-fill algorithm does not yet account for when light sources are removed, maybe I can find a fix soon.

https://youtu.be/mq1KwwmNUwc
epic epic epic discord: joshuu#6360

User avatar
Jeeper
Party member
Posts: 546
Joined: Tue Mar 12, 2013 7:11 pm

Re: cave game - generic terraria clone

Post by Jeeper » Tue Aug 27, 2019 7:14 pm

josh_uu wrote:
Sat Aug 24, 2019 7:27 pm
Awesome, thanks for the tips. For now i've made naive adjustments by clamping velocity and deltatime before passing them to the physics solver. In the meantime, I also just finished up the fluid mechanics. Open the console and type

Code: Select all

give water_tile 999
if you want to try to break it. Here's the new .love file.
Not entirely sure what you mean by clamping velocity, but what I usually have in the start of love.update(dt) is:
if dt > 0.1 then dt = 0.1 end

User avatar
josh_uu
Prole
Posts: 9
Joined: Sat Aug 24, 2019 12:35 am

Re: cave game - generic terraria clone

Post by josh_uu » Wed Aug 28, 2019 12:22 am

Jeeper wrote:
Tue Aug 27, 2019 7:14 pm
if dt > 0.1 then dt = 0.1 end
Yeah, basically that snippet.
epic epic epic discord: joshuu#6360

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests