Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (488)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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  
  4x4k  (Read 5590 times)
0 Members and 1 Guest are viewing this topic.
Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Posted 2008-12-23 00:00:06 »

4x4K

Drive your truck across the 3 environments in the fastest time possible.


Controls:

Up/Down - Accelerate/Reverse
Left/Right - Tilt the truck back and forth (just makes the back/front a bit heavier)
R - Restart Level
Space - Jump (only available every five seconds, indicated in the top right hand corner)
1/2/3 - Start Track 1,2 or 3

Tips:

Tilting is important to climb steep slopes. Jump can be used to get awesome times if you get it right. It can also be used to get you off your back used in conjunction with the tilt controls. Thats only really useful if you're quite a long way through the track and don't want to just restart.

Stuff:


I thought doing some physics in 4K would be interesting. This is a light weight verlet implementation. The truck thing was just going to be a test case for the tiny engine before writing something else but it seemed to turn out ok. Now I just need another idea for a physics game.

It's barely under 4k at the moment. Java performed surprisingly well even when I had the option to turn on antialiasing (taken out due to space restrictions).

Comments and bug reports welcomed!

Kev

Offline irreversible_kev

Junior Member





« Reply #1 - Posted 2008-12-23 00:06:34 »

woot lol first 2 seconds experience...
Click to Play



I will now play it and edit to give comments  Grin

EDIT:
Track 1: 35seconds
Track 2: 42seconds Sad

It's great Cheesy
I like how the tilting brings an extra skill element to it. Also, you can use the jump to get awesome air and jump over some rocks.
Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #2 - Posted 2008-12-23 00:11:00 »

Yeah, thats a special feature Wink

Nice one!

Kev

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Markus_Persson

JGO Wizard


Medals: 14
Projects: 19


Mojang Specifications


« Reply #3 - Posted 2008-12-23 08:20:14 »

Neatobuckets!! =D

Really nice graphics and solid physics (except for the inverted truck thing. Wink)
My only complaints are that it feels like it either is too fast in general, or perhaps too "jerky" in the acceleration, and that getting stuck on your roof after having used the jump recently means you have to wait five seconds.

Play Minecraft!
Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #4 - Posted 2008-12-23 09:12:08 »

I'll rethink the jump thing, acceleration I'll try reducing it a bit and apply on a curve.

Anyone know how you get the inverted truck thing, I can't get it here Sad

Kev

Offline irreversible_kev

Junior Member





« Reply #5 - Posted 2008-12-23 11:10:46 »

I'll rethink the jump thing, acceleration I'll try reducing it a bit and apply on a curve.

Anyone know how you get the inverted truck thing, I can't get it here Sad

Kev

It happened only that once!

EDIT:

Level 1:
Hold down LEFT+DOWN.
Press R whilst keeping LEFT+DOWN down.

EDIT2:

I thought I would add that I have experienced this exception three times

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
java.lang.IllegalStateException: Buffers have not been created
   at sun.awt.windows.WComponentPeer.getBackBuffer(Unknown Source)
   at java.awt.Component$FlipBufferStrategy.getBackBuffer(Unknown Source)
   at java.awt.Component$FlipBufferStrategy.updateInternalBuffers(Unknown Source)
   at java.awt.Component$FlipBufferStrategy.createBuffers(Unknown Source)
   at java.awt.Component$FlipBufferStrategy.<init>(Unknown Source)
   at java.awt.Component$FlipSubRegionBufferStrategy.<init>(Unknown Source)
   at java.awt.Component.createBufferStrategy(Unknown Source)
   at java.awt.Window.createBufferStrategy(Unknown Source)
   at java.awt.Component.createBufferStrategy(Unknown Source)
   at java.awt.Window.createBufferStrategy(Unknown Source)
   at E.<init>(Unknown Source)
   at E.main(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.sun.javaws.Launcher.executeApplication(Unknown Source)
   at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
   at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
   at com.sun.javaws.Launcher.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Offline EnderGT

Junior Member





« Reply #6 - Posted 2008-12-23 14:19:31 »

Happens all the time to me... wanna have some fun? hold down for a few sec, then jump. For me, at least, I hit the ground and go flying, about half the time the truck does that inverted trick.
Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Reply #7 - Posted 2008-12-23 21:20:44 »


EDIT2:

I thought I would add that I have experienced this exception three times

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
java.lang.IllegalStateException: Buffers have not been created
   at sun.awt.windows.WComponentPeer.getBackBuffer(Unknown Source)
   at java.awt.Component$FlipBufferStrategy.getBackBuffer(Unknown Source)
   at java.awt.Component$FlipBufferStrategy.updateInternalBuffers(Unknown Source)
   at java.awt.Component$FlipBufferStrategy.createBuffers(Unknown Source)
   at java.awt.Component$FlipBufferStrategy.<init>(Unknown Source)
   at java.awt.Component$FlipSubRegionBufferStrategy.<init>(Unknown Source)
   at java.awt.Component.createBufferStrategy(Unknown Source)
   at java.awt.Window.createBufferStrategy(Unknown Source)
   at java.awt.Component.createBufferStrategy(Unknown Source)
   at java.awt.Window.createBufferStrategy(Unknown Source)
   at E.<init>(Unknown Source)
   at E.main(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.sun.javaws.Launcher.executeApplication(Unknown Source)
   at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
   at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
   at com.sun.javaws.Launcher.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)


A race condition between creating the buffer strategy on the main thread and the size of the window being changed on the EDT.. Creating the BS on the EDT will help.

Also, looks like the the slpash screen image is missing:
1  
2  
3  
Caused by: java.io.FileNotFoundException: http://www.cokeandcode.com/fourkay/truck/icon.gif
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
   at java.net.HttpURLConnection.getResponseCode(Unknown Source)


Not that we'd have lots of time to enjoy it with a 4k jar file =)

Dmitri
Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #8 - Posted 2008-12-24 11:11:08 »

New version up:

* Physics instability should be fixed
* Jump can now be used any time
* Minor graphical fixes

4096 bytes.

Kev

Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #9 - Posted 2008-12-24 13:51:26 »

Added an applet version - saved some space doing it, interesting Smiley

http://www.cokeandcode.com/fourkay/truck/

Kev

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Renoria

Junior Member




...


« Reply #10 - Posted 2008-12-24 15:40:03 »

Good physics, apart from the inverted truck and jumping when your'e not the right way up.

Good game.
Offline CommanderKeith
« Reply #11 - Posted 2008-12-30 18:27:10 »

Really great physics.

One thing that seemed weird was the way you slow down so much when flying through the air?

By the way, no truck inversion here despite my best efforts Smiley

It's quite impressive the way you have mastered different physics systems one by one.  What are your thoughts about verlet vs the system used in Phys2D/box2d?

Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #12 - Posted 2008-12-30 19:46:46 »

Not sure why you're seeing slow down in the air, there's no damping at all so there shouldn't be any force against the particles.

Verlet seems great for things that likely to be quite bouncy, implementing it was pretty simple following that paper. However, I did try box/box interaction originally and couldn't get that stable.

Box2D would still be my choice for real stuff, but then I might have a non-4k play with verlet later also just to see if it's really that hard or whether it was 4k making it a little hard to think about Smiley

Thanks for playing all! Smiley

Kev

PS. Incidentally, no one should be getting inverted trucks anymore. I was quite surprised to see Renoria reporting them still happening.

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #13 - Posted 2008-12-30 21:02:39 »

Quote
Verlet seems great for things that likely to be quite bouncy, implementing it was pretty simple following that paper. However, I did try box/box interaction originally and couldn't get that stable.

The only way to get boxes/cubes realistic in Verlet (not bouncy) is to have a 2d or 3d grid of spheres, and LOTS of springs to bind them all together. It drains performance, but it works!
4x4x4 cubes = 2*2*26 + 6*4*17 + 2*8*11 + 8*7  = 744 springs (I might have missed a few)
The spheres must be overlapping a fair bit to get the shape solid, so don't do sphere<->sphere collision.

Bounces around like a rock, or like jelly, depending on spring stiffness.


Quote
PS. Incidentally, no one should be getting inverted trucks anymore. I was quite surprised to see Renoria reporting them still happening.

I think he was just repeating what was already posted, for the sake of it.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #14 - Posted 2008-12-30 21:50:52 »

Quote
The only way to get boxes/cubes realistic in Verlet (not bouncy) is to have a 2d or 3d grid of spheres

That advanced character physics paper seems to imply you can use SAT type collision with just four particles, one for each corner with 6 constraints per box. Didn't want to work for me at least.

Kev

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #15 - Posted 2008-12-30 22:05:37 »

The problem is momentum and angular rotation.

That's all a 'side effect' of Verlet integration, but the downside is that you need lots of particles.

4 (2x2 grid) spheres for a 2d box is certainly not enough, because it will deform too much, resulting in bouncy behaviour.

If you keep adding particles spheres to the grid (4x4 and up), the result gets better and better, as each sphere has it's own momentum, and thus 'correcting' the abruptly moving spheres (those that are colliding).

If you have enough spheres, you can simulate everything any other physics engine can do, as the world around us is basically Verlet, until you get to the mulecule level and other forces that to take over. We just don't have the processing power to simulate it, but it will certainly get very realistic if you add enough spheres and springs to your box.


N.B. The reason I'm using spheres instead of particles is that a particle-based box is basically hollow, while a sphere based box is solid, which is important for box<->box collision.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline zeroone
« Reply #16 - Posted 2009-03-01 18:18:46 »

I like the vector-based graphics.  Nice color scheme.  The physics engine is amazing.  You’ll have to teach us all about verlet physics one day.  The truck is very difficult to control.  I can’t make it through the first level unfortunately.
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.

TehJavaDev (17 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (69 views)
2014-08-11 02:49:23

BurntPizza (46 views)
2014-08-09 21:09:32

BurntPizza (37 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!