DCEmulation

The Dreamcast Homebrew Community Online
Back to main site
It is currently Sun Apr 20, 2014 8:53 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 56 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: Fri Apr 13, 2012 6:11 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 336
Basil wrote:
Quote:
I would probably need some help in converting the maps to the format I am using for DC, as it can be a bit time consuming.
If anyone is interested in helping, drop me a line.

If it doesnt require programming knowledge i can try to.
New beta looks awesome. I cant wait to see a full level. :)


Thanks again for the interest, but we can scratch that idea off of the list.

I have actually written an app to convert the .smclvl format into the map format I am using on DC.
This means the maps will be exactly the same as the standard version of the game.
Still a few details to iron out, but this is very good news for the project indeed.

Image


Top
 Profile  
 
PostPosted: Sat Apr 14, 2012 4:27 am 
Offline
DCEmu Crazy Poster
DCEmu Crazy Poster

Joined: Tue Aug 30, 2011 1:29 am
Posts: 31
Good news PH3NOM :grin:
Good luck.

_________________
http://www.dreamcast.fr / http://dreamcast-news.blogspot.com


Top
 Profile  
 
PostPosted: Sat Apr 14, 2012 2:06 pm 
Offline
Insane DCEmu
Insane DCEmu
User avatar

Joined: Wed Apr 09, 2008 7:04 am
Posts: 183
Location: Europe
Oh, it's good that you have created an easy way to work with maps. I'm very excited about your project.

_________________
Order Fast Striker, GunLord and NEO XYX for Dreamcast at http://www.ngdevdirect.com
Order 2d/3d Shoot 'em up Sturmwind http://www.redspotgames.com/shop
Order Dux 1.0, Redux incl. Dux 1.5 and The Ghost Blade at http://hucast.com/index.php


Top
 Profile  
 
PostPosted: Sun Apr 15, 2012 7:21 am 
Offline
Moderator
Moderator
User avatar

Joined: Fri Oct 12, 2007 11:52 am
Posts: 614
Location: Munich, Germany
Awesome stuff! :)

_________________
..::SEGA-DC.DE - The home of the German Dreamcast scene::..
Image


Top
 Profile  
 
PostPosted: Sat Apr 21, 2012 7:09 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 336
Progress continues! Stay tuned.

Image

Image

Image


Top
 Profile  
 
PostPosted: Sun Apr 22, 2012 12:17 pm 
Offline
DCEmu Crazy Poster
DCEmu Crazy Poster

Joined: Tue Aug 30, 2011 1:29 am
Posts: 31
We follow you. :)

_________________
http://www.dreamcast.fr / http://dreamcast-news.blogspot.com


Top
 Profile  
 
PostPosted: Sun Apr 22, 2012 1:20 pm 
Offline
Insane DCEmu
Insane DCEmu
User avatar

Joined: Wed Apr 09, 2008 7:04 am
Posts: 183
Location: Europe
Thank you for new screenshots.

_________________
Order Fast Striker, GunLord and NEO XYX for Dreamcast at http://www.ngdevdirect.com
Order 2d/3d Shoot 'em up Sturmwind http://www.redspotgames.com/shop
Order Dux 1.0, Redux incl. Dux 1.5 and The Ghost Blade at http://hucast.com/index.php


Top
 Profile  
 
PostPosted: Sun Apr 22, 2012 11:23 pm 
Offline
DCEmu Cool Poster
DCEmu Cool Poster

Joined: Wed Oct 17, 2001 5:44 pm
Posts: 1003
Wow, cool, nice to see that this is being worked on :)


Top
 Profile  
 
PostPosted: Sun Apr 29, 2012 7:49 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 336
Well, I guess I'll upload the 2nd demo.
Keep in mind it is totally my own... If anyone is really interested I can share some code.
Good progress considering I have been working on this for just over a month in my free time.

Get it here:
http://www.mediafire.com/?58i1xo8fvjryhrn

Image


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 12:04 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sun Sep 05, 2010 3:44 am
Posts: 64
Nice tech-demo PH3NOM! It's getting better :) . Do you know when we'll start smashing mushrooms and losing lives? ;)


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 12:25 pm 
Offline
DCEmu Crazy Poster
DCEmu Crazy Poster

