Skip to content

Instantly share code, notes, and snippets.

@croxis
croxis / basic.py
Last active February 4, 2021 15:41
CEFPython for Panda3D
from cefpython3 import cefpython
import os
import sys
from panda3d.core import loadPrcFileData
loadPrcFileData("", "Panda3D example")
loadPrcFileData("", "fullscreen 0")
loadPrcFileData("", "win-size 1024 768")
@croxis
croxis / gist:6436553c3542ec692c1d
Created March 24, 2015 00:08
Rendering procedural planets.
Based on feedback from ChemicalR I'm cross posting all the things I've bookmarked in reguards to planet rendering here in the code forums.
[url=http://www.gamasutra.com/view/feature/3098/a_realtime_procedural_universe_.php]Sean O'Neil[/url]'s 4 2001 part series is considered a foundation for realistic large scale (planets on up) rendering. Most of these methods are now obsolete and replaced with faster methods and gpu shaders. His [url=http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html]atmospheric scattering[/url]method is still used often due to its relative simplicity, but it only produces earth atmospheres.
[url=http://acko.net/blog/making-worlds-1-of-spheres-and-cubes/]Steven Wittens[/url] 2009 multipart series is frequently linked to as I've searched for best practices in creating planets using modern methods. It is based on a cube with mesh texture and normalizes the vertex points into a sphere. The advantage to this method is that conventional terrain LOD methods, often used in first
@croxis
croxis / gist:f08d1ce071072b8efbc0
Created March 24, 2015 00:04
Trillek Single Solar System Arguments
In irc there was talk about FTL and the assorted gameplay issues with each method. Then I started thinking about other design and story issues trillek is having. Then I started thinking about my space game I haven't touched in a while.
A few years ago I saw a video similar to this one http://vimeo.com/40234826 and I was really struck by saturn's moons. Saturn has over 70 moons. That is a lot of surface area to explore and with assorted orbits around each moon, and saturn itself, that is a lot of gamespace. I also saw this picture http://misc.oranse.net/misc/wallpaper/earth.jpg taken from low Earth orbit and how amazing our planet looked from low orbit. I started designing a game with the setting of just our solar system that takes place during humanity's expansion into our solar system.
What if we used that setting, or a similar one, instead? What if trillek takes place in one solar system?
Using our solar system as a model: There are 4 terrestial planets. 4 gas giants. At least 4 dwarf planets and a numbe
@croxis
croxis / urwidp3d.py
Created May 3, 2013 19:45
Urwid based console interface for panda3D
'''Panda3D urwid interface
Version 1
Authors: croxis
This is an example of a command line curses style gui for Panda3D.
It uses urwid for graphical widgets and bpython for the python console.
This sample creates 3 windows. The first is for controlling the application
though text commands (ie, like a minecraft server). In this example text
is just reposted to the output.
#version 130
uniform sampler2D colorTexture;
uniform sampler2D nightTesture;
uniform sampler2D glossTexture;
in vec2 texCoords;
//varying vec3 N;
//varying vec3 v;
def myNormalize(myVec):
myVec.normalize()
return myVec
def create_mesh(parentnp, debug=False):
'''This creates a simple 17x17 grid mesh for the sides of our cube.
The ultimate goal is to use a LOD system, probably based on quadtrees.
If debug is true then we get a color gradiant on our vertexes.'''
x = -1.0
y = -1.0
@croxis
croxis / orbit.py
Last active December 21, 2015 00:48
Compute the x,y,z position of a body relative to its parent, using precalculated orbital parameters, as a function of time
from math import sin, cos, radians, degrees, sqrt, atan2
#Imported from a json/yaml/whatever config file
#This is Earth's orbit. Time is number of Julian2000 days
planet_config = {
"a": 1.00000018,
"e": eval("lambda d: 0.01673163 - 3.661e-07 * d"),
"w": eval("lambda d: 108.04266274 + 0.0031795260 * d"),
"i": eval("lambda d: -0.00054346 + -0.0001337178 * d"),
uniform sampler2D p3d_Texture0;
varying vec2 texture_coordinate;
varying vec4 texCoords;
//
varying vec4 position;
// position of the vertex (and fragment) in view space
varying vec3 varyingNormalDirection;
// surface normal vector in view space
//
@croxis
croxis / frag.glsl
Created July 31, 2013 23:22
Cubic spheres. Or: Rendering nice planets. Code is public domain.
uniform sampler2D p3d_Texture0;
varying vec2 texture_coordinate;
varying vec4 texCoords;
out varying vec4 FragColor;
void main(void)
{
FragColor = gl_Color;
}
[9761.156] EconomicGeneralInfo: Total Units - 2
[9761.156] EconomicGeneralInfo: Maint Free Units - 0
[9761.156] EconomicGeneralInfo: Paid Units - 2
[9761.171] EconomicGeneralInfo: Total Units - 2
[9761.171] EconomicGeneralInfo: Maint Free Units - 0
[9761.171] EconomicGeneralInfo: Paid Units - 2
[9761.406] ChoosePantheonPopup: -149
[9761.406] ChoosePantheonPopup: 963
[9761.406] ChoosePantheonPopup: 814
[9761.468] ChooseIdeologyPopup: -149