Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / Marvin the Magician

Author
Message
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 8th Dec 2007 12:20
Debuggin was made with Dark Basic Pro commands.
But if you mean what commands was used in functions then there was some dll commands and dbpro commands.

You just need calculate evrything with fastest way you can to keep the speed up.

You can use the debugger to find out the function or part of code what slows down and try to see whats wrong


Click For Details!

C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 8th Dec 2007 14:22
@ Roxas
Well if you are using DLLs to make your functions faster then it has nothing to do with my experience, in the respect that I have quite a lot of experience in DBP but that won't make any difference if its C++ I need to use to make the DLLs to make the game faster.

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 8th Dec 2007 15:40
No no.. You got me wrong
I dint mean like that. Of course i use dbpro commands.. With dll i just meant sparky and that. And in scripting system i use Matr1x Utils.

Its normal coding..


Click For Details!

C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 8th Dec 2007 16:04
@ Roxas
Ok then, so what commands are you using which makes it all so fast that I'm obviously not using?

@ Everyone else
The next version of MTM (Marvin the Magician) should include a new map, at least 1 new type of enemy and maybe some sounds.

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 8th Dec 2007 16:24
Its not with commands. Its how you handle the things. Use less amount of loops. Less amount of math in loops. Think all ways you can make your functions faster

Here is code that you can use on debuggin
basically it just records the highest ms you got from certain place and shows it.


Just put the InitCounter() at top of your program.
And if you want to debug a function then use it like this:


AddCounter adds the counter profile and starts timer. Endcounter stops timer. And GetCounter shows the results.


Click For Details!

C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 8th Dec 2007 20:01 Edited at: 8th Dec 2007 20:01
@ Roxas
Hmm, well thank you. But that still doesn't help me in my quest to find faster ways to calculate things like sc_intersectobject which slows most of my programs down when it comes to AI. (And jumping, as shown in MTM.)

New version released, with sound, a new map and more enemies:

Download the ZIP from:
http://www.soharix.homestead.com/Marvin_the_Magician.zip

Updates:
Map 2, which can be accessed from the East end of Breezey plateau.
Tree monsters, which can be accessed in Map 2, they are all around Frosty lake.
Sounds!!! , which can be accessed all the time now

Screenshots:


13. Marvin stood on the island in the middle of Frosty Lake.


14. Marvin escaping one of the new tree monsters.

Have fun people and enjoy this more complete version.

