Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  MappedObject library  (Read 8027 times)
0 Members and 1 Guest are viewing this topic.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Posted 2012-07-17 23:43:02 »

This library supports creating arrays-of-structs in Java

Main features:
  • support for MappedObject (structs) and MappedObjectArray (array-of structs)
  • optional bounds checking for MappedObjectArray
  • excellent performance (even for query methods like .sizeof(), .stride(), .elements(), etc)
  • grouped/nested structs: interleaving mapped object arrays using strides and offsets
  • verifies configurations ahead of time: exceptions, no native crashes
  • allows both JIT and AOT bytecode transformation (just add JAR to classpath)
  • no runtime reliance on bytecode transformation, allowing future Dalvik/Android support

General notice:
  • don't expect huge performance gains per se: memory access is about as fast as field access, albeit with less cache-misses
  • the biggest speedup will be caused by no longer having to copy data back and forth between instances and buffers

I might elaborate later on this subject, but for now I expect the code to speak for itself... Smiley



Example of mapped Vec3:
1  
2  
3  
4  
5  
public class Vec3 {
   public float x;
   public float y;
   public float z;
}

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
ByteBuffer bb = ...;
Vec3 mapped = new Vec3(bb);

mapped.x = 1f;
mapped.y = 0f;
mapped.z = 2f;
mapped.index(2); // slides mapped object to 3rd Vec3
mapped.x = 7f;
mapped.y = 4f;
mapped.z = 5f;

for(int i=0; i<mapped.elements(); i++) {
  mapped.index(i);
  // ...
}

1  
2  
3  
[x][y][z][x][y][z][x][y][z][x][y][z] -->
 ^        ^        ^        ^
 1f,0f,2f          7f,4f,5f

1  
mapped.stride(mapped.sizeof() + 4);

1  
2  
[x][y][z][?][x][y][z][?][x][y][z][?][x][y][z][?] -->
 ^           ^           ^           ^



Example of nested mapped object {Vec3,Vec3,Vec2}:
1  
2  
3  
4  
5  
public static class VNC {
   public Vec3 vertex;
   public Vec3 normal;
   public Vec2 texcoord;
}

1  
2  
3  
4  
5  
VNC vnc = new VNC(bb); // sets the stride of 'vertex', 'normal', 'texcoord'

vnc.normal.z = 0.13f;
vnc.index(13); // sets the index of 'vertex', 'normal', 'texcoord'
vnc.normal.z = 0.14f;



Demo code that actually works: (shipped with JAR)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import net.indiespot.mapped.MappedObject;
import net.indiespot.mapped.MappedObjectArray;
import net.indiespot.mapped.MappedObjectBuilder;
import net.indiespot.mapped.MappedObjectFactory;
import net.indiespot.mapped.MappedSet;
import net.indiespot.mapped.ann.MappedField;
import net.indiespot.mapped.impl.MappedObjectEnv;

public class MappedObjectDemo {
   static {
      MappedObjectEnv.BOUNDS_CHECKS = true;
   }
   

   public static void main(String[] args) throws Exception {
      MappedObjectBuilder.fork(MappedObjectDemo.class, args);

      demoVec3();
      demoSet();

      System.out.println("Done.");
   }

   @MappedType(stride=8)
   public static class Vec2 extends MappedObjectArray {
      public Vec2(ByteBuffer buffer) {
         super(buffer);
      }

      @MappedField(offset = 0)      public float x;
      @MappedField(offset = 4)      public float y;
   }

   public static class Vec3 extends MappedObjectArray {
      public Vec3(ByteBuffer buffer) {
         super(buffer);
      }

      @MappedField(offset = 0)      public float x;
      @MappedField(offset = 4)      public float y;
      @MappedField(offset = 8)      public float z;
   }

   public static class VNC extends MappedSet {
      public VNC(ByteBuffer buffer) {
         super(buffer);
      }

      public Vec3 vertex;
      public Vec3 normal;
      public Vec2 texcoord;
   }


