Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, Nymphodora, Quad, TipmyPip, Imhotep), 852 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 5 of 41 1 2 3 4 5 6 7 40 41
Re: Newton 2 wrapper [Re: amy] #224256
08/29/08 10:59
08/29/08 10:59
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
thanks smile

v.8
- added map14 - Scaled Collision demo - wrapped from ScaledCollision.cpp



i'm waiting for your comments and wishes: i have a to-do list, but i also want to know, what is needed for users (ragdoll, car and custom joints would be a little later wink


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Newton 2 wrapper [Re: VeT] #224450
08/30/08 10:00
08/30/08 10:00
Joined: Oct 2006
Posts: 36
BigM Offline
Newbie
BigM  Offline
Newbie

Joined: Oct 2006
Posts: 36
Hi! Great, great work!

I though you were just going to provide the API functions and little else. Extras like pre-made custom joints and the like (compound collision hulls, YES!!) are awesome and will save 3DGS users lots of work and debugging.

I stumbled across a bug, however. You said earlier you had to have a destructor because of memory issues. The problem is that there is a call to NewtonDestroyBody inside the destructor callback. It will recur and crash (stack overflow?).

I'm working with v5 of the wrapper. Sorry if this has been fixed later but I have no time to check it.

Skipping the destructor assignment works well, as well as just commenting out the NewtonDestroyBody call within the destructor. Is it really necessary to have a destructor? In the corrected case it just calls ent_remove; I usually call ent_remove along with the body destruction anyway but if there are performance issues I will keep the destructor.

Cheers!

Re: Newton 2 wrapper [Re: BigM] #224492
08/30/08 14:19
08/30/08 14:19
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
greetings

yes, now i'm working now on compounds, but have some problems there...

okay, what about destructor.. i made some tests and must to say that you are right, engine craches if i remove entity
after several tests, i change code to this:

here is new destructor
Code:
void onsetdestructor(NewtonBody *body)
{
	ENTITY *entity = (ENTITY*)NewtonBodyGetUserData(body);
	if (entity) {ent_remove(entity);}
}


here is a process of destruction
Code:
if (key_x)
{
if (my.skill99!=0) {NewtonDestroyBody(nworld,(NewtonBody*) my.skill99);}
}


i think, its the best and simplest way: graphical entity is removed in destructor of newtons body, so we just may delete only NewtonBody
destructor would be changed in v.9

why dont you download the last versions: i added only new levels, but the core of wrapper is unchanged(till now :))

anyway, thanks for gelp in debuging wink

Last edited by VeT; 08/30/08 14:21.

1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Newton 2 wrapper [Re: VeT] #224552
08/30/08 20:33
08/30/08 20:33
Joined: Oct 2006
Posts: 36
BigM Offline
Newbie
BigM  Offline
Newbie

Joined: Oct 2006
Posts: 36
Glad I could help. I began the transition to newton 2.0 last week and have run into some trouble; as I debug I will post here the wrapper specific problems I find.

I will use the later wrapper versions; however, changing versions is not that simple in my case as I have some custom changes made to newton_main.c (time slicing, for example) and have to copy/paste some code when updating.

Keep up the good work!

Re: Newton 2 wrapper [Re: VeT] #224568
08/30/08 21:54
08/30/08 21:54
Joined: Oct 2005
Posts: 57
P
picoder Offline
Junior Member
picoder  Offline
Junior Member
P

Joined: Oct 2005
Posts: 57
Nice job VeT!

Keep up the good work!

Last edited by picoder; 01/20/10 07:09.
Re: Newton 2 wrapper [Re: picoder] #224617
08/31/08 10:54
08/31/08 10:54
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
BigM, try to use Total Commander's "Compare files by content", that could help you... you may just compare old newton_main.c and new one... its looking like this
http://img192.imagevenue.com/img.php?image=32924_1_122_107lo.JPG

i'm going to uplate to 2.0 (17 beta) after wrapping compounds and magnets(black/white hole and buoyansy)

picoder, thanks for comment smile


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Newton 2 wrapper [Re: VeT] #224719
08/31/08 21:34
08/31/08 21:34
Joined: Oct 2006
Posts: 36
BigM Offline
Newbie
BigM  Offline
Newbie

Joined: Oct 2006
Posts: 36
Thanks, will do that.

Actually there are not that many changes: mostly I changed the NewtonUpdate call. If you find any of this interesting please add it to the wrapper:

Code:
void newton_start()
{
	newton_running = 1;
	nworld = NewtonCreate(0, 0);
	
	newton_addstaticcollisiongeometry();
	
	while(newton_running) // newton has to update every frame
	{
		advance = time_frame/16;
		slices = integer((advance / MIN_NEWTON_ADVANCE) + 1);

		for (slices_left = slices; slices_left > 0; slices_left--){
			NewtonUpdate(nworld, advance/slices);
		}
		wait(1);
		proc_mode = PROC_LATE;	

	}
}


I implemented time slicing because I wanted precise control over the fineness of the simulation and felt NewtonSetMinimumFrameRate didn't work quite like I expected back in newton 1.53. Maybe this is useless now.

I also set proc_mode to PROC_LATE: this way the simulation is performed right after the main cycle, instead of before. I believe this way to be better as the time_frame value used in calculations in main() (in my case acceleration calculations based on user input) refers to the same frame as the time_frame used to compute the update time.

Hope this are useful 2 cents! Please let me know what you think.

Re: Newton 2 wrapper [Re: BigM] #224957
09/02/08 07:44
09/02/08 07:44
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
sorry for silence: i was playing "Stalker: clear sky" for some eveings and nights blush

thanks for help, i'd test your code and would add it to v9


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Newton 2 wrapper [Re: VeT] #224964
09/02/08 08:39
09/02/08 08:39
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
okay, and what is MIN_NEWTON_ADVANCE ?


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Newton 2 wrapper [Re: VeT] #225117
09/02/08 21:34
09/02/08 21:34
Joined: Oct 2006
Posts: 36
BigM Offline
Newbie
BigM  Offline
Newbie

Joined: Oct 2006
Posts: 36
Sorry, I now realize that the name is mischosen: it should be called MAX_NEWTON_ADVANCE! :P

Anyway, this define is a value for the largest step that Newton is allowed to perform.

Setting a minumum rate with NewtonSetMinimumFrameRate should have the same effect but in 1.53 I found it to behave a little different than expected.

Page 5 of 41 1 2 3 4 5 6 7 40 41

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1