(Yes I know you're able to jump over the fence around Map 2 but I will put a game-block there eventually.)

(All sounds at Soharix are recorded using nothing more than what I can find at my desk, and my own personal vocals. (All the sounds for MTM were recorded vocally.))

The crazy
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Behind you
Posted: 8th Dec 2007 20:01
woot! downloading now!

[href]www.savethegrunts.org[/href]
Mr Z
17
Years of Service
User Offline
Joined: 27th Oct 2007
Location:
Posted: 8th Dec 2007 20:06 Edited at: 8th Dec 2007 20:07
An clear case, which do not have very much to do with your game, and where you can actually make the function twise as fast is if you would like to check if an value can be devided or not. One way is to loop from two to the number itself (every number can be devided by 1 ). Another, better way is to loop half the way. Same affect, but twise as fast.

This may not be very usefull for your game, but does really demonstrate how you can make functions faster, without makeing then less accurate, only thanks to good coding.

Ohh, and I´m looking forward for the next demo.

EDIT:

LOL! You posted the next version while I posted this. Downloading!

Darknes, you haunt me. If I give in, I would be an monster beyond imagining. Light, you guide me. Thanks to you, I see past the nothingness. Life, I choose to live in the light.
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 8th Dec 2007 20:11
@ Mr Z
Well, obviously I still have a lot to learn, because a lot of that on loops and half loops didn't make nearly any sense to me. :S

But oh well, I'm managing for the moment.

Hope you enjoy the new version

Mr Z
17
Years of Service
User Offline
Joined: 27th Oct 2007
Location:
Posted: 8th Dec 2007 20:26 Edited at: 8th Dec 2007 20:27
Well, there exist generally two types of numbers. One type can only be devided by itself and 1 (like 2, 3 and 5), the other type can be devided by itself, 1, and at last one more number. Like 4, that can be devided by 1, 2 and 4. The first type of numbers are quite important in math, so it´s important to know if an number is like that or not.

What I wrote was two ways to program something that finds out if an number belongs to that first group or not. One is slow, the other is twise as fast.

Hope that helped.

Darknes, you haunt me. If I give in, I would be an monster beyond imagining. Light, you guide me. Thanks to you, I see past the nothingness. Life, I choose to live in the light.
The crazy
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Behind you
Posted: 8th Dec 2007 20:26
it was great man! my fps fluctuated between 30 and 40 however. is it supposed to be that way? and when i shot the bullets on the snow lvl, it gave me an error: object already exists. perhaps the bullets from the previous lvl were not all deleted with the rest of the level?

[href]www.savethegrunts.org[/href]
Bizar Guy
19
Years of Service
User Offline
Joined: 20th Apr 2005
Location: Bostonland
Posted: 8th Dec 2007 20:26 Edited at: 8th Dec 2007 20:48
I tried the newest version, I worked until I was walking around on the water for a bit, and then exited. Did I die? and if so, please don't have the game exit when you die. Could you make space jump as well as crl, because it will work for most of us, because the action key works much better on the mouse anyways. Also, the camera movement is way too sensitive. If you tone it down a bit, you can have the camera constantly free moving, which would feel a lot better. Also, you could make the talk button attack when you're not standing ext to someone. Having a single action button feels a lot nicer than a bunch of different buttons, I think.

And what's wrong with your gravity, aside from being really loose?

Edit: whoa! A second page. I'll try this new version too.

I pressed 1 in the new version, and suddenly nothing worked. So I started pushing keys, and text printer. I pressed enter, and my guy changed into the brother of the mage, and the people and items stopped responding to me. Also, I went to both sides of the map, and even did that rediculous platform thing to get to the top of that hill, and still could not find the new map.


Superman wears Chuck Norris PJ's
Mr Z
17
Years of Service
User Offline
Joined: 27th Oct 2007
Location:
Posted: 8th Dec 2007 20:30
And I´ve played the new version. And it was better the the previus one. The jump sound gave it just an bit more life then it had before. So it feelt better. But I encountered an bug in the second world. I was just about to blast those trees to oblivion, when an "object already exist at line 431" error appeard, and destroyed my fun . At last I think it was line 431...

Darknes, you haunt me. If I give in, I would be an monster beyond imagining. Light, you guide me. Thanks to you, I see past the nothingness. Life, I choose to live in the light.
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 8th Dec 2007 20:59
@ Mr Z
Could you give me an example of the code for finding out prime numbers slowly, and the code for finding them twice as quick, so I know what you mean. (Prime numbers are what they are called if they can only be divided by themselves and 1.)

@ The crazy
Yeh, I know I forgot to delete the fired objects from the last map, I will sort this out.

@ Bizar Guy
Yep you did die, and the game won't really exit when you die, it just has nothing else to do when you die, and rather than having the program carry on I let it end so you know something happened.

And the camera movement isn't sensative, if you have your mouse sensativity lower. I will make an enterable sensativity-factor in the options menu at some point. - And what do you mean, "if I tone it down a bit you can have it constantly free moving?"

I would also prefer not to have the talk button as the attack button too because what happens if you run into town being followed by something and you run near a guy and turn round to shoot the enemy? You'd end up talking to the guy instead. I've seen examples of trying to make programs easy to use before in quite a lot of "commercial games" and frankly it ends up annoying you when you try to do something and it doesn't do what you want it to do. - If we all know that shift fires and left-mouse activates objects then no one will get confused and you'll be able to do things like pickup health and mana while shooting something.

And what do you mean my gravity is loose? The gravity is fine.

@ Mr Z again
Sorry for spoiling your fun, I hadn't properly tested the new version, I simply had a saved game in the second map for when I needed to try something there.

Mr Z
17
Years of Service
User Offline
Joined: 27th Oct 2007
Location:
Posted: 8th Dec 2007 21:20
Nah, it´s nothing. Still an wip . The point of haveing wips and wip demos is to find things like this, so the full game can be without them.

Anyway, it was some time ago I made an algorithm for calculating if an number is an prime number or not. Will have to work on it, in order to make it work. I will post the code here then.

Darknes, you haunt me. If I give in, I would be an monster beyond imagining. Light, you guide me. Thanks to you, I see past the nothingness. Life, I choose to live in the light.
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 8th Dec 2007 21:33 Edited at: 8th Dec 2007 21:39
EDIT:
<Never mind, in my efforts to prepare a sourcecode that is readable to others, I rejumbled the code and managed to fix the problem, everything is OK again )

