Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (606)
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 3 [4] 5 6 ... 10
 31 
 on: 2014-12-29 11:11:46 
Started by Dreamtime - Last post by Stranger
Hahahaha what?
Forget it... Smiley

I am looking at packr now. No clue what's going on with jwrapper.

Hopefully I can get past my own incompetence with packr.
Good to know.

Tell me, you specified 32 bit jre for both win tags?

 32 
 on: 2014-12-29 10:59:53 
Started by Dreamtime - Last post by Dreamtime
Hahahaha what?

I am looking at packr now. No clue what's going on with jwrapper.

Hopefully I can get past my own incompetence with packr.

 33 
 on: 2014-12-29 10:59:27 
Started by Elsealabs - Last post by Riven
I can't take it anymore Pointing

Rot2D.java
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  
public class Rot2D {
   public static Rot2D fromDegrees(double angle) {
      return fromRadians(Math.toRadians(angle));
   }

   public static Rot2D fromRadians(double angle) {
      return new Rot2D(Math.cos(angle), Math.sin(angle));
   }

   public static Rot2D fromVector(double dx, double dy) {
      float length = (float) Math.sqrt(dx * dx + dy * dy);
      return new Rot2D(dx / length, dy / length);
   }



   public double cos, sin;

   private Rot2D(double cos, double sin) {
      this.cos = cos;
      this.sin = sin;
   }

   public Rot2D load(Rot2D that) {
      this.cos = that.cos;
      this.sin = that.sin;

      return this;
   }

   public Rot2D copy() {
      return new Rot2D(cos, sin);
   }

   public Rot2D rotate(Rot2D that) {
      double cos = (this.cos * that.cos) - (this.sin * that.sin);
      double sin = (this.cos * that.sin) + (this.sin * that.cos);

      this.cos = cos;
      this.sin = sin;

      return this;
   }

   public static double cross(Rot2D a, Rot2D b) {
      return (a.cos * b.sin) - (a.sin * b.cos);
   }
}


TurnUI.java
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  
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class TurnUI {
   public static void main(String[] args) {

      final Point item = new Point(400, 300);
      final Point target = new Point(350, 400);
      final Rot2D currAngle = Rot2D.fromVector(target.x - item.x, target.y - item.y);
      final Rot2D turnSpeedCW = Rot2D.fromDegrees(1.0);
      final Rot2D turnSpeedCCW = Rot2D.fromDegrees(-1.0);

      JPanel panel = new JPanel() {

         @Override
         protected void paintComponent(final Graphics g) {
            super.paintComponent(g);

            final Rot2D wantedAngle = Rot2D.fromVector(target.x - item.x, target.y - item.y);

            double cross1 = Rot2D.cross(currAngle, wantedAngle);
            if (cross1 > 0.0)
               currAngle.rotate(turnSpeedCW);
            else
               currAngle.rotate(turnSpeedCCW);
            double cross2 = Rot2D.cross(currAngle, wantedAngle);

            if (Math.signum(cross1) != Math.signum(cross2))
               currAngle.load(wantedAngle); // overshot!
           
           

            g.setColor(Color.BLACK);
            g.fillRect(item.x - 3, item.y - 3, 6, 6);
            g.drawLine(item.x, item.y, //
                  (int) (item.x + currAngle.cos * 64), //
                  (int) (item.y + currAngle.sin * 64));

            g.setColor(Color.RED);
            g.fillRect(target.x - 1, target.y - 1, 2, 2);



            // lousy game-loop:
            try {
               Thread.sleep(1000 / 50); // ~20fps
            } catch (InterruptedException exc) {
               // ok
            }
            this.repaint();
         }
      };

      panel.addMouseListener(new MouseAdapter() {
         @Override
         public void mousePressed(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1) {
               target.x = e.getX();
               target.y = e.getY();
            }
         }
      });

      panel.setPreferredSize(new Dimension(800, 600));

      JFrame frame = new JFrame("Rot2D");
      frame.getContentPane().setLayout(new BorderLayout());
      frame.getContentPane().add(panel);
      frame.setResizable(true);
      frame.pack();
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }
}


Click to Play

 34 
 on: 2014-12-29 10:56:10 
Started by Spasi - Last post by kappa
Ruben01 just confirmed that LWJGL 2.9.2 is now also available on Maven Central. Normal instructions apply as set out here (just replace the 2.8.0 parts with 2.9.2).

 35 
 on: 2014-12-29 10:51:36 
Started by Dreamtime - Last post by Stranger
should i really download linux jre mandatorily?

 36 
 on: 2014-12-29 10:36:49 
Started by KudoDEV - Last post by JJengineering
Thank you, couldn't quite read it out of the thread Tongue
May have missed it, but then, multiple times  Lips Sealed

