Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (549)
Games in Android Showcase (137)
games submitted by our members
Games in WIP (594)
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  
  [RFE] - Common Math (vectors, matrices, etc) Stuff  (Read 4368 times)
0 Members and 1 Guest are viewing this topic.
Offline arielsan
« Posted 2011-04-25 14:44:59 »

Hi guys, I was wondering if all java gaming libraries could join forces and create a common Math library for vectors/matrices/transformations/etc stuff.

All implementations (phys2d, jbox2d, slick2d, libgdx, lwjgl-utils, etc) seems to be very similar and to have similar stuff. If all of them work together, we could have a common and better math library.

Vecmath seems interesting to be modified for the greater good but only jbullet is using it, also I dunno about its license.

What do you think?

Offline jezek2
« Reply #1 - Posted 2011-04-26 02:08:44 »

All implementations (phys2d, jbox2d, slick2d, libgdx, lwjgl-utils, etc) seems to be very similar and to have similar stuff. If all of them work together, we could have a common and better math library.

Vecmath seems interesting to be modified for the greater good but only jbullet is using it, also I dunno about its license.

Vecmath API (there is BSD or so licensed reimplementation btw) is closest to best candidate for two reasons: it is somewhat official (but quite weak to be honest) and technically probably the best you can achieve in Java. And we've tried, me and other devs to come with a better API.

I don't think such unification will happen as everyone has their opinions and it's easier and more coherent to port everything including vector/matrix/etc. routines in ported libraries.

However, in an unlikely event if there would be some evolved vecmath API (basically just added stuff to vecmath api and in unofficial package) and have support in other java gamedev libraries, I would most likely adapt JBullet to it.
Offline arielsan
« Reply #2 - Posted 2011-04-26 14:27:57 »

When I worked on jsnakes, I used jbullet for the physics and I remember using vecmath and it has a lot of useful methods in the API but also IMO has a lot of not related stuff in some of its classes. Btw, I found an updated copy of vecmath on github, dunno if the github project's author is related to the original code.

I am agree that the unification could never happen, but we have to try. Maybe we could start by defining only an API, not an implementation, so we could at least use the same methods: distance() or dst(), length and lengthSquared or len() and len2(), etc. Then ppl could implement them using the implementation they want (fast, ultra fast, using native code, etc).

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

JGO Ninja

Medals: 59

« Reply #3 - Posted 2011-04-26 15:24:06 »

> updated vecmath... BSD reimplementation...

take a look at openmali (

Mathias - I Know What [you] Did Last Summer!
Offline lhkbob

JGO Knight

Medals: 32

« Reply #4 - Posted 2011-04-26 15:48:07 »

The biggest thing that the vecmath libraries are missing (unless its been added recently) is that there is no support for read-only or immutable types.  It is really useful to be able to return a vector that won't change on you without needing to make a defensive copy.

Offline arielsan
« Reply #5 - Posted 2011-04-26 18:41:46 »


Same approach libgdx and slick2d uses I believe (dunno about jbox2d Vec2 or Vector2f from LWJGL-util). One thing to notice is they have a tmp() and cpy() methods to return a temporary or new vector (respectively) with the values of the current vector. Maybe that could be an addition to vecmath (or other library).

All these libraries use this approach for a performance reason by avoiding making billions of new instances and killing the GC (which sucks on the Android platform for example). I like the approach but I also like easy to use APIs.


I took a look at openmali, seems like vecmath plus a looooooooooooot of stuff (even collision stuff) (I also took a look at commons-math from apache and I have the same opinion). I believe the smaller the common math library is, greater chances of ppl using it. However, I also believe that multiple common math library modules could be made.

Offline jezek2
« Reply #6 - Posted 2011-04-26 19:21:38 »

You can see my conclusion from 2008 regarding openmali and generally about vecmath libraries in Java.

Unless you can come with something new, this was already resolved. The only thing that could be improved is to make more projects using Sun's Vecmath. However in some projects this is no issue, eg. in JMonkeyEngine you work with JME vecmath and jbullet or other physics engines are behind abstraction so the conversion is done in JME itself.
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.

GamerIDGoesHere (17 views)
2015-01-27 01:23:23

GamerIDGoesHere (18 views)
2015-01-27 01:22:15

CopyableCougar4 (23 views)
2015-01-27 00:34:41

CopyableCougar4 (15 views)
2015-01-26 04:47:56

Olo (14 views)
2015-01-25 21:26:00

Olo (16 views)
2015-01-25 18:44:22

Robo11 (30 views)
2015-01-25 06:14:26

basil_ (26 views)
2015-01-17 22:29:32

wxwsk8er (26 views)
2015-01-16 21:42:21

wxwsk8er (21 views)
2015-01-16 20:44:20
2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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 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!