Attachments

Login to view attachments
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 8th Dec 2007 21:45
WHOA! How did the world get into new look that fast
Really nice.

Quote: "Hmm, well thank you. But that still doesn't help me in my quest to find faster ways to calculate things like sc_intersectobject which slows most of my programs down when it comes to AI. (And jumping, as shown in MTM.)"


Yes thats where i cant help at all
Your best bet may be finding a workaround for this somehow.


Click For Details!

C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 8th Dec 2007 21:53
@ Roxas
I'm glad you like the new map (or were you on about the new textures for map 1?)

And, Oh well, I'll just stick with my simple, point-and-follow AI until I can find a better way.

@ Everyone
Sorry about the firing problem in the 2nd map. I fixed it, along with another problem that allowed you to scale very steep slopes.

I'm currently uploading an updated version of the last release with these problems fixed.

Download the ZIP from:
http://www.soharix.homestead.com/Marvin_the_Magician.zip

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 8th Dec 2007 22:14
Quote: " I'm glad you like the new map (or were you on about the new textures for map 1?)

And, Oh well, I'll just stick with my simple, point-and-follow AI until I can find a better way."


The whole map looks awesome
It was great idea to get into winter theme because christmas is soon here.


Click For Details!

C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 8th Dec 2007 22:17
@ Roxas
Hehe, I never thought of it that way.

I just needed the greatest contrast to green grass and lushious trees, so I chose a snowy mountain top. (Contrast and variety keeps players happy.)

The other map (map 3) will be rocky, possibley in a big cave or in a gorge/valley. So it will be yet another contrast to greenery.

Mr Z
17
Years of Service
User Offline
Joined: 27th Oct 2007
Location:
Posted: 8th Dec 2007 22:36
Ok, now I have took some time and made the code needed to calculate if an given number is an prime number or not. However, it was not always twise as fast (but on all the test I did it was always faster), and then I mean on low numbers like 7. But when you got to heigher, it really became faster. The fast method calculated the number 1001 in 5 miliseconds, while the slow one took over 3 seconds. You can see for your self (the time it took will be shown when the calculation is done).

Code:


Darknes, you haunt me. If I give in, I would be an monster beyond imagining. Light, you guide me. Thanks to you, I see past the nothingness. Life, I choose to live in the light.
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 8th Dec 2007 22:40
This game is looking really nice!

Just a question... is your main character animated?


Productivity on Hassassin has increased tenfold.
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 8th Dec 2007 22:40 Edited at: 8th Dec 2007 22:41
@ Mr Z
Hmm, I see what your point is now, it is a lot quicker.

Thats all I can see though, I don't actually get what the programs are doing to calculate the prime number. (I don't know how you calculate prime numbers.)

But at least this time I do actually see what you and Roxas were going on about.

Thank you.

@ Veintitres
Nope, I can't animate, so absolutely nothing is animated

Although with the help of "The crazy" I will have some animated enemies shortly.

C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 9th Dec 2007 01:41 Edited at: 9th Dec 2007 01:42
@ Anyone expecting more updates
I apologise in advance but during the course of today I won't have any time to do anything to MTM.(As much as I'd like to.)

But because it is aproaching Christmas, I must finish all my coursework for school and that means putting work in.

So that's what I'll be doing during most of today. Sorry if anyone was expecting more joys the following day.

I will return to work as soon as possible though.

Posted UK time: 00:42 09/12/2007

tha_rami
18
Years of Service
User Offline
Joined: 25th Mar 2006
Location: Netherlands
Posted: 9th Dec 2007 03:52
School means work? Jeez. Must be an foreign method of school.