Joined: Tue Aug 30, 2011 1:29 am
Posts: 31
SDiso : http://www.mediafire.com/?7apj8fhvu8wd1cr
( http://dreamcast-news.blogspot.fr/2012/ ... ecret.html )

_________________
http://www.dreamcast.fr / http://dreamcast-news.blogspot.com


Top
 Profile  
 
PostPosted: Sun May 06, 2012 7:58 am 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 292
Wow that really is nice Ph3n0m.

I tried it and I must say it's quite impressive :)

Should we expect a full engine/game in the near future?


Top
 Profile  
 
PostPosted: Thu May 10, 2012 8:55 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 336
Neoblast wrote:
Wow that really is nice Ph3n0m.

I tried it and I must say it's quite impressive :)

Should we expect a full engine/game in the near future?


Thanks!

I had problems with running the larger levels at 60fps, some slowdown could drop down to 55fps, also causing issues with music playback.

Anyhow, I realized there was a limitation in the way the PVR is being utilized by KOS.

I have solved the problem, and now things are faster than ever.

Image


Top
 Profile  
 
PostPosted: Thu May 10, 2012 10:26 pm 
Offline
DC Developer
DC Developer

Joined: Thu Aug 28, 2003 11:25 pm
Posts: 138
PH3NOM wrote:
Anyhow, I realized there was a limitation in the way the PVR is being utilized by KOS.
I have solved the problem, and now things are faster than ever.



Great ! Can you say more about the PVR limitation and the way you solved it ?

_________________
ImageDynamite Dreams Dreamcast fans : http://www.facebook.com/dddreamcast


Top
 Profile  
 
PostPosted: Fri May 11, 2012 12:02 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 292
patbier wrote:
PH3NOM wrote:
Anyhow, I realized there was a limitation in the way the PVR is being utilized by KOS.
I have solved the problem, and now things are faster than ever.



Great ! Can you say more about the PVR limitation and the way you solved it ?


I'm intrigued about that too... did you modify kos for that?


Top
 Profile  
 
PostPosted: Sun May 13, 2012 10:53 am 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 336
Neoblast wrote:
patbier wrote:
PH3NOM wrote:
Anyhow, I realized there was a limitation in the way the PVR is being utilized by KOS.
I have solved the problem, and now things are faster than ever.



Great ! Can you say more about the PVR limitation and the way you solved it ?


I'm intrigued about that too... did you modify kos for that?


Sorry to get your hopes up, my solution was really simple.
The thing is, the PVR is limited to 60fps. ( I dont know if this is a hardware limitation, or KOS ).
However, the engine I'm writing is capable of much faster than that.
What I was doing is simply rendering every-other frame, so 100 frames processed by the engine meant 50 frames drawn per second.

As things turn out, I decided to try PVR Direct Rendering instead of the other PVR Primitive method.
Success!
Now, even on the larger levels, everything runs smoothly at 60fps, rendering every frame.

So, remember folks, if you are pushing thousands of polys per frame, make sure to use Direct Rendering!

To summarize:
Before, the scene was rendered in two phases.
1 - Compile the polys
Code:
void DCE_compile_l1( LevelSprite_t current, int entries )
{
    int i;
    for( i=0; i<entries; i++ )
       pvr_compile_l1( &current[i], 10.0f );                                             
}


Code:
inline pvr_compile_l1( LevelSprite_t sprite, float z )
{
    sprite->frame.vert[0].argb  = sprite->frame.vert[1].argb  = sprite->frame.vert[2].argb  = sprite->frame.vert[3].argb  = PVR_PACK_COLOR(1.0f, 1.0f, 1.0f, 1.0f);
    sprite->frame.vert[0].z     = sprite->frame.vert[1].z     = sprite->frame.vert[2].z     = sprite->frame.vert[3].z     = z;   
    sprite->frame.vert[0].flags = sprite->frame.vert[1].flags = sprite->frame.vert[2].flags = PVR_CMD_VERTEX;
    sprite->frame.vert[3].flags = PVR_CMD_VERTEX_EOL;

    sprite->frame.vert[0].x = sprite->frame.vert[1].x = sprite->x;
    sprite->frame.vert[0].y = sprite->frame.vert[2].y = sprite->y+sprite->height;
    sprite->frame.vert[0].v = sprite->frame.vert[2].v = sprite->frame.height_ratio;
    sprite->frame.vert[1].y = sprite->frame.vert[3].y = sprite->y;
    sprite->frame.vert[2].u = sprite->frame.vert[3].u = sprite->frame.width_ratio;
    sprite->frame.vert[2].x = sprite->frame.vert[3].x = sprite->x+sprite->width;

   pvr_poly_cxt_txr(&sprite->frame.cxt, PVR_LIST_TR_POLY, sprite->frame.texColor | sprite->frame.texFmt,
                         sprite->frame.vram_width, sprite->frame.vram_height, sprite->frame.vram_tex, PVR_FILTER_BILINEAR);
   pvr_poly_compile(&sprite->frame.poly, &sprite->frame.cxt);
}


2 - Submit the polys
Code:
void DCE_submit_l1( LevelSprite_t, int elements )
{
     int i;
     for (i=0; i<elements; i++ )
          pvr_submit_poly( sprite[i].frame );
}


Code:
inline pvr_submit_poly( struct pvr_frame pvr  )
{
   pvr_prim(&pvr.poly, sizeof(pvr.poly));

   pvr_prim(&pvr.vert[0], sizeof(pvr.vert[0]));
   pvr_prim(&pvr.vert[1], sizeof(pvr.vert[1]));
   pvr_prim(&pvr.vert[2], sizeof(pvr.vert[2]));
   pvr_prim(&pvr.vert[3], sizeof(pvr.vert[3]));
}


That works fine, but slows way down when pushing thousands of polys per frame.

Now, I am using a 1-pass Direct Render method:
Code:
void DCE_render_l1( LevelSprite_t current, int entries )
{
    int i;
    for( i=0; i<entries; i++ )
       pvr_direct_render_l1( &current[i], 10.0f );                                             
}


Code:
inline pvr_direct_render_l1( LevelSprite_t sprite, float z )
{
      pvr_vertex_t *vert;
      pvr_dr_state_t state;

     pvr_poly_cxt_txr(&sprite->frame.cxt, PVR_LIST_TR_POLY, sprite->frame.texColor | sprite->frame.texFmt,
                         sprite->frame.vram_width, sprite->frame.vram_height, sprite->frame.vram_tex, PVR_FILTER_BILINEAR);
     pvr_poly_compile(&sprite->frame.poly, &sprite->frame.cxt);

      pvr_dr_init(state);
      pvr_prim(&sprite->frame.poly, sizeof(pvr_poly_hdr_t)); 

      vert = pvr_dr_target(state);
      vert->flags = PVR_CMD_VERTEX;
      vert->x = sprite->x;
      vert->y = sprite->y+sprite->height;
      vert->z = z;
      vert->u = 0;
      vert->v = sprite->frame.height_ratio;
      vert->argb = 0xffffffff;
      pvr_dr_commit(vert);

      vert = pvr_dr_target(state);
      vert->flags = PVR_CMD_VERTEX;
      vert->x = sprite->x;
      vert->y = sprite->y;
      vert->z = z;
      vert->u = 0;
      vert->v = 0;
      vert->argb = 0xffffffff;
      pvr_dr_commit(vert);

      vert = pvr_dr_target(state);
      vert->flags = PVR_CMD_VERTEX;
      vert->x = sprite->x+sprite->width;
      vert->y = sprite->y+sprite->height;
      vert->z = z;
      vert->u = sprite->frame.width_ratio;
      vert->v = sprite->frame.height_ratio;
      vert->argb = 0xffffffff;
      pvr_dr_commit(vert);

      vert = pvr_dr_target(state);
      vert->flags = PVR_CMD_VERTEX_EOL;
      vert->x = sprite->x+sprite->width;
      vert->y = sprite->y;
      vert->z = z;
      vert->u = sprite->frame.width_ratio;
      vert->v = 0;
      vert->argb = 0xffffffff;
      pvr_dr_commit(vert);
}


And this is very fast! Constant 60fps.


Top
 Profile  
 
PostPosted: Sun May 13, 2012 12:14 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 292
Hum it looks very nice and fast indeed, but wasn't the other way used for some reason?

Maybe you are skipping some control checks/functions that could lead to some errors when rendering polys or something?

Else everything would have been done using that method, right?

I haven't tangled too much with direct rendering so correct me if I'm wrong.


Top
 Profile  
 
PostPosted: Sun May 13, 2012 5:01 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 336
Neoblast wrote:
Hum it looks very nice and fast indeed, but wasn't the other way used for some reason?

Maybe you are skipping some control checks/functions that could lead to some errors when rendering polys or something?

Else everything would have been done using that method, right?

I haven't tangled too much with direct rendering so correct me if I'm wrong.


No, that's not the reason :-) Although I am not exactly sure myself. Maybe someone can correct me too!
( BB Hood, you still around? http://dcemulation.org/phpBB/viewtopic.php?f=29&t=100316 )

There may be more to it than this, but here is my understanding of the difference...

With the primitive method, a polygon that is compiled can be submitted for display over and over again without re-compiling the poly.
Only if the coordinates change does the poly need to be compiled again before it can be submitted for display.
This mode could be optimal for GUI's, or static display such as health bar, on-screen displays, etc.

With the Direct Render method, a polygon is compiled directly into the display list. It cant be used again without re-compiling.
This mode is optimal for polygons that continually change coordinates.

Not sure on a hardware level what is actually happening, but I can say for sure that Direct Rendering has greatly increased render speed in my engine ;-)
Why doesn't everything use it? Good question. I don't see it used in any of the KOS PVR examples I have looked at...


Top
 Profile  
 
PostPosted: Sun May 13, 2012 6:37 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Sat Dec 01, 2007 7:51 am
Posts: 292
PH3NOM wrote:
Neoblast wrote:
Hum it looks very nice and fast indeed, but wasn't the other way used for some reason?

Maybe you are skipping some control checks/functions that could lead to some errors when rendering polys or something?

Else everything would have been done using that method, right?

I haven't tangled too much with direct rendering so correct me if I'm wrong.


No, that's not the reason :-) Although I am not exactly sure myself. Maybe someone can correct me too!
( BB Hood, you still around? http://dcemulation.org/phpBB/viewtopic.php?f=29&t=100316 )

There may be more to it than this, but here is my understanding of the difference...

With the primitive method, a polygon that is compiled can be submitted for display over and over again without re-compiling the poly.
Only if the coordinates change does the poly need to be compiled again before it can be submitted for display.
This mode could be optimal for GUI's, or static display such as health bar, on-screen displays, etc.

With the Direct Render method, a polygon is compiled directly into the display list. It cant be used again without re-compiling.
This mode is optimal for polygons that continually change coordinates.

Not sure on a hardware level what is actually happening, but I can say for sure that Direct Rendering has greatly increased render speed in my engine ;-)
Why doesn't everything use it? Good question. I don't see it used in any of the KOS PVR examples I have looked at...


Humm it sure is interesting and maybe an example should be uploaded to the kos svn?

A good way to test would be a "stress test" of the engine with/without (primitive method /new) plus static and moving polygons then checking the framerate.

Have you tried if its faster with static onesas well?


Top
 Profile  
 
PostPosted: Sun May 20, 2012 6:51 pm 
Offline
DC Developer
DC Developer
User avatar

Joined: Fri Jun 18, 2010 7:29 pm
Posts: 336
Neoblast wrote:
Humm it sure is interesting and maybe an example should be uploaded to the kos svn?

A good way to test would be a "stress test" of the engine with/without (primitive method /new) plus static and moving polygons then checking the framerate.

Have you tried if its faster with static onesas well?


Actually took another look today, and KOS does actually does have an example using Direct Rendering, and this example actually helped me make one important optimization to my rendering code:
Code:
kos\examples\dreamcast\pvr\pvrmark_strips_direct


And looking closer at the KOS API, it makes perfect sense why this method works faster:
http://gamedev.allusion.net/docs/kos-current/pvr_8h.html#a8b06e5cc41d5e1fc3b7f90154aefe77b


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 56 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group