Soft bodies physic

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Drakon
Posts: 13
Joined: Tue Apr 08, 2008 3:46 pm
Location: Poznan - Poland
Contact:

Soft bodies physic

Post by Drakon »

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/Jelly ... pp_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.
Drakon
Posts: 13
Joined: Tue Apr 08, 2008 3:46 pm
Location: Poznan - Poland
Contact:

Post by Drakon »

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.
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

seems interesting :)
Image
Upgrade your PSP
Rangu2057
Posts: 87
Joined: Mon Jul 23, 2007 8:37 am
Location: wilmington, NC

Post by Rangu2057 »

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)
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

Anyone tried running the eboot?
No luck here under 1.50 or 3.52.
If not actually, then potentially.
Drakon
Posts: 13
Joined: Tue Apr 08, 2008 3:46 pm
Location: Poznan - Poland
Contact:

Post by Drakon »

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.
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

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: Select all

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

  /* Define the module info section */
  PSP_MODULE_INFO&#40;__FILE__, 0, 1, 1&#41;;

  /* Define the main thread's attribute value &#40;optional&#41; */
  PSP_MAIN_THREAD_ATTR&#40;THREAD_ATTR_USER | THREAD_ATTR_VFPU&#41;;
  

  int exitCallback&#40;int arg1, int arg2, void *common&#41;
  &#123;
	sceKernelExitGame &#40;&#41; ;
    return 0 ;
  &#125;


  int callbackThread&#40;SceSize args, void *argp&#41;
  &#123;
    int cbid;

    cbid = sceKernelCreateCallback &#40; "Exit Callback", exitCallback, NULL &#41; ;
    sceKernelRegisterExitCallback &#40; cbid &#41; ;

    sceKernelSleepThreadCB &#40;&#41; ;
    return 0 ;
  &#125;


  int setupCallbacks&#40;void&#41;
  &#123;
    int thid = 0;
    thid = sceKernelCreateThread &#40; "update_thread", callbackThread, 0x11, 0xFA0, 0, 0 &#41; ;
    if &#40; thid >= 0 &#41;
    &#123;
      sceKernelStartThread &#40; thid, 0, 0 &#41; ;
    &#125;
    return thid;
  &#125;
&#125;
and the makefile:

Code: Select all

TARGET = JelloTest
OBJS = main.o

CFLAGS = -O3 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

INCDIR = $&#40;PSPPATH&#41;/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=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/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.
Drakon
Posts: 13
Joined: Tue Apr 08, 2008 3:46 pm
Location: Poznan - Poland
Contact:

Post by Drakon »

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...
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

Hi,

I've uploaded the EBOOT + the source path here: http://www.jetcube.eu/projects/JelloPhy ... 080704.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.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

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
Drakon
Posts: 13
Joined: Tue Apr 08, 2008 3:46 pm
Location: Poznan - Poland
Contact:

Post by Drakon »

@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 :)
Drakon
Posts: 13
Joined: Tue Apr 08, 2008 3:46 pm
Location: Poznan - Poland
Contact:

Post by Drakon »

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
Drakon
Posts: 13
Joined: Tue Apr 08, 2008 3:46 pm
Location: Poznan - Poland
Contact:

Post by Drakon »

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: Select all

_start &#40;args=0, argp=0x0&#41; at crt0_prx.c&#58;109
109     crt0_prx.c&#58; 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
Post Reply