In any case, the new update is fine, I also encountered the object already exists thing, but besides that it appears to run smooth and nice. The sounds are nice too and I'm glad you like the HUD.


A mod has been erased by your signature because it was larger than 600x120
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 9th Dec 2007 23:28 Edited at: 9th Dec 2007 23:34
@ Anyone expecting more updates
At last, I am back, from my 10 hours non-stop school-working experience. >_<

"I'm a little shaken but I think I can return to work on MTM."

@ tha_rami
Oh, that is odd? I thought I took it out and it worked.

Hmm, well I'll run a few more tests to see if it still doesn't work.

EDIT:
I ran the tests and everything is working fine, please check you have the new version, or simply download it again to make sure.

(Oh and when might I recieve the new images for the inventory and messagebox?)

@ Everyone else
If anyone else is still having the problem please tell me.

New update
The next update will change the primary fire to control and the secondary will eventually become shift. This is due to the fact that space is now jump and for some reason works for me. :S I don't really know why.

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 10th Dec 2007 00:50
I can't play the demo... Downloaded it but I can't run it on vista and I can't figure out how to get DX9.0c to work... But it looks great.

I think your necklace idea would be cooler if, instead of just being able to buy the crystal necklace with all the effects, you could combine the other necklaces to make the crystal necklace, or just combinations where if you have say a stone necklace and a gold necklace you get both of the effects and one other one, and you can just keep combining until you get the ultimate necklace, which would be the crystal one...

C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 10th Dec 2007 01:23
@ demons breath
Hmm, well I can't do anything about it not running on Vista, but search around the forums, there is bound to be something on DX9.0c working on Vista.

And I like the idea of combinations of necklaces, its just I am trying to keep the inventory simple by only having 3 slots. This is due to the fact that on previous RPGs I spend all my time working on the items/inventory stuff and don't get any game made.

I will keep it how it is for now, but maybe one day in the future I may change it to your suggestion. Thanks.

Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 10th Dec 2007 02:30
No one understands why I think DBP is so much different from DBC. I started on DBC and tried to migrate to DBP. I hated it.

Inspire
17
Years of Service
User Offline
Joined: 23rd Dec 2006
Location: Rochester, NY
Posted: 10th Dec 2007 03:12
I started with DBP, and am loving it.

tha_rami
18
Years of Service
User Offline
Joined: 25th Mar 2006
Location: Netherlands
Posted: 10th Dec 2007 12:22 Edited at: 10th Dec 2007 12:41
It works perfectly on Vista. Heck, I use Vista Home Premium, Home Basic and Ultimate on three different PC and it runs on all of them.

Your images, right away sir. In the format that noone uses: RAR!


A mod has been erased by your signature because it was larger than 600x120

Attachments

Login to view attachments
Bizar Guy
19
Years of Service
User Offline
Joined: 20th Apr 2005
Location: Bostonland
Posted: 10th Dec 2007 17:02 Edited at: 10th Dec 2007 17:05
Quote: "Yep you did die, and the game won't really exit when you die, it just has nothing else to do when you die, and rather than having the program carry on I let it end so you know something happened.

And the camera movement isn't sensitive, if you have your mouse sensativity lower. I will make an enterable sensitivity-factor in the options menu at some point. - And what do you mean, "if I tone it down a bit you can have it constantly free moving?"

I would also prefer not to have the talk button as the attack button too because what happens if you run into town being followed by something and you run near a guy and turn round to shoot the enemy? You'd end up talking to the guy instead. I've seen examples of trying to make programs easy to use before in quite a lot of "commercial games" and frankly it ends up annoying you when you try to do something and it doesn't do what you want it to do. - If we all know that shift fires and left-mouse activates objects then no one will get confused and you'll be able to do things like pickup health and mana while shooting something.

And what do you mean my gravity is loose? The gravity is fine."



1: When you die, exiting the program is the worst solution, because I have no desire at all to start it up again, because in my mind the game is over. It'd make a lot more sense if you had a die screen, and then went back to the main menu. Most people wont realize they died if the program exits by itself. You see, usually that means there was an error.

