Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (741)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (823)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  (Another) Terraria-Clone  (Read 6967 times)
0 Members and 1 Guest are viewing this topic.
Offline Baseball435
« Posted 2015-09-25 15:48:39 »

Yes, here is yet another Terraria-clone (currently unnamed until I come up with a specific direction) that I am developing using LibGDX. Unlike most other clones, my main focus for the game is to optimize it as much as possible to allow it to be played smoothly on mobile (Android) devices. Because of this my sole focus is to design complex algorithms to keep the amount of resources and memory being used as low as possible. For example, the two big things that I am currently focusing on optimizing are the world management system and the lighting system. Right now I have the world management system pretty much done. I am able to have a world with 1,620,000 tiles managed efficiently and ran on an Android device at a stable 30 fps. I also developed my own physics system which efficiently handles collisions for all entities in the world. The basis of the lighting system is done but I need to work on the removal of light when it is surrounded by other lights.

Current Features
  • World Management System
  • Procedural World Generation
  • Physics System
  • Lighting System
  • Saving and Loading Worlds
  • Block Breaking System
  • Item and Inventory System
  • Crafting System

Current Focus
  • Working on the procedural generation of the world.

Stream
I live stream development of the game whenever I am working on it. You can watch my streams here. Be sure to sign up and follow me to get notified when I am streaming. I stream everyday for a few hours a day!

Video Feature Showcase - December 19th, 2015
https://www.youtube.com/watch?v=-z4o8CwJR8E

Update #3 - December 17th, 2015
I managed to implement procedural generation of caves, ores, and trees. The cave generation values need to be played with a tad, but as of right now it works great. You can see a picture of the updates below. Let me know what you guys think!



Update #2 - October 5th, 2015
So I added the inventory and item system to the game! I also added drops when breaking blocks. Here is an image of what it looks like currently. The next thing to do is to add the ability to place blocks based on what is selected in the inventory. Let me know what you guys think!




Update #1 - September 30th, 2015
Here are some images of the game. The first image is a picture of the lighting system as of a day ago. The second image is a picture of the lighting system as of two days ago.





As I further the lighting system I will be posting more pictures and videos. Let me know any suggestions and comments you have!
Offline Baseball435
« Reply #1 - Posted 2015-09-28 20:06:06 »

Just finished the algorithm that removes the lighting generated by a light source. The important thing with my lighting system is that, unlike most other light systems, my system doesn't have light sources generate a dynamic light value each frame. We can assume that light sources only change when they are modified (broken, placed, or moved) so there is no need for a light source to generate light values every frame. My system generates a dynamic light value once after the light source is placed. It removes the generated light once the light source is removed (broken). It cuts down on resource-usage and makes the game run a lot faster. It also works very well with multiple lights placed next to eachother. Here are images of the lighting system in action, starting from one light source, adding more, breaking some surround blocks, and then removing them. Let me know what you guys think!







Offline chrislo27
« Reply #2 - Posted 2015-09-28 20:38:38 »

Just finished the algorithm that removes the lighting generated by a light source. The important thing with my lighting system is that, unlike most other light systems, my system doesn't have light sources generate a dynamic light value each frame. We can assume that light sources only change when they are modified (broken, placed, or moved) so there is no need for a light source to generate light values every frame. My system generates a dynamic light value once after the light source is placed. It removes the generated light once the light source is removed (broken). It cuts down on resource-usage and makes the game run a lot faster. It also works very well with multiple lights placed next to eachother. Here are images of the lighting system in action, starting from one light source, adding more, breaking some surround blocks, and then removing them. Let me know what you guys think!

-snip-

We can't see your images. You'll have to paste the actual image link (which actually is hosted on imgur).

Good on you for optimizing the lighting engine! I don't think Terraria dynamically updates per frame, most engines actually update when needed rather than per frame.

Have you considered putting colours for lights? The colours can mix together with different light sources. Here's a screenshot of my game way back when I was using recursive flood-filling (it uses raycasting which is faster).


It looks smooth but it's just gradients to interpolate between tiles. Try it!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Baseball435
« Reply #3 - Posted 2015-09-28 20:58:34 »

