Author Topic: FutureRP  (Read 35895 times)

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #15 on: January 04, 2007, 03:04:19 am »
The animation using keyframes, interpolation, and subsequences works!

Thank you! I cannot believe it. I never tested it until this stage, and now that I have,
I find it works remarkably well!

I am in your debt, Egon;).

And, of course, Raft, for clarifying how it could be done.

Ill have some screenshots up the moment I get the model walking forwards, and not breakdancing sideways - Maybe ill keep this animation for an easter egg:P
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #16 on: January 12, 2007, 05:00:59 am »
I wonder what I could trim off this.......

This is the main drawing loop, roughly.....

DIRTY RECTANGLE ALGORTHM calls dirty objects to be repainted...

IF OBJECT IS AN ISOMETRIC TILE draw it onto the volatile image backbuffer.
IF OBJECT IS A 3D MODEL clear buffer with MAGENTA, render, and set magenta as transparent colour with a special imagefilter. Draw to the volatile image backbuffer.

DRAW DIRTY BITS OF THE DIRTY OBJECTS to the screen.


Now, this looks pretty smoothly done, however, there are some things Id rather not do:)....

1. Have to call calcBoundingBox() for every frame, per object!
2. I heard of a back/front buffer on FrameBuffer. Do I need to have this? I assume its part of the way you render a scene? The framebuffer is only 200x200, so flipping from back to front is not a killer, but I will have to do it for each object.

You see I have to render each object by itself, which no doubt puts an overhead which isn't there when you make a true 3d game.




Well, those aren't massive problems. I'd be extremely happy if anyone can help solve these problems for me!:)

Using a MAGENTA background, was for drawing, and masking it for fast transparent. Unfortunately, I don't know how to do it in Java, so I have to use an image filter to make MAGENTA pixels have a 0x00 alpha value. It means I need to create a new image instance for EVERY 3D OBJECT, EVERY FRAME!
I bet that slows it down a bit.

About the bounding box... Egon tells me that it isn't too slow, if the models are low polygon. They are very low polygon. Still, I'm hoping for 10 3d objects onscreen at one time.

That is 10x calcBoundingBox, 10x renderScene, and 10x new image instance for MAGENTA to transparent. I CANNOT cache these renders. There is simply too many unique rotations, and animation sequences to make it plausible.


I must add, I'm not getting terrible FPS here. I have a constant 100FPS, and its clipped by me, to be no more than 100FPS, so it could be higher.
However, this is with just one model on the screen, on a 1.44GHz CPU, ATI Radeon with FGLRX drivers for linux.

The game which is my inspiration, LBA1, runs fast on a 233MHz(?) Pentium 1 CPU, with windows 95.
I realise Java is not going to work well with a mere "Hello World" app on this platform.
And, this is a pc from 1997.
Most people will have a broadband connection and at least 1GHz CPU right now. Most of the users of my website claim to:).

I also realise that Java is a virtual machine, and that it can never really reach the raw speed of proper, compiled code.

Regardless of this, I am trying hard to squeeze the most I possibly can out of this thing.

I know, I have typed a lot of rubbish here:). Any help is, like always, greatly appreciated. Thanks again:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11749
    • View Profile
    • http://www.jpct.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #17 on: January 13, 2007, 09:52:07 pm »
It should be possible to use the same image-instance for the masking, shouldn't it? You could set the alpha for magenta pixels manually in the pixels array.
About the front- and backbuffer: This is only used when doing oversampling or undersampling. When using the normal sampling mode there is only one buffer.
About the performance: As mentioned in the other thread, Java6 boosts pixel processing performance for me, so it's worth a try.

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #18 on: January 15, 2007, 07:48:01 pm »
Aha, I will try this data buffer trick you speak of:).
Ive been using is for height maps in a different class, so I dont even need to make new methods:D

Java 6, yup, certainly is faster. Much faster. In windows.

