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.

The 20 Line Challenge / My first 20 liner.. GraviSpheres

Author
Message
Nicholas Thompson
14
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 16th Nov 2004 07:04 Edited at: 16th Nov 2004 07:06
This is based on the physics "engine" used in GraviKill (see my WIP post)..



It weighs in at 19 lines, although most lines are stacked. I THINK I have kept within the rules here, please let me know if I havent!!

Anyway, THIS piece of code (ie these settings) give me 922+ FPS.

SETTINGS:
PLANETS: These are the attracting entities.. Currently set to 5..
ASTEROIDS: These are the flying green things. Currently set to 40
PLANET MASS: Currently set to 0.1.
ASTEROID MASS: Currently set to 0.001.
GRAVITY EFFECT: On the end of the line "Grav# = ASTEROIDMASS# * PLANETMASS# * (Dist#^2.0) * 0.1", the 0.1 represents the effect or power of the gravity field. It is sort of the speed of the simulation.
CAMERA ROTATION: Firstly, the code "inc angle#, frameTime# * 0.045" determines the speed of the camera rotation. Currently it is 45 degrees per second. Fortunately it is an easy formula.. 360 degrees per second is 0.360.. 90 per second is 0.09. If you cant guess the formula by that, its degree's per second divided by 1000
THEN, the positioning commands (for camera and light).. Change the factor for X Y and Z.. These are the radius on that axis. By default, the camera and light go +-100 in the X and Z axis and +-20 in the Y. The camera is always pointing at 0,0,0.

I think thats everything.. LET ME KNOW WHAT YOU THINK!!

[EDIT] Screeny attached...
[EDIT2] Screeny show!!



Attachments

Login to view attachments
Nicholas Thompson
14
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 16th Nov 2004 10:07
For those interested - I tried this on 1000 asteroids. It dropped down to a steady 55fps. But is looked REEEEEEEAAAAALLLY cool

Mx5 kris
14
Years of Service
User Offline
Joined: 9th Oct 2004
Location:
Posted: 16th Nov 2004 10:13
sweet! rating : 9/10 NOONE GETS A PERFECT 10!!!MUAHAHAHH!ah...you can have it 10/10

Nicholas Thompson
14
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 16th Nov 2004 10:51 Edited at: 16th Nov 2004 10:54
Now i'm going to sleep a happy unemployed person

[EDIT]
A "happy unemployed person" with a new screeny of the 1000 asteroids



Attachments

Login to view attachments
IBOL
Retired Moderator
15
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 17th Nov 2004 01:01 Edited at: 18th Nov 2004 11:03
that is actually really cool!
now I want to do a 20 liner.
how is gravikill?
unemployment is good.

[EDIT] ooh ooh now i did it!
my own 20 liner,
20 line asteroids.
its a full game with progressively harder levels,
shield bonuses, particle effects, and it generates its own media.
http://forum.thegamecreators.com/?m=forum_view&t=42818&b=11

bob

Nicholas Thompson
14
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 17th Nov 2004 01:36
Hehe.. Gravikill is on hold for a few days while I sort some stuff out.. Unemplyment is.. well.. uncannily like unemployment!! Lol..

JerBil
15
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 17th Nov 2004 02:56
Nick, that's really cool. Those asteroids look like insects, how about doing a swarm of something with a little ai?

-JerBil
Attreid
16
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 17th Nov 2004 04:46
hey, a very good one :p
the most interresting thing (for me) is that the asteroids and planets stay in the screen .. how did you do that ?
did you set their speed so that the total kinetic energy on each axes is null ?

"He will come...the voice from the outer world,
bringing the holy war, the Jihad, which will cleanse the Universe and bring us out of darkness."
Nicholas Thompson
14
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 17th Nov 2004 09:57
@Gerbil.. AI? Its a 20 line demo showing gravity effects of object, dont think I could get any AI in there even if I knew what you meant

@Attreid: Cheers.. I did not such thing to keep them on the screen, in fact the often go off for me! Basically, I just tweaked the code so they all kept fairly close.. You could make the gravity do less, possible by making the planets mass less?

JerBil
15
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 18th Nov 2004 07:34
@Nick: Yeah, I know, it just looks like a swarm, and in another program, it might be useful...or not! Sorry...

-JerBil
Nicholas Thompson
14
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 18th Nov 2004 07:52
Hehe no need to appologise!

I was slightly confused by what you meant.. But yes, it is quite swarm like.

I was playing with the code.. It could be possible to modify this so the "particles" have a speed when released (rather than starting from standstil).. And if there is only 1 attractor.. I think you might see where I'm going with this (particles.. attractor).. I think we might have ourself a little particle engine.. That does.. wierd.. non-particle like stuff..

Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 19th Nov 2004 12:18
That's excellent!! You didn't happen to do a remmed version, before I break it apart to study it, did you? I did something similar to this recently, although I had real problems balancing gravity with speed - either the satellites moved way too fast, or they went slow but got sucked into the planets. Your's works really nicely, though.


Nicholas Thompson
14
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 19th Nov 2004 20:57 Edited at: 19th Nov 2004 20:57
This isn't remarked, but its easier to read. IT also has a few more features. By changing the value of "a#" near the top, you can change the blurring effect.

This is the version in the WIP forum.



Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 20th Nov 2004 10:04
Thanks Nick - that is easier to read!


shadow sliver
14
Years of Service
User Offline
Joined: 28th Nov 2004
Location:
Posted: 28th Nov 2004 07:33
Can you compile that, for us unfortunate DBC users?
Ilya
15
Years of Service
User Offline
Joined: 10th Aug 2003
Location:
Posted: 8th Dec 2004 09:07
Hmmm.... what's wrong with this code:


Quote: "I've seen the word programming and I'm not sure what it means. Anybody please explain?"


Quote: "We shouldn't sacrifice the truth to preserve "balance"."
Nicholas Thompson
14
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 9th Dec 2004 03:45
Ok.. I'm not ENTIRELY sure what you're trying to do with the code here.. Lol.. BUT I have managed to modify you code to allow planet deletion by clicking on it.


I have remarked out the moving of the planets based on camera position as I'm not sure why you were doing that and I wanted to leave something for you to do Hehe..

Hope this helps!!

I'll try to get an EXE up for this asap.

Why wont it compile in DBC btw? I dont think i've used any unusual commands have I? (I dont use/have never used DBC)

Nick

PS: Cheers for all the nice comments

blanky
14
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 21st Dec 2004 02:14
Version for the poor sods (me included) who're stuck with DBC:



Basically, you can't use the inc command on arrays in DBC, and 'Make Object Sphere' only has a radius argument, rather than X-radius, Y-radius and Z-radius or whatever it actually is.

Nicholas Thompson
14
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 22nd Dec 2004 18:00
In DBP, the Sphere command in that form is:

Make Object Sphere ID, Radius, Rows, Columns

Or something like that.. Basically it how many times its split in the X and Y directions.

Login to post a reply

Server time is: 2019-06-25 16:31:54
Your offset time is: 2019-06-25 16:31:54