Raven's projects

Started by Raven, November 01, 2005, 11:15:34 PM

Previous topic - Next topic

raft

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

r a f t

raft

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:

r a f t

Raven

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"

raft

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

r a f t

EgonOlsen

I just found this thread about game timing. Maybe it helps: http://forums.indiegamer.com/showthread.php?t=5192

Raven

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.

Raven

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?

EgonOlsen

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:

Raven

QuoteOh, 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)

EgonOlsen

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: this.getClass().getClassLoader().getResourceAsStream(<your file>);

Raven

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:

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

EgonOlsen

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.

MFJ

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.)

Raven

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).

QuoteCan 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.

QuoteIf 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

EgonOlsen

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.