forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Soft bodies physic

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Drakon



Joined: 08 Apr 2008
Posts: 13
Location: Poznan - Poland

PostPosted: Wed Jun 25, 2008 8:57 pm    Post subject: Soft bodies physic Reply with quote

Hi everyone.

It's not a homebrew for PSP - yet, but maybe someone could find this useful.

I converted walaber JellyPysic engine from C# to C++ and it's working quite nice :>

Here is last code - http://drakon.xxl-web.pl/projects/JellyPhysic_cpp_0_1.rar with some small test that use OpenGl to render shapes.

I have an idea for small game that use this library on PSP - I will post some info when I will make it:>

Ps. If someone is interested I made small test for PSP with library that JellyPhysics is based on - http://drakon.xxl-web.pl/psp/soft_body.rar.
You are moving cursor and dragging body on triangle ;)

[EDIT]

I just updated the source - in last version there was some big memory leaks... Now it's ok.
Back to top
View user's profile Send private message Visit poster's website
Drakon



Joined: 08 Apr 2008
Posts: 13
Location: Poznan - Poland

PostPosted: Wed Jul 02, 2008 7:01 pm    Post subject: Reply with quote

Hi once again.

If someone is interested I made quick test for PSP :
http://drakon.xxl-web.pl/psp/PSP_JellyPhysic.rar

On square and circle bodies are added, on triangle you can drag bodies.
Exit is on the start button.

There is still much more to do... optimize more, clean code, remove bugs (memory is ending too quick :/). I would very grateful for some advices about optimizations.

Currently I'm using pspGl for rendering.


Last edited by Drakon on Thu Jul 03, 2008 7:15 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Wed Jul 02, 2008 8:01 pm    Post subject: Reply with quote

seems interesting :)
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
Rangu2057



Joined: 23 Jul 2007
Posts: 87
Location: wilmington, NC

PostPosted: Thu Jul 03, 2008 10:14 am    Post subject: Reply with quote

interesting indeed :)


EDIT: well if you need any help count me in, i need something to do besides play ftb2 all day, btw i can only code in C and a little ASM
_________________
the questions of today are awnswered by the blood and bullets of tomorrow! ---EagleEye--- (Socom FTB2)
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Thu Jul 03, 2008 4:59 pm    Post subject: Reply with quote

Anyone tried running the eboot?
No luck here under 1.50 or 3.52.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
Drakon



Joined: 08 Apr 2008
Posts: 13
Location: Poznan - Poland

PostPosted: Thu Jul 03, 2008 5:41 pm    Post subject: Reply with quote

Art wrote:
Anyone tried running the eboot?
No luck here under 1.50 or 3.52.


There is currently build only for psp slim and soft above 3.71.
I'm using 3.90 and it's working.
Back to top
View user's profile Send private message Visit poster's website
Heimdall



Joined: 10 Nov 2005
Posts: 259
Location: Netherlands

PostPosted: Thu Jul 03, 2008 6:48 pm    Post subject: Reply with quote

I've played with your code and got it to work with any fw, this was the change:

added to main.cpp after the includes:

Code:
extern "C"
{
#  include <pspkernel.h>

  /* Define the module info section */
  PSP_MODULE_INFO(__FILE__, 0, 1, 1);

  /* Define the main thread's attribute value (optional) */
  PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
 

  int exitCallback(int arg1, int arg2, void *common)
  {
   sceKernelExitGame () ;
    return 0 ;
  }


  int callbackThread(SceSize args, void *argp)
  {
    int cbid;

    cbid = sceKernelCreateCallback ( "Exit Callback", exitCallback, NULL ) ;
    sceKernelRegisterExitCallback ( cbid ) ;

    sceKernelSleepThreadCB () ;
    return 0 ;
  }


  int setupCallbacks(void)
  {
    int thid = 0;
    thid = sceKernelCreateThread ( "update_thread", callbackThread, 0x11, 0xFA0, 0, 0 ) ;
    if ( thid >= 0 )
    {
      sceKernelStartThread ( thid, 0, 0 ) ;
    }
    return thid;
  }
}


