Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Eiyeron

Pages: 1 [2] 3 4 ... 101
16
News / Re: All I Want For Christmas Is...
« on: December 30, 2014, 07:59:40 am »
COngrats to the new CoT!

Hmmm, what's actually mùake someone eligible to such a grade?  Curious to see.

17
Art / Re: Mockups "please say this is going to be a game"
« on: December 29, 2014, 12:05:38 pm »
Not really something looking like a game but a topic about that kind of program should be done. I toyed with TCOD and simplex noise. I did a simple perlin-like noise to 8 gray scale + position dithering. Here is the coordonate dithering method. You can change the 4 into any power of 2.

Code: (c) [Select]
int u = x&-(4-(x&1));
int v = y&-(4-(y&1));

EDIT : here is the actual code. you'll need TCOD, which seems to be a pretty nice roguelike-based terminal emulator+utilities library
Spoiler For Spoiler:
Code: [Select]
#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;
}

EDIT 2 : Hey, I did a terrain generator!

Spoiler For Spoiler:
Code: [Select]
#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;
}

18
Humour and Jokes / Re: Weird/funny pictures thread
« on: December 23, 2014, 05:51:53 pm »
I won't spare you from that one. Not seriously, read that. I totally got off guard.

EDIT : And for actually posting a picture and not a link:

19
Humour and Jokes / Re: Important life algorithms
« on: December 23, 2014, 04:35:25 pm »
Code: [Select]
#define if(x) if(rand()%10 && (x))

Happy debugging! :p

20
Miscellaneous / Re: Post your desktop
« on: December 23, 2014, 04:31:13 pm »
Only for the screenshot! :p

21
Other Calculators / Re: Your overlocked calc
« on: December 23, 2014, 04:24:58 pm »
And what happens when he will pull the batteries off?

22
Miscellaneous / Re: Post your desktop
« on: December 23, 2014, 04:21:23 pm »
I'm getting more and more used to my new computer. Here's the current desktop look. I have two 1280*1024 screens and the split between them is right at the right place. I wanted a wallpaper that would be splitted in two and yet I found something that went beyon my expectations : let's get retro with Spy vs Spy! :p

23
Humour and Jokes / Re: Important life algorithms
« on: December 21, 2014, 06:56:09 am »
Code: (c) [Select]
depression_points = {LIFE, SHYNESS, LIFE_CHOICES, LAZINESS, etc...}; // too many to list them.
while(has_projects_to()) {
    if(has_homework_to_do()) {
        if(has_important_project_to_do())
            program_on_small_project(rand()%num_small_projects());
    }
    else
        depressing_about_(depression_points, rand()%num_depression_points());
}

EDIT  :oh wait that isn't humourous nor a joke... WAit...

Code: (c) [Select]
while(it_wont_work()) {
    if(rand()&1)
        depress_about_it();
    else
        try_to_desesperatly_fix_it();
}

... Damn!

24
Art / Re: Eiyeron's Paint Room
« on: December 17, 2014, 03:54:52 pm »
Oh, I started spriting again. I fell into a sort of a mood

25
TI Z80 / Re: Cookie Clicker Axe development thread
« on: December 15, 2014, 02:35:15 pm »
See, you just killed Sorunome's inexistant productivity! :p You meanie!

26
General Discussion / Re: Watcha Been Listening To?
« on: December 15, 2014, 04:49:52 am »
Pixeltune has made another masterwork : Here

27
Miscellaneous / Re: What is your avatar?
« on: December 15, 2014, 04:48:44 am »
Nah, it won't be. Pokémon sprites 3th gen up to 5th are quite detailled and have up to 16 colors.

28
Miscellaneous / Re: What is your avatar?
« on: December 15, 2014, 03:12:42 am »
Because that's a Pokémon.

29
Introduce Yourself! / Re: Spartan *Spartan braces for peanut overload*
« on: December 14, 2014, 10:52:25 am »
Welcome to Omnimaga, hope you like calculator programmers and crazy projects!

30
Humour and Jokes / Re: Weird/funny pictures thread
« on: December 14, 2014, 09:40:48 am »

One of the funniest things I've seen in my newspaper.

"I will dessert you", nice one!

Pages: 1 [2] 3 4 ... 101