Greetings and all the best, JJ

 37 
 on: 2014-12-29 10:35:35 
Started by Olo - Last post by Mike
One reason to split up the zones into different processes (if the zones are big enough) is scalability once you get a lot of users. They can then only interact with players within their own zone and you could theoretically spread the zones over several servers.

Seeing as you removed one m from mmorpg that number of players might not apply though in which case I'd go with using a single process for it and implement a chunk system so only the required chunk(s) are sent to the players Smiley

Mike

 38 
 on: 2014-12-29 10:25:41 
Started by DazKins - Last post by DazKins
Quote
Is it a problem with one channel being not represented even slightly so it doesn't get shown? Instead of straight blue do something like vec3(0.02, 0.02, 1.0) and see what you get.

It seems that the closer the other channels get to 0, the less visible the lighting effect is on non-grey textures. I found when making light colour: (0.3f, 0.3f, 1.0f) in RGB, the light showed up somewhat, but the blue didn't seem to be blending with the green.

Quote
What order do you draw your objects on to the screen? I suspect you have an issue here

Depending on the order you draw things in the source and destination colors will be different

I render all of the tiles on the map, then the entities. But I don't see why this should make a difference.

Quote
Looks correct. Are you sure your glow/light texture isn't being hidden by the depth test?

There is no texture for a light, it is simply represented as a color offset to the original texture of the tile.

 39 
 on: 2014-12-29 10:23:26 
Started by JJengineering - Last post by JJengineering
Quote
Composition is great and indeed it sounds like you are 10% of the way there for an efficient ECS, but are still clinging to the old ways. It takes time believe me as I've worked on mine for years as things go.

10% sounds kind of rough to me, now, after all these months of 'research and pain' Tongue

Quote
You're doing it wrong.. ;p  This screams thinking more about the separation of data and the systems that process it. In an ideal scenario a 1:1 or 1:N arrangement is good. 1 data component containing everything a system component needs to process this data and complete a task.
I guess, i thought it would be intelligent, to tidy stuff away in a class object and just initializing my Component with it when some more complex data is needed Smiley
So thats the OOP way of thinking, i have to get rid of then for an ECS. And now where you point it out to me(and i've read a lot of times on the sites, 'you'll need time time to change your mindset'...)
Hmm... But classes.. are so.....hmmm....tidy and you can put everything int them and extend them Pointing Cry ......

Also, i usually tried to not have 1:1 or 1:N arrangement the way you say it should be, i tried to aim for: => Less components,but more 'modular' and also less systems, but more specific, 1:1 or near, seems more (unecessary?)system/components, just to get to that ratio.

But having though about it, i see that some components really are complex, but could still contain every data needed, for a system to process it. But then some of my components will get a little bloated, which is then pretty much inevitable with this approach, right? Oo
But what about Enum states? I guess i can use Enums which are globally visible (don't know if thats the right terminology for enum's), or at least where i need them,
allthough enums are objects. I don't know how 'fine grained' the ECS needs to be...

So: Component(contains ALL data, data only)-->runs through a System(static method/obj. method) identified by EnumSet mask ?

Plus, with making components without any composition apart from enums, my problems with saving/loading will be nicely solved with a clean JSON, and i can handle this myself!

Quote
It takes time believe me as I've worked on mine for years as things go.
How does yours roughly work? I've started with the GUID where every entitiy is an id and only has components somehow referenced to it, but i'm not feeling ready for this;p Plus, i've seen so many approaches i don't know which to use. Eventually i'm going to need references from entity to entity,which will be a problem when saving if i use my current setup, id's would make these things easier. (I think i need to dump my current Entity class + component map thingy)

I'll leave it a that for now, so you don't have to read so much :x

Thank you very much again for your patience!, you are helping me big time, and the 10% of being on my way to a descent ECS, has given me some kick to put some effort into it again  Grin


 40 
 on: 2014-12-29 10:11:09 
Started by Elsealabs - Last post by SwampChicken
Been here a few years now. I quite like the pace of JGO. Not too spammy. It's a comfortable visit-once-a-day site imho.

Pages: 1 2 3 [4] 5 6 ... 10
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Elsealabs (20 views)
2014-12-28 10:39:27

CopyableCougar4 (21 views)
2014-12-28 02:10:29

BurntPizza (25 views)
2014-12-27 22:38:51

Mr.CodeIt (15 views)
2014-12-27 04:03:04

TheDudeFromCI (20 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

rwatson462 (60 views)
2014-12-15 09:26:44

Mr.CodeIt (48 views)
2014-12-14 19:50:38

BurntPizza (98 views)
2014-12-09 22:41:13

BurntPizza (117 views)
2014-12-08 04:46:31
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

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50
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!