It is a shame it is such a nightmare to install in ubuntu without a repository.
I think ill wait until someone puts it with an install script before I use it in linux:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #19 on: January 15, 2007, 07:54:12 pm »
Wow! It is the magenta to alpha conversion which is making everything slow!

Well, not slow, but, when removed, it is faster able to hold a solid 100fps,
even while rotating, translating, animating, and recalculating bounding box:D.

Well, i only need 25fps, so this massive freedom is very comforting.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #20 on: January 15, 2007, 09:09:34 pm »
I cannot seem to do an RGB & 0x00ffffff on the magenta pixels.

The bufferedimage used in your output buffer isn't a bitmask transparency.

Is is possible for jpct to use a bufferedimage with bitmask transparency,
instead of a fully opaque one?

Thanks again for your help:)

-------------------------------------------------

EDIT:
Instead of editing the buffer, i have made another bufferedimage, with transparency, and just put the modified data into that.

It is just as fast, since the modified pixel data is still being put back into an image.

The only way this could be even faster, is with a method of clearing the framebuffer to a transparent colour.
Something that may be possible, but even if it is, I cannot rely on you to fix my problems. It is working pretty nicely now anyway.
Still, it would be a major speed boost again.

Ill post the source code for those interested. Its very simple.

Code: [Select]
private int[] pixelData;
private int magenta = Color.magenta.getRGB() & 0x00ffffff;
private DataBuffer buffer,buffer2;
private void makeTransparent()
{
if(pixelData==null)
{
//Grab the databuffer for the target, and destination
buffer    = image.getRaster().getDataBuffer();
buffer2   = bufferImage.getRaster().getDataBuffer();
       pixelData = ((DataBufferInt)buffer).getData();
}

int rgb = 0;
int i   = 0, num = pixelData.length;
while(i<num)
{
rgb = pixelData[i];

if(rgb==magenta)//Magenta?
buffer2.setElem(i, rgb & 0x00ffffff); //Remove alpha.
else
buffer2.setElem(i, rgb | 0xff000000); //Add alpha.

i++;
}
}
[/i]
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11749
    • View Profile
    • http://www.jpct.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #21 on: January 17, 2007, 12:16:16 am »
Isn't it possible to write to a pixels[]-array of the target image in this case like the one you are reading from? I mean something like:

Code: [Select]
while(i<num)
      {  
         rgb = pixelData[i];
     
         if(rgb==magenta)   //Magenta?
            pixelData2[i]=rgb & 0x00ffffff; //Remove alpha.
         else
            pixelData2[i]=rgb | 0xff000000; //Add alpha.
         
         i++;
      }


That would save the method-calls to setElem(...);

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #22 on: January 18, 2007, 07:44:42 pm »
I thought that too Egon.

And most examples use that way too. But, every time I try it I get a black
rectangle where the model it meant to be drawn.

Absolutely no reason why this is so. Perhaps it is because I am using linux,
and they have a slightly different implementation? Although, that would be stupid. There is, like I mentioned, a problem with compositing in Java 1.5 for linux too.

Java 6 fixes the composite problem, and a lot more, including fullscreen mode inside x11, but they havent bothered to make a .deb installer, and it throws errors
if i try to build it manually, so im just going to wait:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #23 on: January 19, 2007, 01:20:28 am »
I am doing the final little modifications tomorrow, after which FutureRP will fully support interchangable clothing, which includes textures, and child 3d objects(for hats,etc), as intended for weeks now:)

It is very exciting for me. I have completed the vast majority of client/server code,
and the client is now able to forward/receive information in x/y/z axis, with some interpolating for high latency connections.

There is a working physics system, created using height mapping, to allow realistic stairway/slope movements, and a jump button, which is affected by a pretty realistic gravity force.
What I mean is, the further you fall the faster you descend - up to the point where air resistance would stop a real human body's acceleration through air.