   public static void demoVec3() {
      ByteBuffer bb = ByteBuffer.allocateDirect(64 * 1024);
      bb.order(ByteOrder.nativeOrder());

      Vec3 v3 = MappedObjectFactory.map(Vec3.class, bb);

      // test 1
     v3.x = 13.14f;
      v3.y = 14.15f;
      v3.z = 15.16f;
      if (v3.x != 13.14f || bb.getFloat(0) != 13.14f)         throw new IllegalStateException();
      if (v3.y != 14.15f || bb.getFloat(4) != 14.15f)         throw new IllegalStateException();
      if (v3.z != 15.16f || bb.getFloat(8) != 15.16f)         throw new IllegalStateException();

      // move over data using a sliding window
     v3.index(1337);

      // test 2
     v3.x = -13.14f;
      v3.y = -14.15f;
      v3.z = -15.16f;
      if (v3.x != -13.14f || bb.getFloat(v3.stride() * 1337 + 0) != -13.14f)         throw new IllegalStateException();
      if (v3.y != -14.15f || bb.getFloat(v3.stride() * 1337 + 4) != -14.15f)         throw new IllegalStateException();
      if (v3.z != -15.16f || bb.getFloat(v3.stride() * 1337 + 8) != -15.16f)         throw new IllegalStateException();
   }
   
   public static void demoSet(){
      ByteBuffer bb = ByteBuffer.allocateDirect(64 * 1024);
      bb.order(ByteOrder.nativeOrder());

      VNC vnc = new VNC(bb);

      vnc.index(1337);

      if (vnc.vertex.index() != 1337)         throw new IllegalStateException();
      if (vnc.normal.index() != 1337)         throw new IllegalStateException();
      if (vnc.texcoord.index() != 1337)       throw new IllegalStateException();

      if(vnc.vertex.stride() != vnc.normal.stride())   throw new IllegalStateException();
      if(vnc.vertex.stride() != vnc.texcoord.stride()) throw new IllegalStateException();
   }
}





Javadoc:



Classpath:



Main Class:
  • net.indiespot.mapped.demo.MappedObjectDemo


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

« In padded room »



TUER


« Reply #1 - Posted 2012-07-17 23:57:31 »

What is the difference between isAligned and isPageAligned?

Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2012-07-18 00:00:58 »

What is the difference between isAligned and isPageAligned?

You can align a ByteBuffer to any number of bytes, so the 'page' version is simply a utility method:
1  
2  
3  
4  
5  
6  
7  
public static boolean isPageAligned(ByteBuffer bb) {
  return isAligned(bb, pageSize());
}

public static ByteBuffer allocatePageAligned(int bytes) {
   return allocateAligned(bytes, pageSize());
}


For those wondering why we need the functionality to allocate page aligned ByteBuffers: ever since Java 1.4 every ByteBuffer you allocated was page-aligned (typically 4K). Since Java7 this is no longer the case, and there doesn't seem to be any functionality in the Java API to allocate them the old way, except for a commandline parameter, which sets a global flag.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2012-07-18 00:28:05 »

Version 0.8.3:
  • Added: mappedObject.hasRemaining()

Release:

Code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
// old
for(int i=0; i<vec3.elements(); i++){
   vec3.index(i);
   // do stuff
}

// new
for(vec3.reset(); vec3.hasRemaining(); vec3.next()){
   // do stuff
}

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

JGO Kernel


Medals: 322
Projects: 2
Exp: 4 years


I'm the King!


« Reply #4 - Posted 2012-07-18 06:07:02 »

This is beyond amazing. Riven, you're god.

Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #5 - Posted 2012-07-21 00:26:55 »

Version 0.8.4:
  • Renamed: MappedObject to MappedObjectArray
  • Added: MappedObject class (not positionable, just mapping fields to region in memory)

Release:
Reason:
  • Opportunity for encapsulation (OOP)
  • Create a lightweight API to get familiar with the concept of mapping fields
  • Closer to the concept of structs (as opposed to struct-pointers)

Most games using this library will use mapped objects as a way to prevent data-copies of VBO data. Game entities by nature are heavily object oriented and therefore are designed to be convenient in use, not necessarily reduced memory footprint. Having 1 game entity holding (mapped) data pointing to 1 area of memory is a likely occurence. The (previous) MappedObject class was way too heavy-weight for this usage, so has been renamed and built on a simplified MappedObject class, that always points to 1 region of memory.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public class Vec3 extends MappedObject
{
   public Vec3(ByteBuffer buffer) {
      super(buffer);
   }

   @MappedField(offset = 0)      public float x;
   @MappedField(offset = 4)      public float y;
   @MappedField(offset = 8)      public float z;
}


At runtime, the entire class would look like:
1  
2  
3  
4  
5  
6  
7  
8  
public class Vec3 extends MappedObject
{
   public LightVec3(ByteBuffer buffer) {
      super(buffer);
   }

   public long address; // inherited from super-class
}
No positioning, no bounds-checks.

1  
2  
3  
4  
5  
6  
7  
// Usage 1:
Vec3 vec3 = new Vec3(buffer);

// Usage 2:
int stride = 12;
int elements = 33;
List<Vec3> instances = MappedObjectFactory.mapInstances(buffer, stride, Vec3.class, elements);
All elements of List<Vec3> are individual Vec3 instances that will point to their own chunk of memory.



Usage in a game entity class:
1  
2  
3  
4  
5  
6  
public class GameEntity
{
   // ...
  public Vec3 position;
   // ...
}

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

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #6 - Posted 2012-07-21 00:44:13 »

That sounds like a nifty tweak.

Cas Smiley

Offline theagentd
« Reply #7 - Posted 2012-07-21 02:02:19 »

This is a lot more convenient! Questions:

1. Why is the class named Vec3 but the constructor LightVec3? >_>
2. Shouldn't the stride variable be contained in Vec3, or is it there to allow you to store multiple interleaved structs in the array (I completely approve of the idea). In that case you also need an offset variable to allow positioning of the second MappedObject into the buffer. Whichever the case is, the byte size should still be retrievable from the Vec3 class and a mapInstances() function without stride should be added.
3. What's the performance compared to the old MappedObject implementation?
4. Is it possible to have a struct inside a struct like this?
1  
2  
3  
4  
5  
6  
public class Particle extends MappedObject{
    @MappedField(offset = 0)    private Vec3 position;
    @MappedField(offset = 12)    private Color color; //4 byte RGBA color
   @MappedField(offset = 16)    private short life;
    ...
}


5. This one is a bit unrelated, but I was wondering if you have any suggestions regarding this problem: In my CPU particle engine I had particles which contained both a bunch of data. Some of it was needed for rendering and belonged in a MappedObject (position, color) and some of it did not (velocity, life). I had 12 bytes of needed data and 12 bytes of data that wasn't needed on the GPU. All in all I had to create both a Particle class and a MappedParticle class to split up the data, but everything got a lot more complicated, and it kind of seemed like it defeated the purpose of MappedObjects. This update would simplify a it a bit since I can just pass in an instance from the List gotten by mapInstances() to my (unmapped) Particle class.

I'd love to test it out but I have a slight problem...
Quote
Pinging google.se [173.194.35.152] with 32 bytes of data:
Reply from 173.194.35.184: bytes=32 time=1663ms TTL=53
Reply from 173.194.35.184: bytes=32 time=1268ms TTL=53
Reply from 173.194.35.184: bytes=32 time=409ms TTL=53
Reply from 173.194.35.184: bytes=32 time=3162ms TTL=53
Reply from 173.194.35.184: bytes=32 time=503ms TTL=53
Reply from 173.194.35.184: bytes=32 time=138ms TTL=53
Reply from 173.194.35.184: bytes=32 time=2548ms TTL=53
Reply from 173.194.35.184: bytes=32 time=759ms TTL=53
Reply from 173.194.35.184: bytes=32 time=1302ms TTL=53
Reply from 173.194.35.184: bytes=32 time=3800ms TTL=53
Reply from 173.194.35.184: bytes=32 time=5343ms TTL=53
Reply from 173.194.35.184: bytes=32 time=1000ms TTL=53
Reply from 173.194.35.184: bytes=32 time=1874ms TTL=53
Reply from 173.194.35.184: bytes=32 time=1803ms TTL=53

No way is it going to stay stable for a MEGABYTE download! I assume it isn't even ready yet in any LWJGL release?

Myomyomyo.
Offline tberthel
« Reply #8 - Posted 2012-07-21 02:03:40 »

For years people told me it could not be done, and now you have created the proof that supports my argument.

Good Job.

Offline Sickan

Senior Member


Medals: 8



« Reply #9 - Posted 2012-07-21 02:06:23 »

That is nice, I will have to check it out later though. Damn time zone!

I'm just here to learn.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #10 - Posted 2012-07-21 02:25:44 »

1. Why is the class named Vec3 but the constructor LightVec3? >_>
My refactoring support of forum-post is kinda flaky Roll Eyes