My mistake! Fixed the pictures. I am not using a raycasting algorithm, I figured a grid-based recursive fill algorithm would work efficiently (which it does). The system doesn't currently support different colored lights but it's definitely something I'd like to add in the future and something I already know how I'd do.

My philosophy right now is to ignore the cosmetics of the game and focus strictly on the fundamentals and background services of it. I'll worry about the cosmetics when the game is fundamentally sound.
Offline chrislo27
« Reply #4 - Posted 2015-09-28 21:14:32 »

My philosophy right now is to ignore the cosmetics of the game and focus strictly on the fundamentals and background services of it. I'll worry about the cosmetics when the game is fundamentally sound.

Yup, sounds just like the opposite of how I normally do things Roll Eyes

Recursion can either be pretty efficient or not so much depending on your method of execution. If you're doing repeated method calls for recursion, it works but it's not the fastest. A faster way would be to iterate through a queue, but seeing as your game doesn't have as huge of a world as I did it's not a big deal right now.
Offline Baseball435
« Reply #5 - Posted 2015-09-28 22:12:38 »

My philosophy right now is to ignore the cosmetics of the game and focus strictly on the fundamentals and background services of it. I'll worry about the cosmetics when the game is fundamentally sound.

Yup, sounds just like the opposite of how I normally do things Roll Eyes

Recursion can either be pretty efficient or not so much depending on your method of execution. If you're doing repeated method calls for recursion, it works but it's not the fastest. A faster way would be to iterate through a queue, but seeing as your game doesn't have as huge of a world as I did it's not a big deal right now.

Haha I guess that depends on your definition of huge. My world currently has 1,620,000 tiles in it which I would personally say is pretty huge. Why would work size depend on whether to use the raycasting method or not?
Offline Ed_RockStarGuy
« Reply #6 - Posted 2015-09-28 22:23:16 »

Well my game http://www.java-gaming.org/topics/iconified/35090/view.html has a max map size of 68,719,476,704 X 68,719,476,704 xD total map size on disk 17GB xD
Offline Baseball435
« Reply #7 - Posted 2015-09-28 22:40:14 »

Well my game http://www.java-gaming.org/topics/iconified/35090/view.html has a max map size of 68,719,476,704 X 68,719,476,704 xD total map size on disk 17GB xD

Well I can't say I have tried maxing it out so Ill do that later tonight and let you know. I'm also targeting this for mobile which is a huge difference when you compare CPU and how much memory each can handle
Offline chrislo27
« Reply #8 - Posted 2015-09-28 22:57:39 »

-snip-

Haha I guess that depends on your definition of huge. My world currently has 1,620,000 tiles in it which I would personally say is pretty huge. Why would work size depend on whether to use the raycasting method or not?

I think I must've made an error. World size doesn't matter, but it's how many tiles on-screen at once that matters for updating. My raycasting technique is more-so a Bresenham line algorithm except counting down a light value for brightness. It works a lot faster (and prettier) than the recursive way because it's not constantly calling functions. My bad! Tongue
Offline Baseball435
« Reply #9 - Posted 2015-09-28 23:38:11 »

-snip-

Haha I guess that depends on your definition of huge. My world currently has 1,620,000 tiles in it which I would personally say is pretty huge. Why would work size depend on whether to use the raycasting method or not?

I think I must've made an error. World size doesn't matter, but it's how many tiles on-screen at once that matters for updating. My raycasting technique is more-so a Bresenham line algorithm except counting down a light value for brightness. It works a lot faster (and prettier) than the recursive way because it's not constantly calling functions. My bad! Tongue

Oh okay I can understand that more, but in my recursive fill algorithm the amount of tiles on the screen doesn't matter. This leads me to believe that your algorithm, potentially, iterates through all of the tiles on the screen. I would assume that you raycast around the source of the light but I'm not familiar with the Bresenham line algorithm so I'll have to look into it.  

I also don't think that you can say that because a method is recursive, it is therefore slower than a non-recursive method. The fact that it calls a method over and over doesn't slow down the algorithm unless you're comparing it to another algorithm where there are less statements being called on. This really comes down to comparing two algorithms runtime with, say, Big O notation.

For example, say we are trying to sort an array of 1000 elements and we have the option to use the iterative bubble sort method or the recursive merge sort method. You can calculate the Big O runtime for each and see that the merge sort performs extremely faster than bubble sort. You can also do benchmark tests to get the same results. The fact that a method is recursive doesn't slow down the speed and in some cases can make an algorithm more readable.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline chrislo27
« Reply #10 - Posted 2015-09-28 23:47:38 »

My recursive method was actually quite efficient like you said (it acted just like yours, spreading out from a source), but as the number of light sources grew, the amount of method calls grew a lot as well. Method calls are much slower than iterating.

Recursion is great when the language has tail-recursion optimization. However, Java does not.

Regardless of our lighting methods, both recursion and raycasting work quickly. I also mainly chose raycasting after recursion because I disliked my diamond-shaped lights that recursion had, not because recursion was slow.
Offline Baseball435
« Reply #11 - Posted 2015-09-28 23:49:29 »

My recursive method was actually quite efficient like you said (it acted just like yours, spreading out from a source), but as the number of light sources grew, the amount of method calls grew a lot as well. Method calls are much slower than iterating.

Recursion is great when the language has tail-recursion optimization. However, Java does not.

Regardless of our lighting methods, both recursion and raycasting work quickly. I also mainly chose raycasting after recursion because I disliked my diamond-shaped lights that recursion had, not because recursion was slow.

Yeah I do hate the diamond shape. I may possibly look into that line algorithm later and do some benchmark tests to see what lighting method's more effective. Now that I've got the system working efficiently though I'm going to stick with it.  Smiley
Offline Baseball435
« Reply #12 - Posted 2015-09-30 04:22:59 »

So today I made some updates to the UI system and how I believe it will work. I got rid of the ugly arrow buttons that move around the player and switched them with "joysticks" where dragging the left joystick horizontally will move you left and right and dragging upwards will make the player jump. I also added a joystick to the right side that is used to break blocks and in the future, attack monsters and other actions. It works by dragging the joystick in the desired direction that you intend on breaking the block. It will also highlight the block that you are attempting to break so you know what you're aiming at. You can see it in the picture below. The arrow on the right side switches between placing torches and destroying blocks by clicking the screen. This is completely for debugging purposes and will be removed. Let me know what you guys think!

Offline Baseball435
« Reply #13 - Posted 2015-10-05 22:14:57 »

So I added the inventory and item system to the game! I also added drops when breaking blocks. Here is an image of what it looks like currently. The next thing to do is to add the ability to place blocks based on what is selected in the inventory. Let me know what you guys think!

Offline Baseball435
« Reply #14 - Posted 2015-12-17 15:07:15 »

Hey everyone, it's been a long time since I last posted an update to this game and that's because college kind of took over most of my time. Now that I am on winter break, I have began continuing development of the game. Over the past 24 hours I managed to implement procedural generation of caves, ores, and trees. The cave generation values need to be played with a tad, but as of right now, it works great. You can see a picture of the updates below. Let me know what you guys think!

Offline Baseball435
« Reply #15 - Posted 2015-12-20 22:23:10 »

Just released a video showcasing the current features in the game and what I plan on working on next!

Video Link: https://www.youtube.com/watch?v=-z4o8CwJR8EMmB9b5njVbA

Let me know what you think!
Pages: [1]
  ignore  |  Print  
 
 

 
Ecumene (108 views)
2017-09-30 02:57:34

theagentd (135 views)
2017-09-26 18:23:31

cybrmynd (245 views)
2017-08-02 12:28:51

cybrmynd (240 views)
2017-08-02 12:19:43

cybrmynd (238 views)
2017-08-02 12:18:09

Sralse (252 views)
2017-07-25 17:13:48

Archive (864 views)
2017-04-27 17:45:51

buddyBro (1007 views)
2017-04-05 03:38:00

CopyableCougar4 (1566 views)
2017-03-24 15:39:42

theagentd (1373 views)
2017-03-24 15:32:08
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!