cave game - generic terraria clone

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

cave game - generic terraria clone

Post by josh_uu »

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 573 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: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: cave game - generic terraria clone

Post by bobbyjones »

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.
User avatar
josh_uu
Prole
Posts: 11
Joined: Sat Aug 24, 2019 12:35 am

Re: cave game - generic terraria clone

Post by josh_uu »

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: 3674
Joined: Sun Oct 18, 2015 2:58 pm

Re: cave game - generic terraria clone

Post by pgimeno »

Capping dt should work as an easy fix. It's probably also a sensible fix.
User avatar
josh_uu
Prole
Posts: 11
Joined: Sat Aug 24, 2019 12:35 am

Re: cave game - generic terraria clone

Post by josh_uu »

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: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: cave game - generic terraria clone

Post by bobbyjones »

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
User avatar
josh_uu
Prole
Posts: 11
Joined: Sat Aug 24, 2019 12:35 am

Re: cave game - generic terraria clone

Post by josh_uu »

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 396 times
epic epic epic discord: joshuu#6360
User avatar
josh_uu
Prole
Posts: 11
Joined: Sat Aug 24, 2019 12:35 am

Re: cave game - generic terraria clone

Post by josh_uu »

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: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: cave game - generic terraria clone

Post by Jeeper »

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: 11
Joined: Sat Aug 24, 2019 12:35 am

Re: cave game - generic terraria clone

Post by josh_uu »

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 9 guests