2. Shouldn't the stride variable be contained in Vec3, or is it there to allow you to store multiple interleaved structs in the array (I completely approve of the idea). In that case you also need an offset variable to allow positioning of the second MappedObject into the buffer. Whichever the case is, the byte size should still be retrievable from the Vec3 class and a mapInstances() function without stride should be added.
Only .sizeof() is tied to a type. The .stride() is tied to an instance and can be altered at runtime. With the new MappedObject (not the MappedObjectArray) it makes no sense to add a stride, as it won't slide over memory. I could move .sizeof() from MappedObjectArray to MappedObject, and set the stride to sizeof, if the specified stride is zero.

There is no need to provide an offset parameter: the constructor respects the buffer.position(). Even if it wouldn't you could .buffer.slice() it before passing it in the constructor, but I hope support for buffer.position() is enough. (feedback?)


3. What's the performance compared to the old MappedObject implementation?
The bytecode it generates is (supposed to be) a lot friendlier to HotSpot. But really, please enlighten me with some real world particle engine benchmarks. My synthetic benchmarks show it's just as fast in small methods, and 'a bunch' faster in bulky methods, for varying levels of 'a bunch'.

4. Is it possible to have a struct inside a struct like this?
1  
2  
3  
4  
5  
6  
public class Particle extends MappedObject{
    @MappedField(offset = 0)    private Vec3 position;
    @MappedField(offset = 12)    private Color color; //4 byte RGBA color
   @MappedField(offset = 16)    private short life;
    ...
}
Not yet, but that was because that would mean all kind of wizardry for MappedObject, as it would have to re-calculate the offsets of all (nested) children, every time the position was changed... I can't do it like C/C++ where the nested structs are simply 'burnt in'.

You can see how I solved it in MappedSet: simply generating an set.index(i) method that calls child[n].index(i). You can see the limitations of this approach.


5. This one is a bit unrelated, but I was wondering if you have any suggestions regarding this problem: In my CPU particle engine I had particles which contained both a bunch of data. Some of it was needed for rendering and belonged in a MappedObject (position, color) and some of it did not (velocity, life). I had 12 bytes of needed data and 12 bytes of data that wasn't needed on the GPU. All in all I had to create both a Particle class and a MappedParticle class to split up the data, but everything got a lot more complicated, and it kind of seemed like it defeated the purpose of MappedObjects. This update would simplify a it a bit since I can just pass in an instance from the List gotten by mapInstances() to my (unmapped) Particle class.
Even better: this implementation supports mapped and unmapped fields in the same type.

1  
2  
3  
4  
5  
6  
7  
8  
public class Particle
{
   @MappedField(offset=0) public Vec3 position;
   @MappedField(offset=12) public Vec3 color;

   public Vec3 velocity;
   public float life;
}



I'd love to test it out but I have a slight problem...
Quote
Pinging google.se [173.194.35.152] with 32 bytes of data:
Reply from 173.194.35.184: bytes=32 time=1663ms TTL=53
Reply from 173.194.35.184: bytes=32 time=1268ms TTL=53
Reply from 173.194.35.184: bytes=32 time=409ms TTL=53
Reply from 173.194.35.184: bytes=32 time=3162ms TTL=53
Reply from 173.194.35.184: bytes=32 time=503ms TTL=53
Reply from 173.194.35.184: bytes=32 time=138ms TTL=53
Reply from 173.194.35.184: bytes=32 time=2548ms TTL=53
Reply from 173.194.35.184: bytes=32 time=759ms TTL=53
Reply from 173.194.35.184: bytes=32 time=1302ms TTL=53
Reply from 173.194.35.184: bytes=32 time=3800ms TTL=53
Reply from 173.194.35.184: bytes=32 time=5343ms TTL=53
Reply from 173.194.35.184: bytes=32 time=1000ms TTL=53
Reply from 173.194.35.184: bytes=32 time=1874ms TTL=53
Reply from 173.194.35.184: bytes=32 time=1803ms TTL=53
Have you tried turning it off and on again?

No way is it going to stay stable for a MEGABYTE download!
200KB, you silly! (of which 100KB can be discarded)

I assume it isn't even ready yet in any LWJGL release?
This new impl. will not be in the LWJGL repository for historical reasons. Smiley

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #11 - Posted 2012-07-21 02:46:57 »

Version 0.8.5:
  • Moved: MappedObjectArray.sizeof() to MappedObject.sizeof()
  • Modified: MappedObjectMemory.sizeof(Class<MappedObjectArray> --> Class<MappedObject>)
  • Modified: MappedObjectFactory.mapInstances(buffer, stride = 0, type, elements) => stride=sizeof(type)

Release:



1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
public class Particle
{
   @MappedField(offset=0) public Vec3 position;
   @MappedField(offset=12) public Vec3 color;

   public Vec3 velocity;
   public float life;
}

int elements = 33;
int sizeof = MappedObjectMemory.sizeof(Vec3.class);
int stride = sizeof + sizeof;
ByteBuffer bb = ByteBuffer.allocateDirect(elements * stride);

bb.position(0);
List<Vec3> positions = MappedObjectFactory.mapInstances(bb, stride, Vec3.class, elements);

bb.position(sizeof);
List<Vec3> colors = MappedObjectFactory.mapInstances(bb, stride, Vec3.class, elements);

//MappedObjectFactory.mapInstances((ByteBuffer)bb.position(0 * sizeof), stride, Vec3.class, elements);
//MappedObjectFactory.mapInstances((ByteBuffer)bb.position(1 * sizeof), stride, Vec3.class, elements);



Particle[] particles = new Particle[elements];
for(int i=0; i<elements; i++) {
   particles[i] = new Particle();
   particles[i].position = positions.get(i);
   particles[i].color = colors.get(i);
}

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Online Danny02
« Reply #12 - Posted 2012-07-21 12:52:32 »

I don't know if you already have, but could you deploy it to maven central?

Also a little followup question, I tried your lib once, just to check it out and my question is, if because of the needed application "restart" this lib works only on the desktop? Or can it be used as an applet without natives or other security restrictions. What is about android?
Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #13 - Posted 2012-07-21 23:04:14 »

Also a little followup question, I tried your lib once, just to check it out and my question is, if because of the needed application "restart" this lib works only on the desktop? Or can it be used as an applet
As specified in the opening post: allows both JIT and AOT bytecode transformation (just add JAR to classpath) Pointing


without natives
no natives involved


other security restrictions
I need runtime access to sun.misc.Unsafe, which means I need a reflection permission.


What is about android?
Android does have Unsafe, but doesn't have Unsafe.getFloat(addr) and Unsafe.putFloat(addr, value). Further, FloatBuffer.get(index) and FloatBuffer.put(index, value) are about 50 times (!!) slower than access to a float[]. For Android we probably need an implementation that is backed by a specific primitive array per type, which means 1 type can only have float fields, or only int fields, etc etc.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #14 - Posted 2012-07-22 00:10:59 »

could you deploy it to maven central?
Just having installed Maven...  persecutioncomplex I'm now able to compile it, package it with dependencies, make it spit out a JAR and even deploy it locally. Now what's next?


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

JGO Ninja


Medals: 24
Projects: 3


One for all!


« Reply #15 - Posted 2012-07-22 00:28:57 »

Judging from the comments, this is really nice. I'd enjoy to hop in on the cake, but I don't know how, where or when.
I can reason that values in structs can now be stored in a single array, with the fields on indexes instead of the objects themselves. Is that accurate? I can't imagine a scenario where this is useful. Sad

How is this better than me, hacking up an array of Object children, and defining the protocol for whatever I need the structs to contain?

Sorry for being ignorant. I'd really like to get more enlightened on this. Smiley


Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #16 - Posted 2012-07-22 00:31:49 »

  • the biggest speedup will be caused by no longer having to copy data back and forth between instances and buffers Pointing

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Online Danny02
« Reply #17 - Posted 2012-07-22 00:37:00 »

Now what's next?

Just follow this official guide https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide


How is this better than me, hacking up an array of Object children, and defining the protocol for whatever I need the structs to contain?

Sorry for being ignorant. I'd really like to get more enlightened on this. Smiley
it is especially usefull when communicating with OpenGL. When you need to send to OpenGL vertex data it exspects a Bytebuffer, so without this lib you would have to copy all the data you have from your objects to such a buffer. Espsecial usefull if you not only want to push the data once, like for 3d models, but want to operate on it often, like for a particle engine.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #18 - Posted 2012-07-22 01:18:51 »


Thanks, but I'm not going to jump through all the hoops, let alone creating some account on some website I never heard of on which my library will be dependent. Well, maybe later.

It's simply not worth the effort: just add 3 JARs to your classpath and be done with it, mkay? Smiley

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Online Danny02
« Reply #19 - Posted 2012-07-22 01:34:36 »

sonatype is the company who runs maven central btw
Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #20 - Posted 2012-07-22 02:01:23 »