2: the mouse IS sensitive (unless you have a ridiculously slow mouse, because I even tried it with the mouse set slow. It's good you're giving sensitivity options, but the norm IS sensitive), as many people have noticed. Some have commented on it going out of control, that is because a slight movement of the mouse made it go a full 360 and because of the camera smooth it just looked like it was jerking randomly. What I meant was that it feels a lot better when the camera moves just by moving the mouse, at least with this type of camera. So if it weren't so sensitive, you wouldn't need a mouse button to activate camera control, it could just always be activated.

3: Having those buttons separate is fine. If you want to make them the same button you'd have to plan out your gameplay a bit better so that you wouldn't come into situations where talking to someone would interrupt a fight. It was just a suggestion, you don't have to do it. I was just pointing out that a lot of games do, to make things simple for the player. As for picking up mana and that stuff, personally I would make it so you pick it up just by walking into it. This makes everything simple. I originally missed picking up a few items because I didn't realize I wouldn't pick them up automatically. You see, with all of this I'm just saying you could make your controls a lot more efficient if you wanted to. If you'd rather stay with what you have right now, that's totally fine.

And last (this is what made me think "he's probably mad at me"), Yes, your gravity is loose. It's like he's falling in slow motion, just like almost every indi platformer. don't be offended, it's just a fact. You don't have to change it. What I don't get is that you said you were having gravity issues, so I tried the demo where you said you were having them and everything was fine with it except that the gravity was slow, which I fully expected. So why are you so thouchy about it?


I'll admit I was a bit mad when I responded to you, but I'm almost positive you didn't mean to sound angry. It's probably just a misunderstanding on my part, so I tried not to post angrily. I hope I succeeded.

And so you know, I'm not exactly a noob to gameplay design, I have a good idea what I'm talking about. So please don't think I'm making suggestions without any reason, I ALWAYS try and be as helpful as I can after trying a demo, and personally I think crit is a lot more helpful then just saying "good job!" (which I think I did say as well).


Superman wears Chuck Norris PJ's
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 10th Dec 2007 17:05 Edited at: 10th Dec 2007 17:37
@ CGJ
Hehe, I didn't think highly of DBC when I first saw it. But that was a long way into my usage of DBP. I think I'll stick with DBP because I know what it can do and what it can't.

@ tha_rami

Thanks man, the pictures are brilliant, I'll most definately be using them

And I'm on XP because I don't trust Vista yet (Or have a PC capable of running it (Or actually have it.).).

So basically, sorry to anyone that it doesn't work on due to you being on Vista, I really can't do a thing about it.

@ Bizar Guy
The main reason for having no die screen is because the game is not finished. - I have no other reasoning, but there would obviously be one eventually. <Done.>

I will change it so you don't need to hold the right mouse button to move the camera. The mouse sensitivity will be set in the options as I said but for the moment you can enter a custom sensitivity by pressing V in game. (1 would mean no change, 2 would mean it is twice as slow, 4 would mean 4 times as slow. And so on...) <Done.>

I will change it so that you can just walk into pickups to pick them up. The buttons will remain as control to 1st fire, shift to 2nd fire and space to jump. <Done.>

The only reason the gravity is loose is because I needed to get it so the jump-force and the gravity-force ratio was right to allow the user to jump high enough that it would be useful but not high enough that it was stupid. - The other reason the gravity is so loose is because the program automatically lags when you are falling due to the 2 sc_intersectobjects the program has to run to detect the floor and the ceiling. Normally the program would be laggy all the way through because it would be constantly running these commands but I change it to only do the ceiling detection when you are above the floor. The reason for the slow jumping and falling because of a reduced frame rate. I will change the ratio of the gravity to jump-force though. <Done.>

If you would like, you could suggest how to do this without lagging the program, seeming as no one else seems to be able to help with that part.

I was slightly mift (angry) last time I posted, in the respect that the main problems with this program is in the jumping and gravity and every time it cocks up I have to sort it out again. I had it stable and then you complained about it again, so I was reluctant to change it.

Don't worry though, I know about taking critisisms as positive support, I was just a bit hacked off because this stupid gravity engine I have is so complicated and doesn't work properly.

No hard feelings

EDIT:
Updated what I have done of the above^.

Bizar Guy
19
Years of Service
User Offline
Joined: 20th Apr 2005
Location: Bostonland
Posted: 10th Dec 2007 17:25 Edited at: 10th Dec 2007 17:26
K, thanks for all that.