I also have a fully functional chat system. By pressing the 'T' button, you can enter a message that will appear above your head, in a smooth, alpha blended speech bubble:D
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #24 on: January 22, 2007, 02:21:01 pm »
To support larger models, and minimize speed loss, I am going to use multiple
frame buffers, and assign each size object to the best fitting buffer.

My default is 200x200 with a model scale of 1f.
I plan up to 400x400, and as little as 50x50.

For 100x100, i just use 1f/2, to get roughly the same size model, but with a bigger
screen.

EDIT:
Id guess my only problem is that perspective will look different in each frame buffer size.

It is a shame there is no switch to enable orthogonal-like rendering, but, its not surprising you did not anticipate weird people would need it;)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11749
    • View Profile
    • http://www.jpct.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #25 on: January 23, 2007, 10:38:10 pm »
I don't see a reason why the perspective should change when rendering into a smaller buffer. At least not as long as the aspect ratios are the same. There is no ortho-mode because the software renderer's pipeline can't do it and it's close to impossible to add it at this stage. Your screenshots are looking perfect anyway, so i don't see the need for it. Personally, i think it's even better looking with this slight tough of perspective that is has now even if the rest is still ortho.
Anyway, what i actually wanted to know is, how "big" this game will be, i.e. how many players do you expect to play it?

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #26 on: January 23, 2007, 11:11:57 pm »
Yes, you are right:)

I have tested larger objects, such as vehicles, and other random objects.
There is a much more noticable perspective, but it isn't spoiling anything,
and it adds a little character:).

I plan on having a few hundred players online simultaneously.

Each server will be interconnected.
Each server will host a collection of maps.

The story will be based around a space station, which uses stargates/transwarp hubs, to connect distant locations.

Each server will probably support a single planet, and all maps based on that planet.


I do not know the capacity of my server/client architecture, so I cannot accurately estimate the maximum users online.
I use a hybrid of TCP/UDP, and have a throttling mechanism to reduce the granularity of positional data being broadcasted.
The larger the server load, the lower the number of packets send to the server, and the more the clients rely on interpolation.

My aim is to have ~200 online simultaneously, per server, at a minimum.

EDIT:
The server doesn't really do anything intensive. And the bandwidth is brilliant,
so I would not be surprised if I could get 1000+ players online at the same time.
The server basically distributes the maps, and character data upon login,
validates movements(stop cheating), and broadcasts to other players.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #27 on: January 24, 2007, 02:00:57 pm »
I have implemented a new "Content-Type" header for my tcp connections.

text/gzip - A compressed character array, which is detected, and compressed/uncompressed transparently, behind a small abstraction layer.

It means I can transmit an xml map of ~500KB as 25KB.
It would have been foolish not to do this:)


EDIT:
I have been using SHA1 encryption to send player passwords in udp packets.
I am not convinced its required though, and it does carry the largest overhead of all parts of the broadcaster. Not huge, but large enough to appear on the profilers graphs.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #28 on: February 06, 2007, 01:01:17 pm »
http://www.rpwar.com/phpBB2/viewtopic.php?t=24

The above link is a full screenshot history of my project!
I hope someone has a look:)
It shows you ALL of the different ways ive tried;)

Hopefully the 3d version will be completed soon:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
FutureRP - 2D Isometric Engine with 3D characters
« Reply #29 on: February 27, 2007, 01:44:56 am »
Female model being made:)
This is an old screenshot - she has feet and a head now:)

Still, its the only one I can get...



I'm considering releasing my male and female models for free,
because I feel like it is one of those extremely annoying parts of a game project.
I always feel I waste time, as a perfectionist, finding models I can use in the long term, when I should be using a rubbish test model, and getting all of the engine's functions working properly first.

I am proud of myself, in this project, because I did use a weird looking model(without a neck:P) for most of my testing.

Still, I feel the "obsessive compulsiveness" of my approach to life tends to slow my progess, but, when I'm finished, I feel my work has really benefited from the extra effort - I suppose this reasoning is common sense;)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG