Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (108)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 4
1  Java Game APIs & Engines / OpenGL Development / time based movement ,unstable delta calculation from sys.gettime on: 2006-03-18 13:47:13
Hi

I have looked at this thread http://www.java-gaming.org/forums/index.php?topic=11443.0

Thats where I found the SystemTimer class, and how to use it.

This is what I do:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
long delta = SystemTimer.getTime() - lastLoopTime;
lastLoopTime = SystemTimer.getTime();

System.out.println("delta: "+delta);

float oldy = gameview.getYOnMap();
float speed = 30.0f;
float bxmov = (speed * delta) / 1000; //pixels to move

System.out.println("bxmov: "+bxmov);
System.out.println("moving it: "+(int)bxmov);

gameview.setYOnMap((gameview.getYOnMap() - bxmov)); //set the new location


When I look at the console and the different delta's it jumps alot up and down, everything from 18ms to 30ms and
this makes the movement look like many small movements then suddenly a big one..

If I just set it to move 1pixel each time without any movement timing its soo silky smooth. But since its 60fps even only 1 pixel pr frame is too fast..So
I need to time it to get slower movements.

Here's the delta output from console:

timerTicksPerSecond: 1000
delta: 53575561
delta: 64
delta: 32
delta: 32
delta: 32
delta: 33
delta: 32
delta: 32
delta: 17
delta: 18
delta: 18
delta: 17
delta: 18
delta: 17
delta: 18
delta: 17
delta: 33
delta: 32
delta: 32
delta: 32
delta: 33
delta: 32
delta: 32
delta: 32
delta: 19
delta: 17
delta: 18
delta: 18
delta: 17
delta: 18
delta: 17

I tried to set the speed to 60, so that should be 1pixel pr frame but it still jumps up and down its not even close to how smooth it is
when I use only a static +1 movement each tick.

Anyone got any tips?
2  Games Center / Archived Projects / Re: Feedback Requested: Lost Drops on: 2006-03-16 22:40:44
i liked that you used z and x, i dont like to use space Smiley maybe you could make an option for the button setup? Smiley
3  Games Center / Archived Projects / Re: 3D Engine and Demo with some nice effects on: 2006-03-03 11:44:28
160 fps with ati radeon9800pro
4  Games Center / Archived Projects / Re: Mace on: 2006-02-25 19:43:16
Thanks for your comments Zulo! The card I'm using is a Radeon 9550 that I picked up recently for only 45 GBP (about 80 USD)
I understand this is - in the graphics card market - and 'old' card but I'd rather be forced to write more efficient code and learn well, than to use lazy code on an X1800 or  NV 7800 and then wonder why others complain it's too slow!


Yes I agree Smiley
5  Games Center / Archived Projects / Re: scroller test on: 2006-02-23 09:48:41
Quote
> java Me
You need a space. e.g.'Mac OS'
>

ok i added a space now  Smiley
6  Games Center / Archived Projects / Re: scroller test on: 2006-02-23 00:42:13
ok i changed it to:
<resources os="MacOS">
    <j2se version="1.5+"/>
    <nativelib href="lwjgl_mac.jar"/>";
 </resources>

hope it works now  Smiley
class Me implements Believer {

Universe.GOD.addBeliever(this);
Universe.GOD.getAvailableChannel().sendWish(new Wish("correct mac resource specified in jnlp",true));

wishProcessed(BelieverEvent w){
  if(w.getStatus() == BelieveEvent.WISH_GRANTED){
    this.beHappy();
  }
}
}
7  Games Center / Archived Projects / Re: scroller test on: 2006-02-22 16:23:30
oops I forgot to add the mac native  Roll Eyes

but it should work now, I dont have mac so i cant test it, if this section is correct then it should work

<resources os="Mac OS" arch="i386">
    <j2se version="1.5+"/>
    <nativelib href="lwjgl_mac.jar"/>";
 </resources>

where lwjgl_mac.jar is signed and contains liblwjgl.jnilib
8  Games Center / Archived Projects / Re: scroller test on: 2006-02-21 10:22:38
ok then i can just use vsyncenable. Yes that black line is drawn there,i forgot to remove it.
9  Games Center / Archived Projects / scroller test on: 2006-02-20 21:40:50
Hey

I would be glad if someone could test my scroller-test to see if it runs and if its as smooth as on my computer.