How are you doing gravity anyways?

This is how I do mine (ignore the different object numbers, it's because my stuff is a bit complex):

plrx#=object position x(2) : plry#=object position y(2) : plrz#=object position z(2)

plrgrav#=plrgrav#-0.55

plry#=plry#+plrgrav#

position object 1,plrx#,plry#,plrz#


And I haven't switched to sparky's yet so I'm using the natibve dbccollision still, which goes like this:

if object collision(1,0)>0
dec plrx#,get object collision x()
dec plry#,get object collision y()
dec plrz#,get object collision z()
if get object collision y()<>0:plrgrav#=0:endif
endif

That gravity code doesn't work with the native dbpro collsion though, and really the native dbpro collsaion is quite bad. It does work with sparkies though


Superman wears Chuck Norris PJ's
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 10th Dec 2007 17:40 Edited at: 10th Dec 2007 17:40
@ Bizar Guy
Well the gravity seems to be a bit more complex than that, in the respect that it also has included, the jump code and the movement (X,Z) code, all in 1 big section.

See what you make of it:


I would like to think I could use the code you just gave me, but I'm not entirely sure it if includes everything I need (the ceiling mainly) and how I would do it using Sparky's collision DLL.

Bizar Guy
19
Years of Service
User Offline
Joined: 20th Apr 2005
Location: Bostonland
Posted: 10th Dec 2007 22:14 Edited at: 10th Dec 2007 22:32
For celing collision have an invisible colission box above the head. if there's any collision with is, make plrgrav#=-1 or anything below zero.

make object cube #,0:set object collision box #,-1,0,-1,1,1,1,1

position object #,plrx#,plry#+10 (this number just has to be above your caaracter),plrz#
if object collision (#,0)>0:plrgrav#=-1:endif

that's what I do anyways, it works pretty well, though I may change it once I start using sparkys.

For jumping, at it's most basic it's just say:

If spacebar()>0 and plrgrav#=0:plrgrav#=4:endif

I'm only giving the most basic stuff, there's a ton more you can add, and I use multiple object for complex movement that uses multiple angles, because I'm using mouse movement. Do this if you want to have the game feel a bit more proffetional:

If spacebar()>0 and plrgrav#=0 and hitkey=0:plrgrav#=4:endif

if spacebar()=0 and plrgrav#=0:hitkey=0:else:hitkey=1:endif

But for really nice jump, you want the leangth you hold it to determine the hight. Here's my gravity code, minus stuff that doesn't pretain to gravity. This also includes a double jump mechanic. This is part of a program still in the early stages, and so is not very organized yet.

if (mouseclick()=1 or mouseclick()=3) and plrgrav#<=0 and plrgrav#>-2 and jumpcheck=0 and clickhold=0
jumpcheck=1
if djump1#>0:plrgrav#=10:djump1#=0:else:plrgrav#=1:jump=4:endif
endif
if jump>0
dec jump
if jump=4 and plrgrav#>0 and (mouseclick()=1 or mouseclick()=3) then plrgrav#=1
if jump=3 and plrgrav#>0 and (mouseclick()=1 or mouseclick()=3) then plrgrav#=2.4
if jump=2 and plrgrav#>0 and (mouseclick()=1 or mouseclick()=3) then plrgrav#=3.8
if jump=1 and plrgrav#>0 and (mouseclick()=1 or mouseclick()=3) then plrgrav#=5.2:thudd=1
if jump=0 and plrgrav#>0 and (mouseclick()=1 or mouseclick()=3) then plrgrav#=6.6:djump1#=6
endif

if plrgrav#<-0.6:thud=1:endif
if plrgrav#=0:jumpcheck=0:endif

`Double Jump Specifics
if djump1#>0 and plrgrav#=0:djump1#=djump1#-tframe#:endif:if plrgrav#<-7:djump1#=0:endif


And here's the clickhold bit so you understand:

if (mouseclick()=0 or mouseclick()=2):clickhold=0
else
if clickholding>0:clickholding=clickholding-1:clickhold=1
else
if mouseclick()=1 or mouseclick()=3 and clickhold=0
clickholding=3
endif
endif
endif


The code you've just shown isn't just your gravity, that's also your movement and collision, which are seperate. I'm generally bad at reading other peoples code. I don't know if it's because mine is really organized,, of if it's just too different. But it seems to me you're cealing code is overkill and that's why it's slowing down. The solution I gave is pretty simple, and extremely fast, unless for some reason you're having trouble with objects on screen. I'm sure that there are people here with better code, but I can garentee the results of this are very nice.


Superman wears Chuck Norris PJ's
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 10th Dec 2007 22:33
@ Bizar Guy
Well, I am aparently not good at reading other peoples code either, for I too feel mine is organised. But none-the-less, I took what I needed and I have used the idea of having a cube above the character to detect the ceiling and it worked. Thank you so much for all your troubles and putting up with me, but in payment you can know that this game will now run at a stable FPS all the way through. Thank you again.

Bizar Guy
19
Years of Service
User Offline
Joined: 20th Apr 2005
Location: Bostonland
Posted: 10th Dec 2007 22:40
No probs. I think everyone thinks their own code is organized, because we all think the way we code... or something like that.


Superman wears Chuck Norris PJ's
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 10th Dec 2007 22:46 Edited at: 11th Dec 2007 00:20
I agree.

Infact I remember specifically telling someone that I didn't want to lay my code out like that because that's not the way I thought about it. (But I later realised that it was more beneficial to because it was more efficient than my previous layout.

Behold, the next installment of the gravity problem:

Ok so now the gravity and jumping are as efficient as I can personally make them but after 3 tries tonight I can't see a way to completely get rid of the sc_intersectobject command. I got rid of the one for the ceiling, but the floor one, seems to depend on it, and the jumping simply doesn't work without it.

I tried doing what I did with the ceiling, and just put another object underneith but it either detects collision with the player, allowing you to jump endlessly into the sky, or nothing because it simply won't detect the 1-polygon-thick map, without detecting the player as well (and because the player is object 1, which comes before the map, object 4, it detects the player first in all situations.)

Here is my very neat code I've reduced it all to:


Can anyone help me this time?

tha_rami
18
Years of Service
User Offline
Joined: 25th Mar 2006
Location: Netherlands
Posted: 11th Dec 2007 01:36
No problem about the images, c0wbox. Screenshot!


A mod has been erased by your signature because it was larger than 600x120
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 11th Dec 2007 01:45
Wow this is a hot thread. I like how fast it's coming along.

On an offtopic note, rami, you need to come over to the posting comp and save me!


"Ok, so that wasn't funny. I don' have any good Christmas jokes."
Bizar Guy
19
Years of Service
User Offline
Joined: 20th Apr 2005
Location: Bostonland
Posted: 11th Dec 2007 06:06 Edited at: 11th Dec 2007 06:07
Well cowbox, the method for the head hitting doesn't work with the ground collision.
This is what I use, but be warned your gravity might stop working as you're using dbpro. I really recommend sparkys. That's what I'm converting to.

plrx#=object position x(1) : plry#=object position y(1) : plrz#=object position z(1)

position object 1,plrx#,plry#,plrz#

if object collision(1,0)>0
dec plrx#,get object collision x()
dec plry#,get object collision y()
dec plrz#,get object collision z()
if get object collision y()<>0:plrgrav#=0:endif
endif


if "if get object collision y()" part is the part that stops the gravity from continuing forever, and the "dec plry#,get object collision y()" is that part that makes sure that you're not colliding with the object below you.


Superman wears Chuck Norris PJ's
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 11th Dec 2007 09:19
@ tha_rami
They are coming, don't worry. And so will a new version if I can get all this jumping sorted out.

@ Bizar Guy
I tried implementing that code into the game and I can't seem to get around the fact that you can jump continuously. It seems that the player is either colliding with the map (so I changed the commands to Sparky equivelants) or itself. (Which I can't get round.)

What exactly is this code doing? I tried to understand it, but I don't think I'm taking out the right commands from my code, or putting the right ones in.

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 11th Dec 2007 13:20
I liked it too.

I didn't die (though one mushroom spawned right in front of me and ate 1/3 of my hp)

And the green arrow is your experience right? Man it's hard to rise a level...

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 11th Dec 2007 16:42 Edited at: 11th Dec 2007 22:37
@ Sven B
Oh no, hehe, the Green-arrow-bar is your level, but I will change it to experience and have your level shown as a number. (Just because that is how most RPGs do it.)

EDIT:
Just to confirm, I have done that^.

@ Anyone who can help

I am still unable to get my gravity and jumping working both efficiently, and properly. I've tried using sc_intersectobject, I've tried putting an object underneith for detection, I have tried raycast. - All 3 have some problems. With the sc_intersectobject, it is the speed, with the object, it is that the gravity doesn't work in terms of a simple, is there floor there or isn't there floor there, it needs a distance. This is also why the raycasting doesn't work, but I was able to get further with them, its just the character sinks into the floor until it hits the collision sphere, when walking up a ramp or into a house. (Which is most annoying because it makes it look really bad.)

C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 12th Dec 2007 23:41
Just to alert people:

Due to this gravity problem which I can't overcome, motivation is being lost for this game.

This is bad for WIP followers as I have a habit of changing projects when I lose motivation.

I don't want this to happen to Marvin the Magician but it will if someone can't help me with this gravity situation. - I have tried all I can (3 different methods) and I am still in the same place with it.

Please can someone help?

tha_rami
18
Years of Service
User Offline
Joined: 25th Mar 2006
Location: Netherlands
Posted: 13th Dec 2007 01:20
This is also why the raycasting doesn't work, but I was able to get further with them, its just the character sinks into the floor until it hits the collision sphere, when walking up a ramp or into a house. (Which is most annoying because it makes it look really bad.)

Can't you retrieve the angle of the hill and have Marvin lean over appropriately?


A mod has been erased by your signature because it was larger than 600x120
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 13th Dec 2007 01:27 Edited at: 13th Dec 2007 01:28
@ tha_rami
It's unlikely I could get the angle of the hill. And if I could, would this be achieved quickly in 1 CPU cycle?

And anyway, even if I knew the angle, he would still sink into the floor.

The only real way out of this is either, a faster intersect command (which would be hard, being that I'm probably using the fastest there is) or some way of lowering the collision box of the object (which I tried (by modeling the object physically higher) and it didn't work.)



Bizar Guy
19
Years of Service
User Offline
Joined: 20th Apr 2005
Location: Bostonland
Posted: 13th Dec 2007 01:46 Edited at: 13th Dec 2007 01:49
if your character is continuously jumping, that would seem to mean you're relating the jump code to the collision, which you shouldn't do at all. And I garentee a box on the bottom will not work for ground collision. It works for head collision because all it does is push you down. If you try and push up and the gravity is pushing down, you'll hop. And since your're gravity falls a bit faster than 0, you'll sink if you don't add some sort of collision.

The collision I showed, the "dec plry#,get object collision y()" basicaly finds the edge of what you're colliding with and puts you on top of it. the "if get object collision y()<>0:plrgrav#=0:endif" just stops you from falling until the rate you fall is so great the change in object position each turn gets large enough that you get positioned below the floor before the collision takes effect. I'm not really sure exactly how the "dec plry#,get object collision y()" works unfortunately, so I can't really break it down more than what I said and that it is sliding collision. If I was using sparkys yet I could help you more, but sorry.

But shame on you if you quit this project just because you got stuck. So? There are tons of people on the forum who know a lot about collision. Post a thread in the dbpro board and post your code. Work on a nother part of the game if you have to. Optimise your code. But just quiting isn't fair to yourself.


Superman wears Chuck Norris PJ's
C0wbox
18
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 13th Dec 2007 16:52
@ Bizar guy
I don't want to quit, its simpley that if no one can help then I can't progress and the project won't get done.

I kind of see what your code is doing, its just I don't know how that is achieved with Sparky's collision DLL (to allow an object to collide with another's polygons, not its bounds (player to the map, rather than the top of it.).)

I am simpley waiting on someone to help me because I can't see a way this can be achieved. - DBP simpley doesn't do what I want it to.

Login to post a reply

Server time is: 2024-11-23 08:38:39
Your offset time is: 2024-11-23 08:38:39