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.

AppGameKit Classic Chat / Snippets : 3D Fake Starfield

Author
Message
Crystal Noir
AGK Bronze Backer
13
Years of Service
User Offline
Joined: 7th Sep 2011
Location: France
Posted: 7th Sep 2011 12:32
Hey guys

I've done my first code with AppGameKit today This is a code I written several times in other languages. I would like to translate it for you.

This is a 3D fake starfield. With some maths, we create a z coordinate that is a fake one and we make a projection to show the stars like a 3D starfield.

This effect looks like amiga style

I provide you a zip file (see file attachment) in this topic, with the entire project.

Just, open it, compile it and have fun with it

Happy AppGameKit !

Attachments

Login to view attachments
RickV
TGC Development Director
24
Years of Service
User Offline
Joined: 27th Apr 2000
Location: United Kingdom
Posted: 7th Sep 2011 15:18
Love it! Takes me back to the 1980s and playing Star Raiders.

Great to see how fast you made this since you only had AppGameKit 1 day!

Rick

Financial Director
TGC Team
Crystal Noir
AGK Bronze Backer
13
Years of Service
User Offline
Joined: 7th Sep 2011
Location: France
Posted: 7th Sep 2011 15:33
Thank you

Yes but I know this snippet because I code it in other language, first in pure, and on xna, etc... So, to start learning AppGameKit, I tries to translate my code on it

This is inspired from a code I found several years ago (may be 10 years ago now) that was for a language I doesn't remember the name. I have re-wrote and personalized it for my personnal uses, and now, this snippet follows me everywhere

I'm happy if you love it

Thx !

PS : sorry for my aproximate english lol
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 7th Sep 2011 17:53
Could you post an screenie of the star field ?

Will probably download it later on and check it out
Crystal Noir
AGK Bronze Backer
13
Years of Service
User Offline
Joined: 7th Sep 2011
Location: France
Posted: 7th Sep 2011 19:53
I can try to make a screenie of it, but in fact you will see just a starfield with small flare sprite. The aim of the code is the movement that simulate a depth.

So it's difficult to show the result with a screenie
DennisW
16
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 7th Sep 2011 20:04
Thanks Crystal Noir

This gives me something to play with. I haven't done much of anything since I bought it.

Dennis W

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 9th Sep 2011 16:53 Edited at: 9th Sep 2011 18:38
lol SWEETNESS!

I added a thruster...


      if GetPointerState() = 1
            speed# = speed# + 0.01
            if speed# > 1.9 then speed# = 1.9
      else
            speed# = speed# - 0.01
            if speed# < 0.01 then speed# = 0.01
      endif

...use the left mouse button to thrust.


Quote: "Could you post a screenie of the starfield?"


Here is a video that shows his example with the thruster effect thrown in ...



Euphoria
18
Years of Service
User Offline
Joined: 21st Feb 2006
Location: United Kingdom
Posted: 9th Sep 2011 20:26
To give it a bit of polish, although I suspect it cant be good for performance, add the following straight after the SetSpritePosition command (line 62) to fade the stars from far to near....

Euphoria
18
Years of Service
User Offline
Joined: 21st Feb 2006
Location: United Kingdom
Posted: 9th Sep 2011 23:58 Edited at: 9th Sep 2011 23:59
Here's another version modified for some mouse movement. You wouldn't have originally got it from a Blitz Basic website would you? I published starfield code based on this a number of years ago.
But it is pretty common so prob not mine

Attachments

Login to view attachments
DennisW
16
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 11th Sep 2011 13:01 Edited at: 11th Sep 2011 13:04
I added a hud see pic Some one like to add meteors or laser

Dennis W

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed

Attachments

Login to view attachments
DennisW
16
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 11th Sep 2011 13:06
Here is the zip

Dennis W

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed

Attachments

Login to view attachments
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 11th Sep 2011 18:36 Edited at: 11th Sep 2011 19:02
lol
These modifications are really cool guys.
If we keep it up this will end up being a game instead of just an example of a starfield.
Here is my latest mod, in which I added side movement, but I used a different approach than Euphoria. (I stayed with Crystal Noir's orginial variables)
I also added a virtual joystick.
Up = speed up
Down = slow down
Right = bank right
Left = bank left



Crystal Noir
AGK Bronze Backer
13
Years of Service
User Offline
Joined: 7th Sep 2011
Location: France
Posted: 11th Sep 2011 20:37
Happy that my first snippet make you create some things with !

Very cool modifications
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 11th Sep 2011 22:40
I could not help it, had to make my own mod...



Sources attached.

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.

Attachments

Login to view attachments
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 13th Sep 2011 17:37 Edited at: 13th Sep 2011 17:46
Quote: "I could not help it"

Yes you could!

Quote: "I added a hud "

Very nice!

I did one too... see attached
I decided to build a space shooter based off of this.

Attachments

Login to view attachments
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 13th Sep 2011 17:42
Use this bit for the space section and my Hot Lap engine for the trench section and you're not far from a Star Wars remake!
Euphoria
18
Years of Service
User Offline
Joined: 21st Feb 2006
Location: United Kingdom
Posted: 13th Sep 2011 18:02 Edited at: 13th Sep 2011 18:03
@Conjured Entertainment

Make sure its small. AppGameKit has a number of significant bugs including one that means you cannot write large programs (Teir 1) at the moment, not to mention it is not adhering to its 'Deploy effortlessly to multiple platforms' statement. Waiting for things to be fixed up before spending anymore time on it.

Good luck with the shooter
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 14th Sep 2011 02:12 Edited at: 15th Sep 2011 00:30


Quote: "Make sure its small."

Okay, I'll make sure to use less enemies than stars.

Quote: "AGK has a number of significant bugs including one that means you cannot write large programs (Teir 1) at the moment, not to mention..."

Okay, I won't mention it then, and I'll make sure to remember that AppGameKit is not unlimited.

Quote: "Waiting for things to be fixed up before spending anymore time on it."

You do that then, but I have to get #3 finished.

Thanks for the advice.

Edit
My recent additions...
A minimap that has the players ship so far, which still needs some tweaking on the turns, is at the top.
I also made an indicator for the ship's force field shield, which will disappear as the shield's enery goes down.



Psycho Psam
16
Years of Service
User Offline
Joined: 3rd Apr 2008
Location: Western Australia
Posted: 18th Sep 2011 03:53 Edited at: 18th Sep 2011 03:54
Wow I love this thread. Kinda like one of those story threads but cooler. I think I'll grab this and make a Star Trek arcade game clone.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 18th Sep 2011 14:47 Edited at: 18th Sep 2011 18:14
Quote: "I think I'll grab this and make a Star Trek arcade game clone."

I never remembered those stars being like that, but the ones in the background are interesting.
I may have to modify the starfield now to get that effect, because I am lacking the realism of the turns.
Nice video, and good luck with your project.


I have installed a homing device on my enemy ships for the minimap.
They now home in on the players ship, so all I have to do is work out the FPS view of the ships and get the weapons going.
Then, it is on to the display of the ammo and counters.
I'll add in my sound effects last.
Maybe TGC will have the publishing in place by the time I finish this one, because it will be awhile before I finish.
The real world has once again spoiled my plan, so I have to take a 1 week break from AGK.

Login to post a reply

Server time is: 2024-11-24 12:19:56
Your offset time is: 2024-11-24 12:19:56