Using LWJGL to render 2d sprites and bitmaps, this test has a 10*40 sized tilemap and theres around 100 tiles(not much i guess?) on the screen at any moment.

I also have a question: First I tried to use Display.sync(60), but i noticed a little lag in the scrolling of the map.
Now I have changed it and removed Display.sync(60) to use only Display.setVSyncEnabled(true);

When I use Display.setVSyncEnabled(true); it still is vsynced and incredibly smooth and thats why i wonder why use Display.sync(60) when you can get
vsync,and isnt the result of vsync the same as Display.sync(60) ?

Java Webstart http://www.vestheimonline.com/games/jnlp/vestheimgames-test1.jnlp for your pleasure Smiley

Controls: ESC to exit, arrows up and down to scroll.
10  Discussions / General Discussions / Re: any interface for objects creating actionevents? on: 2006-02-03 15:54:42
http://www.enode.com/x/markup/tutorial/mvc.html
A description of mvc.

 I think the only difference between that one and my model is that the model updates the view, the actionlistener/controller (adapter in my design) updates the model.

And in my design the adapter updates the view and the adapter also acts as the controller. So if I let the view listen to the models change event instead of the adapter it should be a correct MVC i think ?. And the adapter is just the external controller/actionlistener listening for commands from the view then it updates the model.
11  Discussions / General Discussions / Re: any interface for objects creating actionevents? on: 2006-02-03 15:40:05
Yes i understand how that works Smiley

I thought that MVC you had  3 parts.. model view and a controller..but where is your controller in your example?inside the view?

SOLDIER_CHANGE is this a public static final Change object in the model?

So I can have different changes hmm interesting Smiley

here is an image of my model:


I thought the adapter was just another name for Controller..

I guess i could just let the view do the same as the adapter.
12  Discussions / General Discussions / Re: any interface for objects creating actionevents? on: 2006-02-03 12:12:15
To move the real code away from any gui is what im trying to achieve.. I know it didnt end up on mvc, it became a freak-designpattern with nothing better
then mvc..

Theres so many different descriptions of mvc. I read a tutorial on mvc in java and they used a Model class and an adapter class..the adapter class transfers the actions from the gui to the model so that the model doesnt know about the gui. and the adapter class listens to changed events in the model and updates the gui. But could I just make the gui itself listen to the changed events? Should the model only use 1 event when something has changed in the model or could i make my own special events?

My adapter classes does the conversion of the data for the gui. For example, the adapter gets the list of sprites from the model when the model has changed. Then it walks through the collection of sprites and generates a String list of the sprites names and updates the gui / JList with the new list of strings.. I know I could also just send the list of sprite objects directly to the JList and it would show the names since the sprites have theyr own toString() method. But then there would be no reason for the adapter class. What should I do here?
13  Discussions / General Discussions / Re: any interface for objects creating actionevents? on: 2006-02-02 15:18:54
I was trying to make the classes as general as possible, but probably i was too focused
on making it too general.

I have Adapter classes that basically does a specific function..It has a reference to the model, for example the SpriteLibraryModel which contains the sprites.
The NewSpriteActionToSpriteLibraryAdaptor class has the function of  calling mode.addSprite(). So the point of my adapter classes is to have each function in an adapter class, and then register the object that decides when to do that function..Like a JButton. This works nice, I just make the adapter implement the ActionListener interface then registers itself as the listener on the JButton that comes in the constructor. The problem is that i was thinking too generally..what if my editor doesnt have a button for the "addSprite" function?(maybe the addsprite function should be done when the user press a button) Then i would have to get an event from a general object..But only JButtons generate ActionEvents, and some other components i guess but the Component class itself does not.. So I could create my own event and eventlistener but then i would have to subclass the JButton...and i still wanted to be able to make the gui with eclipse designer,which doesnt work with customized components i think. Anyway, I was thinking too much, my brain was fixed on creating the ultimate general library. Its strange that i was trying to do this when i cant come up on any idea of how it would be useful to use anything else then components..but still i wanted to try.  Roll Eyes

I still have the good design of model-adapter-view, so I can change the gui without breaking the real code and thats good enough for me Smiley
14  Games Center / Archived Projects / Re: Kumari - Updated - v0.5: Dec 29th on: 2006-02-01 14:28:17
I tried to change the resolution to 1280x1024 and now i get this error every time i start the game:

java.lang.NullPointerException
   at org.lwjgl.opengl.GL11.glGetString(GL11.java:1404)
   at com.vorax.Renderer.init(Renderer.java:357)
   at com.vorax.VoraxEngine.initialize(VoraxEngine.java:535)
   at com.vorax.VoraxEngine.engineLoop(VoraxEngine.java:1228)
   at Kumari.main(Kumari.java:136)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.sun.javaws.Launcher.executeApplication(Unknown Source)
   at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
   at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
   at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
   at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
   at com.sun.javaws.Launcher.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
15  Games Center / Archived Projects / Re: Undead Arena - Squareheads rises from the dead on: 2006-02-01 14:11:53
200 fps in 1280x1024 fullscreen   Cheesy
16  Discussions / General Discussions / the interest for arcade games is exploding on: 2006-01-29 13:21:39
I just heard about the PSP and the Capcom games i think theyr making all the old classic games
available for PSP..that means the interest for games like those old arcades is coming for real.

Look here at "Extreme Ghouls 'N Ghost" for PSP http://media.psp.ign.com/media/769/769179/vids_1.html
17  Games Center / Archived Projects / Re: Blobbit Dash (Win/OSX/Linux) on: 2006-01-28 15:13:38
I think 8$ is ok for this game..i could get 2 bottles of cocacola(0.5litre) for that.. I have myself been thinking about making small tiny games and sell,and when i thought about
the price i was thinking about the same as any ordinary item people buy everyday....like a Hamburger and a coke in the local store,that would be like 10$.
18  Games Center / 4K Game Competition - 2006 / Re: Xero - The Last Hope for Mankind on: 2006-01-27 21:27:20
it was in battery mode nad only 20 minutes left when i tested it, maybe there was some kind of performance thing there Smiley ill check!
19  Games Center / 4K Game Competition - 2006 / Re: Xero - The Last Hope for Mankind on: 2006-01-27 15:22:42
I tried the game on my dads laptop first and it didnt get any playable fps..maybe 2fps Smiley

Its a Ferrari 3200 laptop with ati radeon mobility 9700 gfx card..

Anyway, I tried it on my own computer and it works very nice Smiley

Could you make the controls flow better, i think they were still a bit slow, and I think it would be better if we could choose the fire button..my space button is
pretty bad Smiley

*edit* space is good, didnt know i could just hold it in Smiley)) hehe

I noticed the bullets doesnt always hit the enemy ship even when it looks like it should have hit..and the enemy bullet always kills the player when he gets hit..maybe you could turn it around so the player has a very small hit rectangle or what you use..and the enemy always get hit..this way you can add more enemies and more explosions = more action without increasing the difficulty
20  Games Center / Archived Projects / Re: Mace on: 2006-01-26 16:13:11
Hi

I just want to tell you the game looks incredibly nice, lovely terrain. Dont forget if you gfx card is radeon 5500 its very old..so new computers will maybe have much greater performance.
21  Discussions / General Discussions / Re: I need your opinion ... on: 2006-01-25 22:14:25
Depends on the price for me. Yes maybe if i was making a game i would pay a littlebit to
get those ready made behavior classes.

If I was just doing a hobby project i wouldnt pay much, if I had a real company then I think I would pay some more.
22  Game Development / Game Play & Game Design / Re: Graphics Editing Programs on: 2006-01-23 16:50:58
GraphicsGale Free Edition, it has onion skinning Smiley
23  Discussions / Miscellaneous Topics / Re: New graphic card on: 2006-01-21 01:57:04
you could try to read around on the internet to find out what cards can be softmodded with 100% success. That way you get way more for your money.
24  Discussions / General Discussions / Re: any interface for objects creating actionevents? on: 2006-01-19 17:11:33
hi
I tried it, the problem is that i want this class to get any kind of component then add itself as a listener..I dont want to make bind this class to a JButton..it should work with other components..So i want to be able to add any kind of component and then
listen to an event. Naturally it would be some kind of component creating action events but how do i add this class as an actionlistener to the component when i
dont know what component is coming into the constructor? If only there were some kind of superobject like "ActionEventCreatorObject"..

I guess i just have to create my own event and an interface that some subclass of a component or object could implement..


This is how i want to be able to do it, where the Object is some kind of object that throws an event:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
public class NewSpriteActionToSpriteLibraryAdaptor implements ActionListener{

