Welcome Guest [Log In] [Register]
Welcome to Mp2d. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Learning
Topic Started: Mar 20 2008, 04:08 PM (1,356 Views)
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
No, the spec is 9 CFM of air, which I should have known isn't nearly enough for my high-end card. I ordered a 4 dollar fan that does 28 CFM today, but it blows air forward instead of sideways, so it might be a bit weird to set up...
Regardless, it should be better than this =/
Posted Image
Offline
 
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
http://timaster.googlepages.com/rts.exe
Finally resumed work, decided to spice the graphics up a bit.
No source code this time cause screw you guys. I'll post it if anyone actually wants it.

Now alt+f4 closes the program, so you can't get stuck in any of the rooms and have to end process.

All the resources decompile into the folder with the game, so put it in its own folder before you run it. Feel free to steal things, as always.
All graphics and sounds were made by me, and probably will be for the whole game, with the possible exception of models if I decide to go 3D.
More on that later, when I start writing the actual game.

Next step: making a pretty main menu interface. Those buttons are just placeholders for now.
EDIT: Oh yeah, the program saves the state of the window you left it in on exit. So if you manage to get out of fullscreen (by switching the first number to a 0 in the .ini, for example) it will from then on save your stuff. Try it out, tell me if any errors pop up.
Don't worry about the Fullscreen value if it's a super long number starting with .99999. It's just slightly innaccurate, but it reads it as a 1, so whatever...

EDIT2: Oh yeah, resources used so far are Adobe Photoshop CS3, sfxr.exe, registered GM6 (obviously), Notepad, and MS Paint.
Credits to Troid and CFX for a bit of help thus far, PizzaBoy for absolutely minimal help and a bit of bickering, and Daz for why not and huggle.
Posted Image
Offline
 
Troid92
Member Avatar
Music God / Temp Admin
Admin
Cool. :D

I haven't had any problems with the window settings. A little confused about why it's like, 99.99992710763, though.
Posted Image
MIDI-maker / Fangame Programmer
Yay red text.
Offline
 
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
No idea. That's what get_fullscreen() returned though <_>
Posted Image
Offline
 
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
http://timaster.googlepages.com/GameofLife.exe
Whee, little project.
Posted Image
Offline
 
