0 Members and 4 Guests are viewing this topic.
Maybe an HP Prime or TI-Nspire version?
int u = x&-(4-(x&1));int v = y&-(4-(y&1));
#include <math.h>#include <iostream>#include <libtcod/libtcod.hpp>#include "OpenSimplexNoise.hpp"float step(float value, int steps) { if(steps > 1) --steps; return (int)(value * steps)/(float)steps;}float clamp(float value) { float result = value < 0 ? 0 : value; return result > 1 ? 1 : result;}int main(int argc, char const *argv[]){ OpenSimplexNoise noise(0); TCODConsole::initRoot(80,50,"Open Simplex Noisem",false); bool done = false; int t = 0; float scale = 1./50.; float timescale = 1./600.; while(!done) { TCODConsole::root->clear(); for (int x = 0; x < 80; ++x) { for (int y = 0; y < 50; ++y) { int u = x&-(4-(y&1)); int v = y&-(4-(x&1)); float value = 0; value += noise.value(u * scale, v * scale, t*timescale ); // value -= noise.value((j&1) * scale, (i&1) * scale, t/100.)/3; value = ((value + 1)/2.); value = clamp(value); value = step(value, 8); int pixel = value * 255; TCODConsole::root->setCharBackground(x, y, TCODColor(pixel, pixel, pixel)); } } TCODConsole::flush(); t++; TCOD_key_t key; TCODSystem::checkForEvent(TCOD_EVENT_KEY_PRESS,&key,NULL); switch(key.vk) { case TCODK_ESCAPE: done = true; break; default: break; } } return 0;}
#include <math.h>#include <iostream>#include <libtcod/libtcod.hpp>#include "OpenSimplexNoise.hpp"using namespace std;float minusPositiveToZeroOne(float value) { return ((value + 1.)/2.);}float step(float value, int steps) { if(steps > 1) --steps; return (int)(value * steps)/(float)steps;}float clamp(float value, float min, float max) { float result = value < min ? min : value; return result > max ? max : result;}float clamp(float value) { return clamp(value, 0., 1.);}float getMaxDistance(int width, int height) { int maxLength = max(width, height); return sqrt(maxLength*maxLength);}int main(int argc, char const *argv[]){ OpenSimplexNoise noise(0); int width = 100; int height = 100; TCODConsole::initRoot(width, height,"Open Simplex Noisem",false); bool done = false; int t = 0; float timescale = 1./100.; float factors[5] = {1, .5, .7, 1, .05}; float scales [5] = {90, 37, 17, 5, 2}; float power [5] = {1, 1, 1, 4, 1}; float offsets[5] = {0.5, 0, 0, .1, 0}; bool ridged [5] = {false, true, false, false, false}; while(!done) { TCODConsole::root->clear(); for (int x = 0; x < width; ++x) { for (int y = 0; y < height; ++y) { float heightMap = 0; float totalFactor = 0; for (int i = 0; i < 5; ++i) { float s = 1./scales[i]; float f = factors[i]; float p = power[i]; float o = offsets[i]; bool ridge = ridged[i]; totalFactor += f; if(ridge) { heightMap += 1 - clamp(pow(minusPositiveToZeroOne(fabs(noise.value(x * s, y * s, t*timescale))), p)*f + o); } else { heightMap += clamp(pow(minusPositiveToZeroOne(noise.value(x * s, y * s, t*timescale)), p)*f + o); } } heightMap /= totalFactor; //heightMap = minusPositiveToZeroOne(heightMap); float dx = width/2 - x; float dy = height/2 - y; float distanceSq = dx*dx + dy*dy; float distance = sqrt(distanceSq); float factor = pow(1- distance/getMaxDistance(width, height), 0.4); float heat = minusPositiveToZeroOne(noise.value(x/25., y/25., t*timescale)); float value = heightMap; value *= pow(factor, 1.5); int pixel = 255 * value; if(value < 0.5) { int blue = 255 * (0.5 + value); TCODConsole::root->setCharBackground(x, y, TCODColor(pixel, pixel, blue)); } else{ if(heightMap > .8) { TCODConsole::root->setCharBackground(x, y, TCODColor(pixel, pixel, pixel)); } else if(heat > .75) { int yellow = pixel + (255 - pixel) * (heat); TCODConsole::root->setCharBackground(x, y, TCODColor(yellow, yellow, pixel)); } else { int green = pixel + (255 - pixel) * (heat + heightMap)/2; TCODConsole::root->setCharBackground(x, y, TCODColor(pixel, green, pixel)); } } } } TCODConsole::flush(); t++; TCOD_key_t key; TCODSystem::checkForEvent(TCOD_EVENT_KEY_PRESS,&key,NULL); switch(key.vk) { case TCODK_ESCAPE: done = true; break; default: break; } } return 0;}
What is this palette? It looks really nice
I was going to work on portal this afternoon, but I found some old sprites from "Adventure" (a game I was working on but never finished). I started adding/editing sprites and got a bit carried away. Here's where two hours got me:Mockups:Unfortunately, I think these mockups are a bit dense to have good performance on calc. I do think that I'll take this project up again at some point, I already have several ideas that will make it more interesting, and easier to make as well.
that is nice. try decreasing the contrast on the background, though. right now it's difficult to tell the sprites apart from the map.
Quote from: shmibs on January 16, 2015, 02:57:02 pmthat is nice. try decreasing the contrast on the background, though. right now it's difficult to tell the sprites apart from the map.Yes definitely, but other than that I really like the way they turned out. Keep on spriting