   SpriteLibraryModel model;

   Component controller;

   public ButtonToSpriteLibraryAdaptor(Component component, SpriteLibraryModel m) {
      model = m;
      controller = component;
      controller.addActionListener(this); //component doesnt have the addActionListener method, only buttons etc..
  }

   public void actionPerformed(ActionEvent event) {
     
         model.addSprite();
           
   }

}


implementing the AWTEventListener interface kind of works but then i would have to add some kind of eventlistener to the component in the gui just to make the event fire..a dummy-actionperformed method
25  Discussions / General Discussions / any interface for objects creating actionevents? on: 2006-01-18 20:46:53
Hi

I have a class like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
public class ButtonToSpriteLibraryAdaptor implements EventListener {

   SpriteLibraryModel model;

   Button controller;

   public ButtonToSpriteLibraryAdaptor(Button component, SpriteLibraryModel m) {
      model = m;
      controller = component;
     
   }

   public void actionPerformed(ActionEvent arg0) {
      model.addSprite();

   }

}

Now ofcourse because of the class name it looks like this class's specific function is supposed to happen
when a button is clicked. But what if I want to make it general? I want to be able to register any gui component or object and listen for events.
How can I do this? is there any interface i can implement to get a basic event from any gui component?

If i name the class ActionToSpriteLibraryNewSprite then maybe you understand what i want the class to do. Or maybe I just have to implement many different
listener interfaces to support different components?
26  Game Development / Game Play & Game Design / Re: using beans for my game editor, good idea? comments wanted :) on: 2006-01-12 14:07:40
thank you

I used some hours yesterday to learn beans, and how to use them in eclipse visual editor. I had never tried to program beans
before but it seems like a nice way to get easy property settings when you use the eclipse visual editor. I would customize my eclipse with beans..it
could be a mess though (? )

I was thinking of creating a beans-version of all my library objects for an editor and have a clean version for the actual game engine.
27  Game Development / Game Play & Game Design / using beans for my game editor, good idea? comments wanted :) on: 2006-01-12 01:04:42
Hi

I am about to start a new editor for my new game engine. This would be the third time i try to
create an editor. Iterative development process  Grin

This time I will implement besides sprites, actions,dialog etc. I will also use beanshell as the script.

The problem is how to design the editor. How should I build it. I want the user to be able to
add new sprites, define the animations, actions, events and more. I.e set properties. So i was thinking I could
make all the sprites etc. as beans to use in the editor. Is this a good idea or just as much work as programming all the frames,windows
and property dialogs in a normal way? Even if i make the editor able to use my beans i still have to code the actual functions and panels of property setting?Or
is this a function available in java already?

Without using beans I could select an object/sprite from a list, click a button "edit" and pass the object to a dialog which in turn knows
how to edit a sprite object etc.. Im just unsure if its easier to use beans or not.  Undecided

Thank you for any replies Smiley
28  Discussions / General Discussions / book suggestions on java3d topic? on: 2005-09-19 13:37:04
Hi

I need to find a book on java3d or beans or servlet programming that will be the basis for an oral examination.

Since the exam is an oral examination the book must explan the theory and principles with the topic since i cant talk code:)
29  Java Game APIs & Engines / J2ME / Re: timebased movement problem on: 2005-08-02 14:51:00
Thank you that was a good idea, I have changed the position and speed variables to float. I think i have to create my own sprite class because i cant override j2me's getX() and then I would have to change all the calls in my code. But i think this float solution is going to work, thanks again Smiley
30  Java Game APIs & Engines / J2ME / Re: timebased movement problem on: 2005-08-02 11:24:15
elapsedTime is calculated in the tick() method:
 
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
public void tick() {

        long currentFrameTime = System.currentTimeMillis();

        //first time set it to 0
       if (lastFrameTime == 0) {
            lastFrameTime = currentFrameTime;
        }

        double elapsed = (currentFrameTime - lastFrameTime);
        //System.out.println("elapsed:" + elapsed);

        lastFrameTime = currentFrameTime;
       
        moveBall(elapsed);
        movePaddle(elapsed);
    }

Pages: [1] 2 3 4
 

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

The first screenshot will be displayed as a thumbnail.

CogWheelz (16 views)
2014-07-30 21:08:39

Riven (22 views)
2014-07-29 18:09:19

Riven (14 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (32 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (42 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!