SÖLAR, a fairly simple solar system simulator

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
Ubermann
Party member
Posts: 146
Joined: Mon Nov 05, 2012 4:00 pm

SÖLAR, a fairly simple solar system simulator

Post by Ubermann »

FsTOy.png
FsTOy.png (14.24 KiB) Viewed 649 times

New and planned features shown in the app itself in the help pannel.

DOWNLOAD IT HERE:
(direct link to .love attachments)
Version 0.91
Screenshot here
download/file.php?mode=view&id=6152


Additional credits to:
Saegor: realtime stars algorithm


More to come.

Enjoy.
Attachments
solar.love
0.91
(42.04 KiB) Downloaded 666 times
Last edited by Ubermann on Thu Nov 22, 2012 4:39 pm, edited 4 times in total.
User avatar
Saegor
Party member
Posts: 119
Joined: Thu Nov 08, 2012 9:26 am
Location: Charleroi

Re: SÖLAR, a fairly simple solar system simulator

Post by Saegor »

nice !

[... bla bla ...]
Last edited by Saegor on Mon Nov 26, 2012 5:59 pm, edited 1 time in total.
Current work : Isömap
User avatar
Ubermann
Party member
Posts: 146
Joined: Mon Nov 05, 2012 4:00 pm

Re: SÖLAR, a fairly simple solar system simulator

Post by Ubermann »

Saegor wrote:nice !

i wrote a bit of code for your stars (if you want)

EDIT : new code

etc etc etc
Cool.

I added it to the my original code.

I gave the option to switch between three background modes: "black background", "static image background" and "realtime stars background", because for slow or old computers your realtime stars may cause slowdows, so the "player" can choose which mode to use.
Also I changed the "hide orbit lines" to "change orbit lines translucency".

blah blah blah read down.
User avatar
Ubermann
Party member
Posts: 146
Joined: Mon Nov 05, 2012 4:00 pm

Re: SÖLAR, a fairly simple solar system simulator

Post by Ubermann »

Tweaked version released with:

- Saegon realtime stars, rotating static starfield and all-black background
- Some GUI changes
- Added help pannel and simple app logo
- Some serious code changes
- Initial implementation of mouse support
- Tooltips when hovering mouse over any plater (more planet info will come ofc)
- Some slightly speed improvements
- Maybe something else I can't remember now.

Details in 1st post.
User avatar
Saegor
Party member
Posts: 119
Joined: Thu Nov 08, 2012 9:26 am
Location: Charleroi

Re: SÖLAR, a fairly simple solar system simulator

Post by Saegor »

New version of Sölar space background.

Changelog :
- important changes codewise : now 3 files (main.lua, stars.lua, comets.lua)

main.lua

Code: Select all

function love.load()

	gr = love.graphics
	getW = gr.getWidth()
	getH = gr.getHeight()
	
	require "stars"
	require "comets"
end

function love.update(dt)

	stars:update()
	if comet.e then comet:update(dt) end
end

function love.draw()

	stars:draw()
	if comet.e then comet:draw() end
end

function love.keypressed(key)

	if key == "escape"
	or key == "return" then
	
		love.event.push("quit")
	end
	
	if key == "tab"
	or key == " " then
	
		comet:new()
	end
end
stars.lua

Code: Select all

stars = {}

for i = 1, 0x400 do

	stars[i] = {}
	
	stars[i].x, stars[i].y, stars[i].n =
	
		math.random(0, getW),
		math.random(0, getH),
		math.random(0, 0xff)
end

function stars:update(dt)

	for k, _ in ipairs(self) do
	
		local m = math.random(-0x08, 0x08)
	
		self[k].n = self[k].n + m
		
		if self[k].n < 0x10 then
		
			self[k].n = 0x10
			
		elseif self[k].n > 0xff then
		
			self[k].n = 0xff
		end
	end
end

function stars:draw()

	for k, _ in ipairs(self) do
	
		local c = self[k].n
		gr.setColor(0xff, 0xff, 0xff, c)
		gr.point(self[k].x, self[k].y)
	end
end
comets.lua

Code: Select all

comet = {}

for i = -10, 10, 4 do

	table.insert(comet, i)
end

function comet:new()

	self.e = true
	
	self.dx = self[math.random(#self)]
	self.dy = self[math.random(#self)]

	if math.random(2) > 1 then

		self.x = getW/2 - self.dx/math.abs(self.dx) * getW/2
		self.y = math.random(0, getH)
	else

		self.x = math.random(0, getW)
		self.y = getH/2 - self.dy/math.abs(self.dy) * getH/2
	end
end

function comet:update(dt)
	
	self.x = self.x + self.dx * dt * 0x40
	self.y = self.y + self.dy * dt * 0x40

	if self.x < - getW	or self.x > getW * 2
	or self.y < - getW	or self.y > getH * 2 then
	
		self.e = nil
	end
end

function comet:draw()

	for i = 16, 1, -1 do
	
		local c = 0x80/i
		
		gr.setColor(0xff, 0xff, 0xff, c)
		
		gr.line(
			self.x, self.y,
			self.x - i * self.dx, self.y - i * self.dy
		)
	end
end
space.love
license is public domain
(1.13 KiB) Downloaded 221 times
press tab or space to see a comet
Last edited by Saegor on Mon Nov 26, 2012 6:00 pm, edited 11 times in total.
Current work : Isömap
User avatar
qaisjp
Party member
Posts: 490
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: SÖLAR, a fairly simple solar system simulator

Post by qaisjp »

looks quite nice, actually.
Lua is not an acronym.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests