Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (428)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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  
  Destructible/deformable terrain help  (Read 1597 times)
0 Members and 1 Guest are viewing this topic.
Offline luisoft

JGO Coder


Projects: 6


Java games rock!


« Posted 2013-04-22 02:46:10 »

Hi,

I just want to try to create a very simple demo/tutorial on how to create a game with destructible/deformable terrain like the good old lemmings or worms.

The problem is that I have no idea where to start. Are there any physics involved? I's like to write a simple level in plain java 2d. I tried to find some examples, but I couldn't.

Any help?

Thanks
Offline BrassApparatus

Junior Member





« Reply #1 - Posted 2013-04-22 03:58:34 »

I'd very much like to know that as well! Smiley
Offline delt0r

JGO Coder


Medals: 22


Computers can do that?


« Reply #2 - Posted 2013-04-22 07:21:58 »

If you don't know what you are doing, its probably not a good idea to do a tutorial about it. A basic prerequisite for teaching is to know your material well.

However that aside, I would answer that question with a question. What data structure would *you* store "ground" information in?

I have no special talents. I am only passionately curious.--Albert Einstein
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Danny02
« Reply #3 - Posted 2013-04-22 12:13:36 »

making something like in worms should be really easy, from the destruction part. Just take a mask texture which resambles the terrain and on each explosion just draw an "empty" circle in this texture.

The more problematic part would be the collision detection, but this would be the same as with any other pixelperfect sprite collision which is used in other 2d games.
Online Phased
« Reply #4 - Posted 2013-04-22 12:18:46 »

If you want it tile based, just created a 2 dimensional array of tiles, each tile will have their co ordinates and texture.

When something collides with the tile have a for loop that checks around the tile to see what tiles to remove.
Offline nerb
« Reply #5 - Posted 2013-05-06 10:28:57 »

Hi,

I just want to try to create a very simple demo/tutorial on how to create a game with destructible/deformable terrain like the good old lemmings or worms.

The problem is that I have no idea where to start. Are there any physics involved? I's like to write a simple level in plain java 2d. I tried to find some examples, but I couldn't.

Any help?

Thanks

Hi luisoft,

Bit of a late reply here.

I asked a very similar question a while back, and got some good answers in the following post:

http://www.java-gaming.org/topics/pixel-based-2d-destructible-terrain/28835/msg/263214/view.html

(Come to think of it, I should go back and appreciate a few of the replies, now I know how).

For the lemmings approach, you can use and manipulate an image for the terrain, and hence have pixel-based destructible terrain. Take note of Rorkien's reply about accessing an image's byte array directly; it's more efficient than messing with get/setRGB().

The only physics involved would be checking the terrain around your 'lemming' and deciding whether he should be falling & splatting, or climbing. A worms clone is obviously a different story, as you then have to handle projectiles and explosions.

Hope it gives you a bit of a starting point.

nerb.
Offline Lucasmontec

Senior Newbie


Medals: 1



« Reply #6 - Posted 2013-05-06 10:45:52 »

Hey guys! I'm fairly new here but I code java for a long while now and I know a tip about this... If you learn how to render good quadtrees (the datastructure) you can generate points where you explode stuff. Worms use quadtrees to make those awesome smooth maps and the results are better than using pixel-perfect. Also pixel perfect consume a lot of time to process compared to quadtree operations.

This video ilustrates quad tree usage for 2d terrain with awesome results:
<a href="http://www.youtube.com/v/NdHhwXzRfR4?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/NdHhwXzRfR4?version=3&amp;hl=en_US&amp;start=</a>

And here an awesome blog post on terrain rendering:
http://chrisbunner.wordpress.com/2011/01/23/terrain-rendering/

Also,
http://chrisbunner.wordpress.com/2011/01/23/deformable-terrain/

I wish I could help you with a tutorial but for that I would have to code the renderer my self and I'm too lazy now. Also I would probably make something ineficient and some godlike coder here would hit me with a bazooka. But if you need help with quad tree's PM me.
Offline Nate

JGO Kernel


Medals: 129
Projects: 3
Exp: 14 years


Esoteric Software


« Reply #7 - Posted 2013-05-06 11:39:04 »

This is neat.
<a href="http://www.youtube.com/v/oacZwUGP11c?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/oacZwUGP11c?version=3&amp;hl=en_US&amp;start=</a>

Offline Lucasmontec

Senior Newbie


Medals: 1



« Reply #8 - Posted 2013-05-06 12:29:59 »

Is that polygon based? Maybe he is generating and averaging points around his mouse, and making the poly from them....
anyway, seems good for collision detection =)
Offline Nate

JGO Kernel


Medals: 129
Projects: 3
Exp: 14 years


Esoteric Software


« Reply #9 - Posted 2013-05-06 21:37:18 »

It uses Chipmunk Pro's "autogeometry" to generate geometry from images.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (79 views)
2014-04-15 18:08:23

BurntPizza (70 views)
2014-04-15 03:46:01

UprightPath (81 views)
2014-04-14 17:39:50

UprightPath (66 views)
2014-04-14 17:35:47

Porlus (82 views)
2014-04-14 15:48:38

tom_mai78101 (106 views)
2014-04-10 04:04:31

BurntPizza (166 views)
2014-04-08 23:06:04

tom_mai78101 (262 views)
2014-04-05 13:34:39

trollwarrior1 (212 views)
2014-04-04 12:06:45

CJLetsGame (221 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!