Throw stuff at me!

Pages: 12
So, I was looking at the Gameboy CPU manual and some common algorithms. This helped me clean up my code quite well and helped me create easier solutions to problems that have always haunted me! Anyways I'm pretty far into developing my game. I expect to have it finished by April. For those who have seen my previous posts, It's the one with the demon girl and getting lost. If you have seen my even older posts, it's the one with zombies. Zombies have been removed due to how complicated planning them out was. This game is being written on a portable machine similar to a Gameboy. Specs: Z80 CPU, 24K RAM, 96x64 res, 2MHz clock, 6V power supply. Anyways I would like to know what algorithms you use in your games?

TLDR: What algorithms do you use in your games?
I only use algorithms, I don't write algorithms. It sounds like you are writing algorithms (re-inventing the wheel) instead of using existing algorithms.
Well I make my own, use existing ones and recreate existing ones. Can you show me the ones that you use?

(EDIT) Preview title screen! It's been stretched so it's ugly and distorted but it's visible.

http://s2.postimg.org/qwixjfkll/download.jpg
Last edited on
I've had to write some flocking algorithms from scratch before and a box select with crawling ants. Both of them I looked up on Google / asked on forums about before writing so I wasn't starting cold. I didn't use an existing algorithm because there were none exactly fit for my purpose. These are the two I found most challenging so far.

I also have to make up little algorithms here and there - the last example I can think of is last week writing one to make playing cards with health fight and move from one pile to another, or draw or be discarded when appropriate - but these algorithms are kinda more simple and I tend to just write them straight off rather than looking them up.
Last edited on
Yipper, I understand about writing the small stuff. When I was first getting into code, Tic Tac Toe is where I had written one of my most complicated algorithms. It had only been used once. In this game, the algorithm is used ~20 times. It has to be rewritten due to low memory (It's hard to explain) and all maps are different. also, it's written in two different modes, 1D and 2D. This algorithm controlled the cursor in Tic Tac Toe now controls player movement and menus. It's basic and obvious but when I was looking up how to do what I wanted to do, it gave me stuff like

1
2
3
4
5
6
7
8
9
#include <Crazy64-BITLibraryIKnowIDon'tNeed.h>

string main() //does this even work???
{
int a;
a = keyboard;
menu("Blah","Blah",1,"Blah",2
DrawCastle(5,6);
}

this is my algorithm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <conio.h>

using namespace std;

int main()
{
int X ;
int T = 1;

A:
system("cls");
cout<< "Menu\n";
if (T==1) (cout<< ">Hello!\n");
else(cout<< " Hello!\n");
if (T==2) (cout<< ">Bye!\n");
else(cout<< " Bye!\n");
B:
X = getch();
if (T<1) (T=2);
if (T>2) (T=1);
if (X==72) {
T=T-1;
goto A;
}
if (X==80) {
T=T+1;
goto A;
}
goto B;
}


What's some of the larger stuff you use?
Last edited on
RealGiganitris wrote:
Can you show me the ones that you use?
http://en.cppreference.com/w/cpp/header/algorithm
I believe he is talking about game algorithms like path finding, rotation, ect... and not algorithms for sorting/arranging containers.
Same thing, I don't invent my own, I look up one someone else invented (e.g. Dijkstra).
I'm not sure how you manage to make games without making any of your own algorithms? Some circumstances that comes up are just so specific that you have to make up your own algorithm, especially when it comes to AI playing a game you invented, but also in other situations. Also, even when you use an existing algorithm, you still have to modify the algorithm to fit your game.
You're making it sound like you aren't properly abstracting your code so it can be reused, or so that implementations can be switched out.
Mats wrote:
even when you use an existing algorithm, you still have to modify the algorithm to fit your game.
No, you do not modify the algorithm, your implementation looks different from case to case - the algorithm is always the same. Renaming a variable doesn't change the algorithm.
the algorithm is always the same.


I definitely disagree with this. Elements of the algorithm are the same, but when for example, I implemented a flocking algorithm, it really was not a case of just copying the code and renaming variables. All sorts of things had to be changed. Another example was when I was applying a mini-max type algorithm to a board game I invented last year. Sure, it was a kind of mini-max type thing, but you couldn't call it a pure mini-max algorithm.
You're making it sound like you aren't properly abstracting your code so it can be reused, or so that implementations can be switched out.
Mats wrote:
even when you use an existing algorithm, you still have to modify the algorithm to fit your game.
No, you do not modify the algorithm, your implementation looks different from case to case - the algorithm is always the same. Renaming a variable doesn't change the algorithm.


Niej, you have to change the algorithm. trust me.
If you "change" the algorithm, it's now another algorithm that someone already invented/discovered. I would be extremely impressed if you invented/discovered a new algorithm.
Okay, fine. Here mats, hold my beer. I have invented a new math operation. It's called the inverted not gate! Lemme show you how it works.

The not gates logic goes like this:
1 -> 0
0 -> 1

Now add a not gate in front of that not gate and presto! The inverted not gate! It's perfect for cryptography, Try it!

If that's been invented, add another not gate. Something new! It becomes the inverted inverted not gate! Keep going until you invent something new! Not gates are the answer to the worlds problems!

(EDIT) Why am I reported?
Last edited on
I literally have no idea what you're trying to say.

EDIT: Why was that post reported?
Last edited on
Seeing how empty this beer you asked me to hold is, I would say you probably have had too much...
I hate looking up other peoples code to copy. I only search for algorithm implementations when it's a critical or non-trivial task. If the task is something I instinctively know how to handle, I just do it myself. If it's something specific and non-generic, and I want some kind of complex behavior that I thought of, I don't bother looking at all.

I know people who when they start a project, all they do is brainstorm on what libraries to use for what. They find a library for every little thing. In the end they hardly get anything done and certainly nothing impressive. Usually they spend most of their time trying to figure out how to use or modify other peoples code to little avail. Huge waste of time.
Last edited on
they spend most of their time trying to figure out how to use or modify other peoples code to little avail.


Not always true. With the modification of others code, you can come up with some pretty efficient and fancy stuff. Most of the time you're right though.

Example, in the language I'm writing this game in (high level) there are menus pre-made that are designed to work better. This method is commonly used by beginners. The second method, which isn't as conservative in terms of memory but conservative in terms of ease and "memory jumps" (labels).

Method A:
http://tibasicdev.wikidot.com/local--files/menu/MENU_ANIMATED.gif

Method B:
http://img3.wikia.nocookie.net/__cb20091221004125/tibasic/images/3/3f/DropDownSelected.jpg

Look up "not logic gate" on Google.

(EDIT) Wait a minute! Who reported my post?!
Last edited on
I hate looking up other peoples code to copy. I only search for algorithm implementations when it's a critical or non-trivial task. If the task is something I instinctively know how to handle, I just do it myself. If it's something specific and non-generic, and I want some kind of complex behavior that I thought of, I don't bother looking at all.


Someone talking sense. ^^
Yeah that's true. I was just asking because I wanted to know how to write what I have already wrote better.
Pages: 12