Knock yourselves out guys! Smiley

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
<project ...>

   <repositories>

      <repository>
         <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
         </releases>
         <id>net.indiespot</id>
         <name>MappedObjectLib</name>
         <url>http://indiespot.net/files/mappedobjectlib/maven2/</url>
        <layout>default</layout>
      </repository>

   </repositories>


   <dependencies>

      <dependency>
         <groupId>net.indiespot</groupId>
         <artifactId>MappedObjectLib</artifactId>
         <version>0.8.5</version>
      </dependency>

   </dependencies>

</project>

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

JGO Knight


Medals: 32



« Reply #21 - Posted 2012-07-22 02:03:44 »

It's not too bad, I've drunk the Maven cool-aid and although it infects everything you do, I don't find I'm bothered by it.

Offline Gudradain
« Reply #22 - Posted 2012-07-22 02:11:43 »

Just having installed Maven...  persecutioncomplex I'm now able to compile it, package it with dependencies, make it spit out a JAR and even deploy it locally. Now what's next?



Oh no, you start to used maven too  Shocked
Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #23 - Posted 2012-07-22 02:58:29 »

My public repository is basically a massive hack: generating a dummy JAR from dummy sourcecode, then replacing the JAR Eclipse generated and I obfuscated, then injecting the required Maven META-INF entries into the JAR, rehashing the *.jar.md5 and *.jar.sha1, then uploading the entire repo to a dir on my webserver.

All that, in a nifty .bat .sh file Lips Sealed

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Roquen
« Reply #24 - Posted 2012-07-22 12:57:59 »

Legal note: If the codebase is GPLed, the you should explicitly state what the license is for any AOT output...assuming that the AOT can run without the library.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #25 - Posted 2012-07-22 13:02:34 »

Legal note: If the codebase is GPLed, the you should explicitly state what the license is for any AOT output...assuming that the AOT can run without the library.
I'll have to rethink the licenses for a bit (don't hold your breath)


BTW:
JIT & AOT cannot run without the library, as mapped types extend types from within the library.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Roquen
« Reply #26 - Posted 2012-07-22 21:59:44 »

As the author you just need to state what the license rules are..but you should explicitly state them.  So you'd need to state that class files and generated code is BSD or whatever.  This opens up a can of worms however.  Consider that using a reverse engineering tools of BSD licensed .class files is a "derived works" of the .class files and so logically BSD licensed, so defeating you're purpose.  You could add an exception clause, but I'd guess that would be deemed to be unenforceable.  I'd suggest that you GPL everything and get the GPL taint and state that other licensing options are available from the original author...if you're willing to deal with the generated emails.  You could always drop to a less restrictive license in the future if that becomes too much of a PITA.

NOTE: I'm not a lawyer so take this for what it's worth...which isn't much.
Offline Nate

JGO Kernel


Medals: 129
Projects: 3
Exp: 14 years


Esoteric Software


« Reply #27 - Posted 2012-07-23 13:33:30 »


Thanks, but I'm not going to jump through all the hoops, let alone creating some account on some website I never heard of on which my library will be dependent. Well, maybe later.

It's simply not worth the effort: just add 3 JARs to your classpath and be done with it, mkay? Smiley
Haha! Amen brother!

Online Riven
« League of Dukes »

JGO Overlord


Medals: 606
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #28 - Posted 2012-07-23 14:10:13 »


I reworked it to this simple procedure:
  • take your mylib-{version}.jar
  • inject some META-INF entire in your JAR (take previous entries and replace the version string in those)
  • generate a mylib-{version}.pom (take previous POM and replace version string)
  • md5sum mylib-{version}.jar
  • sha1sum mylib-{version}.jar
  • md5sum mylib-{version}.pom
  • sha1sum mylib-{version}.pom
  • dump in some online folder that you defined in your dependencies

(yes, this really is the simplified method, and i'm now investigating maven install-file for funzies)

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

JGO Kernel


Medals: 284
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #29 - Posted 2012-07-23 16:01:59 »

My attempt at thread derailment: Maven is a symptom of everything wrong with software development in the modern age Smiley And as an aside: Project Jigsaw - solving a problem nobody has any more, in the most complicated way possible, so that they have failed to deliver what nearly everyone asked for 10 years ago that only took a couple of hours for an amateur to implement. Way to go, software engineers. The same guys probably invented Maven.

Cas Smiley

Pages: [1] 2
  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 (64 views)
2014-04-15 18:08:23

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

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

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

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

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

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

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

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

CJLetsGame (216 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!