Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (498)
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  
  Trials 4K [Work in progress / failed]  (Read 1248 times)
0 Members and 1 Guest are viewing this topic.
Offline tom
« Posted 2010-12-03 09:46:48 »



An attempt at creating a Trials HD clone using Jakobsen/verlet physics. It's not going terribly well. I've got it to the point where the physics feels ok. The wheel rotates, it is possible to move the rider back and forth, the wheels are connected with dampened springs etc. However I've done almost all I can think of to optimise it and I'm at the 4k limit. And it does not include any levels and the graphics is kind of ... basic.

I've got 3 months to think of something clever. Still not sure if it will be good enough to enter the competition.

Offline icza

Junior Member


Projects: 2



« Reply #1 - Posted 2010-12-03 09:55:15 »

If you're waiting for optimization tips, you should post your source code or at least parts of it, or the solutions you used. Else we can't really help.

Remove the texts, that might give you some extra hundred bytes ("BACKSPACE to continue from last checkpoint" is quite long..., FPS is not needed in "production" environment).
Offline tom
« Reply #2 - Posted 2010-12-13 21:24:55 »

I've written a 4k game before so I think I know most of tricks by know. But I've included the source if anyone want to have a go at it  Smiley

I've also made an applet you can test:
http://home.halden.net/tombr/trials4k/trials4k.html

Keys are:
left arrow - lean back
right arrow - lean forward
up arrow - accelerate
down arrow - break (kind of)
1 - restart level 1
2 - restart level 2
Backspace - continue from last checkpoint

The packed size of this is now around 3880 bytes. There are 2 dummy levels that takes around 115 bytes.



[attachment deleted by admin]

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

JGO Knight


Medals: 11
Projects: 5
Exp: 10 years


Java games rock!


« Reply #3 - Posted 2010-12-13 23:35:44 »

As a first glance at the code I would say to replace ArrayLists with Arrays. You are loosing bytes to method invocations and to auto boxing unboxing in your for loops on these lists.

I suggest replacing all your defined methods with a state machine inside your init() or run() method.
Offline DzzD
« Reply #4 - Posted 2010-12-13 23:52:56 »

very nice !

well done

about size  (I would suggest to only let the bike not the biker)

Offline icza

Junior Member


Projects: 2



« Reply #5 - Posted 2010-12-14 01:55:27 »

From a first glance:

If you want to use lists, then write ArrayList everywhere, not List, therefore your class will contain no reference to java.util.List when it is not necessary, so you get a few bytes.
Also I suggest Vector instead of ArrayList as its name is shorter and also implements the List interface...

Try moving all class variables into the run() method, local variables take much less bytes.

Also if you store the level inside your class, you also get many bytes (you can get rid of many class and method references like java.io.DataInputStream, getResourceAsStream()).

Also never catch exceptions like java.io.IOException, catch always Exception or Throwable (so you don't have to reference new classes).

These can give like 200 bytes or even more...
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 (18 views)
2014-04-15 18:08:23

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

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

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

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

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

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

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

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

CJLetsGame (187 views)
2014-04-01 02:16:10
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

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