MrGuest
Guestinator the Guestinator
[ *  *  *  *  *  *  *  *  * ]
Dang it... It's an exe.... Macs SUCK BALLS!
Offline
 
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
Yeah they do.
Posted Image
Offline
 
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
http://timaster.googlepages.com/GameofLife2.exe
Nifty colored version. The rule is still binary, with black/white (slightly different rule, but the point is the calculation doesn't depend on the colors), but now the color of each pixel is different depending on how the pixel was created. If it was created according to one rule, it's red, another, it's blue, another, it's green. It's all reds and blues, but sometimes, the blues clump together into lines that fall down... if they hit each other, they disappear, but they are never generated (except out of the sides, because those never change).
You probably have no idea what I'm talking about, since you don't know what the program does, but it's still cool.
EDIT:
http://timaster.googlepages.com/GameofLife3.exe
Wheeeeeeeeee
Okay I'm done. Back to better things.
Posted Image
Offline
 
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
I'm sorry dudes, it turns out it fails massively if you run it at a resolution that doesn't perfectly match mine :(
Thanks, Troid, for pointing that out. I fixed the resolution thing now, and now I'm working on a version that you can play with the rules of while it's running. Then I'll upload the fixed version.
Posted Image
Offline
 
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
000100
100100
100001
001100
001001
110001
100110
100101
011100
011001
010110
110110
110011
100111
011110
011011
110111

Elaboration tomorrow.
Posted Image
Offline
 
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
http://timaster.googlepages.com/GameofLife.exe
http://timaster.googlepages.com/GoLpref.ini
Put these two in the same folder.
Open the .exe, then open the .ini.
The .exe will output a pretty pattern!
Now, an explanation of how this works.
Every time you hit space, the game pauses.
Every time you hit enter, the game reads the .ini. So what you may do is change the pattern on the screen as it goes.

Now here's how the game works:
Each row of pixels is a bunch of numbers from 5 to 0. The game logic reads everything that isn't a 0 as a 1. The higher numbers exist only for pretty colors.
So, in a 1/0 environment, we start with (for example):
010010100
There are certain rules that define how the next line is printed.
111 -> 1#1
101 -> 1#1
110 -> 1#0
100 -> 1#0
010 -> 0#0
000 -> 0#0
This is the setup for all the rules.
The game looks at every combination of 3 numbers, and depending on the rules set, it writes the middle number of the next line. The game, however, does not differentiate between 100 and 001 (it doesn't care what side the 1 is on).
If the rule for 101 is is 1, then 101 results in a 1 printed on the next line.
Let's set the default rules, and see what happens to the previous line.
111 -> 0
101 -> 0
110 -> 0
100 -> 1
010 -> 0
000 -> 0
Now, 010010100 obviously has edges, but we'll treat it as a circle. The leftmost 0 has a 0 to the left of it.
According to this, 010010100 becomes 101100010
The first numbers is in a 001, so it writes a 1. The next is 010, so it writes a 0. Then 100 is a 1, etc.

If that makes sense, you can start messing with the game!

Here's a list of all the possible values for each field, what they mean, and when to use them:

x, y: These are the screen dimensions, but these (unlike everything else in the .ini) are only read when you start the game. If you want to change the resolution, close the game before you change these values.
fullscreen: Changes whether the game is fullscreen or not. I recommend setting x and y to your desktop resolution values if you do this in fullscreen.

all: Defines the starting values of all the squares. Preset values are
all0/all1 - The value of every pixel in the initial row is 0 or 1, for all0 and all1 respectively.
rand - Each value is defined anywhere from 0 to randWeight - 1, rounded up. More info under randWeight. Using this option while the program is running will oftentimes result in a single wacky-looking row of pixels. Yes, this is supposed to happen, don't worry.
alt - The first pixel is 0, the next is 1, the next is 0, etc.
none - Don't change anything. Useful if you want to modify the rules in the middle of a pattern without resetting the pattern. Do NOT leave it as none when you start the program, though, it will crash. Always start with one of the other options.
randWeight: Changes the chance that the initial row of a randomly initiated pattern is colored. A randWeight of 1 to 0 will result in all initial pixels being 0s. If you want only a few scattered pixels to be 1s, make randWeight 1.05 or so. If you want only a few pixels to be 0s, make randWeight really high. A randWeight of 2 will result in approximately 50/50 distrubution of 0s and 1s in the initial row.
howManySingle: The next few lines are allocated for if you want to set specific pixels. howManySingle tells the game how many specific pixels you want to set.
resetStatic: If you have set static pixels earlier, this will clear them all, and let them be overwritten.
setSingleI#: The location of the pixel you want to set.
setSingleVal#: The value of the pixel you want to set.
setSingleStatic#: Whether or not the pixel you have set is static. If it is static, it will NOT CHANGE until you reset all static pixels, or write a non-static single pixel to the same location later.

rule###: For rule111, setting a value of 1 will mean 111 -> 1 as described above. Remember, rule110=0 means that 110 -> 0 AND 011 -> 0. This is also where you set the colors. Anything that isn't a 0 is a 1, in terms of rules, so write in any number from 1 to 5 as a 1 to color things a bit.
color#: Every value is output as a color. The default colors are black, white, red, green, blue, yellow, in that order. Change these to whatever you like, they do not affect the actual game logic in any way at all, but sometimes yield prettier results.
Use the formula R*(256^0)+G*(256^1)+B*(256^2) where R, G, and B are numbers from 0 to 255 to get colors.

PLEASE NOTE:
You must save the .ini each time you change something, before you go back to the game screen and hit enter. If you hit enter, and nothing happens, chances are you forgot to save.
Other things to keep in mind are that howManySingle should be 0 whenever you're planning on not changing anything. Reset its value to 0 every time you use it, so you don't forget. Same goes for resetStatic. It's also a good idea to reset all to none every time, so you don't accidentally reset the whole pattern.

Also, the previous post with 1s and 0s is a list of all of the good 1/0 patterns. Everything else stabilizes or loops within a few pixels.
Read it as:
000100
is
111 -> 0
101 -> 0
110 -> 0
100 -> 1
010 -> 0
000 -> 0
And stuff.
If you don't get anything, please ask me to explain. I suck at explanation <3
Posted Image
Offline
 
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
Shit, I miscalculated white in the .ini. Link updated.
Posted Image
Offline
 
Troid92
Member Avatar
Music God / Temp Admin
Admin
Different rule settings lead to very interesting designs :o . Here are some cool ones I've found so far: (in the order of 111, 101, 110, 100, 010, 000)
0 3 4 5 2 0
0 3 0 5 2 0
2 0 0 0 0 1
2 1 0 2 1 0

Just try sticking in other numbers for 1 in the list Tim posted earlier.

I haven't even tried changing the colors yet.
Posted Image
MIDI-maker / Fangame Programmer
Yay red text.
Offline
 
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
Troid and I spent a while dicking around with pointers in C++ today. If you're interested, go grab a copy of dev-cpp (FREE! http://www.bloodshed.net/devcpp.html) and join in the fun!

I'd like to type up a full explanation of the way RAM works when you're coding a C/C++ program, which I'll probably do tomorrow. Until then, I present you with a program that allows you to edit, bit by bit (yes, bit, like 1/0), any data type in C++, and observe what happens to the output! Doubles are confusing and weird, but datatypes like int are quite simple. Simplest is an "unsigned short int", so we'll work with that for now. A short int is 2 bytes (varies by compiler) that hold an integer value, as opposed to a regular int, or more properly, a "long int", which is 4 bytes (in visual studio), and "unsigned" means it cannot be negative. The first bit in a signed int is responsible for negative/positive values, and because of the way binary works, an unsigned int (short or long) is twice as big, but can't be negative. Anyway, here's the code:
Code:
 
#include <iostream>
using namespace std;

unsigned char bin2dec(const char *bin);

int main()
{
unsigned char *pointer;

pointer = new unsigned char[8];

pointer[0] = bin2dec("01000001");
pointer[1] = bin2dec("00000000");
pointer[2] = bin2dec("00000000");
pointer[3] = bin2dec("00000000");
pointer[4] = bin2dec("00000000");
pointer[5] = bin2dec("00000000");
pointer[6] = bin2dec("00000000");
pointer[7] = bin2dec("00000000");
// add more pointers here if need be

unsigned short int *variable;
variable = (unsigned short int*)&pointer[0];

cout << sizeof(variable) << '\n' << *variable;

cin.get();
return 0;
}

unsigned char bin2dec(const char *bin)
{
unsigned char result = 0;
for(;*bin;bin++)
 result=result*2+(*bin-'0');
return result;
}

All you have to do is fill the 0s with whatever you like. Each line of 0s is a single byte. The output of the program is the number of bytes in the variable, and the variable itself (should be 65 on most computers right now, and PLEASE PLEASE tell me your operating system and compiler if it's not). Editing bytes past the size of the variable is pointless, for what should be obvious reasons. So right now, if the size of the variable is 2 (which I think it is on all compilers), edit pointer[0] and pointer[1].

Uhhh, yeah, so have fun, and as always, please ask if there's anything I didn't explain fully enough.

EDIT: Oh yeah, credit to some dude on google for the binary to decimal converter. It's heavily modified, but the basic idea is his, so yay at him. All of the other code is mine, and the idea is mine and troid's collaborative effort.

EDIT2: Oh yeah2, if you know a bit about C++, you might be asking "what the bloody hell is an unsigned char?". The answer is simple: Characters in C++ are just 1 byte integers, with an extra bit on the end that doesn't mean anything. How is this possible? The ASCII table, of course! A signed char will return wonky values if the last bit has a 1 in it. By unsigning the char, I can use it exactly as I would an integer, and there's no other integer datatype of 1 byte, so unsigned char is very very convenient. DO let me know if your compiler doesn't support this, though! It's a strange thing to do, so it might give you warnings along the lines of "What the hell are you thinking?".
Posted Image
Offline
 
Timmeh
Member Avatar
The Electryc Penys
[ *  *  *  *  *  *  *  *  * ]
So I was bored yesterday, and made a program that draws a sine wave in the RAM usage monitor in the Windows task manager (or any RAM monitor, if it works properly). I put the finishing touches in today, and because I think it's a totally nifty idea, I uploaded it.
1) Open your task manager (ctrl+shift+esc).
2) Hit the "Performance" tab.
3) Download and run this.
4) Wait a few minutes for the graph to form!

Credit to Troid92 for helping me work out a couple of weirdnesses.

CAUTION: This uses a ton of RAM. About .4 GBs worth of it. If you don't have that much RAM available, your computer will slow down MASSIVELY as soon as you run the program.

Source code available on request in case someone thinks it's a keylogger.
Posted Image
Offline
 
ZetaBoards - Free Forum Hosting
Create your own social network with a free forum.
Go to Next Page
« Previous Topic · General Discussion · Next Topic »
Add Reply