and the makefile:

Code:
TARGET = JelloTest
OBJS = main.o

CFLAGS = -O3 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

INCDIR = $(PSPPATH)/include
LIBS = -lJello -lglut -lGLU -lGL -lpspvfpu -lpspge -lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgum -lpspgu -lm -lstdc++


EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Soft Body Test

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


Note that I build all the Jello Physics as a lib so i can easily import it to other projects instead of compiling it every time.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Drakon



Joined: 08 Apr 2008
Posts: 13
Location: Poznan - Poland

PostPosted: Fri Jul 04, 2008 7:17 am    Post subject: Reply with quote

Heimdall wrote:
I've played with your code and got it to work with any fw, this was the change...

Thanks for tip, strangely it crushed on my slim -_- Could you send me your modified code?

I cleaned some duplicated code and put psp version in svn repository here:
http://jphysicmod.googlecode.com/svn/trunk/
(with normal cpp version and c#,also pack on my website was updated)

Performance is slowly increasing :) But still I'm under mega big impression how they were able to get so good performance in LocoRoco...
Back to top
View user's profile Send private message Visit poster's website
Heimdall



Joined: 10 Nov 2005
Posts: 259
Location: Netherlands

PostPosted: Fri Jul 04, 2008 5:03 pm    Post subject: Reply with quote

Hi,

I've uploaded the EBOOT + the source path here: http://www.jetcube.eu/projects/JelloPhysics/PSP_JellyPhysic-20080704.zip

About the slim, maybe you are right i've a old fat PSP i've never tested my stuff on the slim... Anyway the patch allows you to build a lib separately from the demo app, so other people can use it.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Fri Jul 04, 2008 5:42 pm    Post subject: Reply with quote

Quote:
But still I'm under mega big impression how they were able to get so good performance in LocoRoco...

I obtained a similar effect (on a PC) with metaball technique: 8 metaballs constrained with springs around a center. Consider that 2d metaballs are computable in a fast way by GE by superimposing and tresholding precomputed 2d/transparent sprites and rendering everything in a texture (the sprite you will use).
This means no constant inner area for soft bodies, but still a realistic (and FAST) effect.

jean
Back to top
View user's profile Send private message
Drakon



Joined: 08 Apr 2008
Posts: 13
Location: Poznan - Poland

PostPosted: Fri Jul 04, 2008 6:51 pm    Post subject: Reply with quote

@Haimdall - thanks for patch :) I updated svn and now there is build version for fat and slim.

@jean - thanks for pointing out, i will read about this technique :)
Back to top
View user's profile Send private message Visit poster's website
Drakon



Joined: 08 Apr 2008
Posts: 13
Location: Poznan - Poland

PostPosted: Sat Jul 05, 2008 9:25 am    Post subject: Reply with quote

Sorry for this spamming...

I changed rendering from pspGL to GU, changed the way that physic is updated and the jump of the performance was quite Big!!! :)

Here it is : http://drakon.xxl-web.pl/psp/PSP_JellyPhysic2.rar
Controls didn't changed.

This is only test - after cleaning some bugs (crush at exit...) I will update svn.

Cheers
Back to top
View user's profile Send private message Visit poster's website
Drakon



Joined: 08 Apr 2008
Posts: 13
Location: Poznan - Poland

PostPosted: Thu Jul 17, 2008 5:26 pm    Post subject: Reply with quote

ymm I have a problem with debug :/ I was searching forum but didn't find answer ...

When i'm trying to debug with psp-gdb i get this message on the start :
Code:
_start (args=0, argp=0x0) at crt0_prx.c:109
109     crt0_prx.c: No such file or directory.
        in crt0_prx.c


it's kinda strange because when i'm trying some samples from sdk it's ok... So the only logical answer is that I'm doing something wrong...

Is there someone that can put light on this ? I would be very grateful.

Ps. here is video how it works on psp for everyone that couldn't see it : http://www.vimeo.com/1352294
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group