Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (808)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
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 3729 times)
0 Members and 1 Guest are viewing this topic.
Offline tom
« Posted 2010-12-03 08: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 Devvie

Projects: 2

« Reply #1 - Posted 2010-12-03 08: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 20: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:

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 Ninja

Medals: 16
Projects: 6
Exp: 10 years

Java games rock!

« Reply #3 - Posted 2010-12-13 22: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.

Java4k RIP 2014
Offline DzzD
« Reply #4 - Posted 2010-12-13 22:52:56 »

very nice !

well done

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

Offline icza

Junior Devvie

Projects: 2

« Reply #5 - Posted 2010-12-14 00: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, getResourceAsStream()).

Also never catch exceptions like, 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  

mercenarius (4 views)
2020-06-04 19:26:01

mercenarius (2 views)
2020-06-04 19:13:43

Riven (850 views)
2019-09-04 15:33:17

hadezbladez (5834 views)
2018-11-16 13:46:03

hadezbladez (2635 views)
2018-11-16 13:41:33

hadezbladez (6251 views)
2018-11-16 13:35:35

hadezbladez (1504 views)
2018-11-16 13:32:03

EgonOlsen (4739 views)
2018-06-10 19:43:48

EgonOlsen (5797 views)
2018-06-10 19:43:44

EgonOlsen (3282 views)
2018-06-10 19:43:20
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08 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‑
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!