Author Topic: Raven's projects  (Read 33544 times)

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Raven's projects
« Reply #15 on: November 17, 2005, 09:53:59 pm »
Quote from: "EgonOlsen"
in theory...it never happened for Paradroidz because collision detection is too fast


certainly it is. in fact everything, even those you mark as expensive in javadocs, is quite fast compared to render time. dont get me wrong, i dont mean rendering is slow :wink:

i choosed this way since i couldnt find effective solutions for some questions, especially in a multi-user enviroment. for instance, if some user moves from point A to B, basicly only these two points are broadcasted to other clients. assuming constant fps it is trivial to decide where that user will be in each frame. with un-constrained fps it's somewhat more complicated

Code: [Select]
r a f t

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Raven's projects
« Reply #16 on: November 17, 2005, 10:24:38 pm »
Quote from: "raft"
assuming constant fps it is trivial to decide where that user will be in each frame. with un-constrained fps it's somewhat more complicated


himm, i'm re-thinking now about the subject and, assuming constant fps even in an un-constrained enviroment may be a good assumption. normally fps doesnt change that much if something doesnt change radically (such as world size doubles or user opens another cpu eater application).

so, measuring fps every -say- 5 seconds and assuming it constant may also simplify things. i guess this way fps increases slightly since number of updates decrease. a drawback is, if one moves with key strokes every frame, fps/ups results in a smoother feeling

sorry raven, filling your forum with self thoughts  :oops:

Code: [Select]
r a f t

Offline Raven

  • int
  • **
  • Posts: 62
    • View Profile
    • http://www.vortex.is/raven
Raven's projects
« Reply #17 on: November 17, 2005, 11:39:37 pm »
Thanks a lot for your reply guys.

Helge, your mainloop made me breathe easier.. means I know what I need to to actually implement what I'm thinking of without reading up on a lot of stuff ;)

EDIT: Also, after your posts I promise not to thread my app at all ;)

Due to my state of newbieness to the matter of fps' and ticks, I'm still digesting what you were talking about regarding it. But if I understand correctly, you're basically normalizing game animations and events by checking how fast the application is running?

So for example, this would keep gameplay basically the same for everyone regardless of their CPU  speed provided that their CPU's aren't slower than X?



raft: Feel free to fill my thread thoughts, it helps :)

-Hrafn "Raven"

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Raven's projects
« Reply #18 on: November 18, 2005, 05:53:12 pm »
Quote from: "Raven"
Due to my state of newbieness to the matter..

nevermind, i'm also a newbie for this kind of projects, or at least i was before karga :wink:
Quote from: "Raven"
if I understand correctly, you're basically normalizing game animations and events by checking how fast the application is running?

yes, exactly. the idea is to increment the game state (animation indices, positions of moving objects etc) as much as the time elapsed since last update

say you have an opening door animation which you want to last for 2 seconds, and your fps is 50 (= 1/50 seconds elapsed) you increase animation index of door by 1 / (50 * 2) each frame

Code: [Select]
r a f t

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Raven's projects
« Reply #19 on: November 22, 2005, 05:38:08 pm »
I just found this thread about game timing. Maybe it helps: http://forums.indiegamer.com/showthread.php?t=5192

Offline Raven

  • int
  • **
  • Posts: 62
    • View Profile
    • http://www.vortex.is/raven
Raven's projects
« Reply #20 on: November 22, 2005, 09:55:17 pm »
Great, thanks guys.

Man, java interfaces can be confusing. Just "finished" working out the framework for operable objects, animated objects and trigger objects -- while multiple inheritance is a necessity, it sure is quite messy sometimes.

Next I'll try out the game timing.

Offline Raven

  • int
  • **
  • Posts: 62
    • View Profile
    • http://www.vortex.is/raven
Raven's projects
« Reply #21 on: December 07, 2005, 11:25:29 pm »
Phew. Just finished my finals at the university for last semester, had some time to come up and breathe (i.e. make a small applet).

After spending so much time programming a heavy-duty fps framework, I decided to try something less demanding out. But as always, things take more work than you expect.

The plot: Show MRI (magnetic resonance images) scans of my brain (yes, my brain) in a 3D applet.

I pulled it off quite nicely I think, however there are some problems I was hoping you guys could give me some advice on.

1) The scans are placed on a thin slice as a texture, the slices (object3D's) are then made transparent(0), however -- it's still very hard to see "inside" the brain without moving the slices further apart.

Can anyone think of a way to make this look better?

In the actual applet you can swirl the scans around using the arrow buttons, but unfortunately my service provider doesn't allow applets to read files (textures) from the server itself. So I only have images to show.

Here are the screenshots:






What do you think?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Raven's projects
« Reply #22 on: December 07, 2005, 11:42:27 pm »
Quote from: "Raven"

1) The scans are placed on a thin slice as a texture, the slices (object3D's) are then made transparent(0), however -- it's still very hard to see "inside" the brain without moving the slices further apart.

0 is the lowest possible setting for transparency in the software renderer, so there's no way to make them more transparent when not using hardware. Maybe picking a slice with the mouse is an option. If it's picked, you could temporary remove all slices above or make the picked slice slide out somehow.

Quote from: "Raven"

In the actual applet you can swirl the scans around using the arrow buttons, but unfortunately my service provider doesn't allow applets to read files (textures) from the server itself. So I only have images to show.
How it that done and why? It should be quite transparent for the server if a browser is reading the files or an applet is. However, how about putting the files in the applet's jar and load them from there.

Oh, and...nice brain... :wink:

Offline Raven

  • int
  • **
  • Posts: 62
    • View Profile
    • http://www.vortex.is/raven
Raven's projects
« Reply #23 on: December 08, 2005, 12:05:04 am »
Quote
Oh, and...nice brain...


Thank you  :lol:


Quote

How it that done and why? It should be quite transparent for the server if a browser is reading the files or an applet is. However, how about putting the files in the applet's jar and load them from there.


Thanks for the hint. I tried that, no luck -- same error.

I have no idea why it happens, but my best guess is my providers security issues, here's the error I get:

Loading Texture...slices/0.png
java.security.AccessControlException: access denied (java.io.FilePermission slices/0.png read)

at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
   at java.security.AccessController.checkPermission(AccessController.java:401)
   at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
   at java.lang.SecurityManager.checkRead(SecurityManager.java:863)
   at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:472)
   at sun.awt.SunToolkit.getImage(SunToolkit.java:486)
   at com.threed.jpct.Texture.loadTexture(Unknown Source)
   at com.threed.jpct.Texture.<init>(Unknown Source)
   at BrainVision3.loadSlices(BrainVision3.java:226)
   at BrainVision3.init(BrainVision3.java:69)
   at sun.applet.AppletPanel.run(AppletPanel.java:354)
   at java.lang.Thread.run(Thread.java:552)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Raven's projects
« Reply #24 on: December 08, 2005, 12:09:11 am »
Looks like you are not using the correct method to load them. To load them from a server, use the URL-version of the loading methods, to load them from a jar-file, use the InputStream variants. You can get the InputStream like so:
Code: [Select]
this.getClass().getClassLoader().getResourceAsStream(<your file>);

Offline Raven

  • int
  • **
  • Posts: 62
    • View Profile
    • http://www.vortex.is/raven
Raven's projects
« Reply #25 on: December 08, 2005, 07:27:57 pm »
It's been a really long time since I messed with applets, so I don't have any trouble believing the error is on my side  :cry:

But anyway, I tried both accessing the image from a .jar file and by using:
Code: [Select]

try {
URL imageURL = new URL("http://www.vortex.is/raven/Brain/slices/"+i+".png");
img = Toolkit.getDefaultToolkit().getImage(imageURL);
texMan.addTexture(i + ".png", new Texture(img));
} catch (java.net.MalformedURLException MURLE) {}


But no luck. Same error.
Any ideas?

-Raven

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Raven's projects
« Reply #26 on: December 09, 2005, 12:34:06 am »
Loading them from the jar should definitely work. Can you provide me with a simple test case that doesn't work for you? I could upload it to my webspace and see if that works.

Offline MFJ

  • byte
  • *
  • Posts: 8
    • View Profile
    • http://www.endinet.co.uk
Raven's projects
« Reply #27 on: December 10, 2005, 02:24:00 pm »
If you're using an un-signed applet you need to make sure that the location you specify is *exactly* the same as the codebase of the applet. (Easiest way to do this is to use Applet.getCodeBase() and then append the filename on the end of it.)

Offline Raven

  • int
  • **
  • Posts: 62
    • View Profile
    • http://www.vortex.is/raven
Raven's projects
« Reply #28 on: January 30, 2006, 04:48:28 pm »
Hey everybody.
Been busy months and haven't really gotten anything done since the last day I posted.... a few months back, so unfortunately no cool screenshots.

Going to try and get started again.
To review what my problem was: I was trying to get an applet that loads images (see screenshots above) to work online (it works on my computer, but gives access error when online).

Quote
Can you provide me with a simple test case that doesn't work for you? I could upload it to my webspace and see if that works.


Thanks a bunch for the offer Helge! I'd really appreciate that if things don't start working soon.

Quote
If you're using an un-signed applet you need to make sure that the location you specify is *exactly* the same as the codebase of the applet. (Easiest way to do this is to use Applet.getCodeBase() and then append the filename on the end of it.)


Thanks for the tip. I'm going to look up a few examples online, but I have a couple of questions:

(1) What is the 'codebase' exactly? Is it not just the URL of the applet?
(2) I'm storing the images in a separate folder, might this be the problem?

Thanks again everyone.

-Raven

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Raven's projects
« Reply #29 on: February 02, 2006, 04:42:24 pm »
The codebase is where your applet is located on the server. It's usefull to store the applet on another location on the server than the calling html-page.
For example, if your page is at "/hurz/gurz/myapplet.html" but applet is at "plopp/glopp/applets/myapplet/", the latter would be the codebase.