Allegro.cc - Online Community

Allegro.cc Forums » The Depot » [TINS 2010] The source god

This thread is locked; no one can reply to it. rss feed Print
[TINS 2010] The source god
Victor Williams Stafusa da Silva
Member #4,212
January 2004
avatar

[heavily edited from the original post]

Hello, "The source god" is my first TINS entry. It was done by me (Victor Williams Stafusa da Silva) and a friend of mine (André Luiz Pereira Álvares).

Source code:
http://victor-tins-2010.googlecode.com/files/sourcegod-1.04.zip

Source code with windows binary (and some DLLs included to ensure compatibility, inclusive allegro 4.2.3)
http://victor-tins-2010.googlecode.com/files/sourcegod-win-1.04.zip

Diff from the uploaded version (only bugfixes, no improvements):
http://www.allegro.cc/files/attachment/602142

TINS upload (warning: has some critical bugs that may crash or hang the game, prefer the fixed version above):
http://tins.amarillion.org/upload/sourcegod_1.zip

GAME DESCRIPTION:

You are the hand and you objective is to keep the source code safe against the bugs. To do this you mainly possess programmers to kill the bugs (and the other monsters), and fix the code.

To possess a programmer, click on it using the hand when you are blue (the mouse hot-spot is in the top of the third finger). After he was possessed the hand will disappear and you may control him using the arrows keys or the numeric keyboard. Use SPACE to attack monsters and fix code. Use ENTER to Unpossess him and go back to the blue hand form.

You may carry programmers from one place to another using the brown hand. To do this, press "2" in the alphanumeric keyboard and notice that the hand will change to brown. You may click in a programmer and drag him around. However this resource is limited, so use wisely. Press "1" to go back to the blue hand form.

You may kill monsters directly with the hand. To do this, press "3" in the alphanumeric keyboard and the hand will change to green. Click in monsters to attack them. Again, this resource is limited, so use wisely.

Use END in the game to go back to title screen. Use ESC to kill the game immediately.

The game has 10 levels, but since I did not had time to implement all of them, levels 3 to 8 are identical.

Can you beat it? (warning: I did not had time to balance the game, levels 1-8 are easy, levels 9 and 10 are almost impossible).

RULES IMPLEMENTATION:

Quote:

genre rule #90
Deities & Demigods: The player character is a god, half-god, angel or other divine being, doing the kinds of things gods do.

You are the hand-programmer god of the code.

Quote:

artistical rule #132
Hand drawn. Feature hand-drawn or hand-painted graphics. You may use actual scanned drawings, or just simulate them.

About everything is hand-drawn in this game. See the screenshot below.

Quote:

artistical rule #105
Use samples of human(-like) voice

When the programmers attack or die, they will scream. The green monster screams too when dies.

Quote:

technical rule #69
polymorphism: create two pieces of code that implement the same interface, and let the user select one.

The player may select the blue, brown and green hands (starting from level 2), and each one behaves differently, though they all have the same interface (i.e. being a hand that clicks and moves with the mouse). Further, in the code (file mao.cpp), this is implemented via class polymorphism, using the gang-of-four State Design Pattern. Further, the game very heavily uses polymorphism internally.

Quote:

technical rule #34
View Source: The game must display a piece of it's own source code somewhere.

Your task is to kill the bugs that eat the source code and restore the code eaten. The source-code is one of the most central things in the game.

BUGFIXES:

There are some bugfixes from the last TINS uploaded version. They are in the diff attached. They are:
1. Fixing an encoding problem, when using UTF-8 instead of ASCII (files readme.txt and main.cpp), minor bug.
2. Fixed an unitialized pointer issue that could crash the game (file menuinicial.cpp), critical bug.
3. Fixed a bug that could make the game hang due to non-obviously removing objects from a list while it was being iterated. This leads to undefined behavior that could cause an infinite loop (file jogo.cpp), critical bug. Thanks to kenmasters1976, Anomie and Nilo Cesar Teixeira for reporting this.
4. Fixed a bug in monster AI that makes them sometimes stuck in trees (file filtros.cpp), major bug.
5. Fixed a issue that some compilers complains about non pure virtual method on an interface (files pathfind.h and game.h), critical bug. Thanks to kazzmir for reporting.
6. Fixed a buffer overflow problem (file readsource.cpp), critical bug. Thanks to kazzmir for reporting.
7. Fixed two bugs that wasted the brown and the green hands when you di not clicked right, major bug.

Other things in the diff:
1. Added 2 DLL files to our SVN repositry to ensure compatibility, (thanks to kenmasters1976 and Kthanid for reporting the problem).
2. Added some more debugging (the game saves debugging info in a file called debug.txt).
3. Added a thanks.txt file to thank everybody that helped to debug and test the game.

Again, no improvements in the entry were done. The diff contains only bugfixes.

Known bugs still there:
1. The start screen mouse may leave a bit of dirty in the screen, minor bug.
2. Level 1 music does not plays, minor bug.
3. In some levels, programmers start stuck in walls, and you need to use the brown hand to reease them, major bug.

Other issues that may imply to improvements, for being fixed:
1. The game is very unbalanced, major issue.
2. Levels 4-8 were not implemented, they are simply copies of level 3, major issue.

{"name":"602114","src":"http:\/\/static.allegro.cc\/image\/cache\/7\/4\/74925efc2c18950075240b6b49478d1e.png","w":806,"h":632,"tn":"http:\/\/static.allegro.cc\/image\/cache\/7\/4\/74925efc2c18950075240b6b49478d1e"}602114

[The attack of the space bugs - Speedhack 2005] [Rambananas - Speedhack 2006] [Make clean - Speedhack 2009] [The source god - TINS 2010]

http://www.orkut.com/Profile.aspx?uid=4435454830107696443

kenmasters1976
Member #8,794
July 2007

It asks for a missing DLL on my machine (libgcc_s_dw2-1.dll).

Kthanid
Member #12,218
August 2010
avatar

Same DLL error here.

Victor Williams Stafusa da Silva
Member #4,212
January 2004
avatar

I uploaded the binary again, replacing the old one. The ony change I did was to add two libgcc_s_dw2-1.dll and libstdc++-6.dll. I copied them from my MinGW bin source.

Can you please tell me if it works for you now or not?

[The attack of the space bugs - Speedhack 2005] [Rambananas - Speedhack 2006] [Make clean - Speedhack 2009] [The source god - TINS 2010]

http://www.orkut.com/Profile.aspx?uid=4435454830107696443

kenmasters1976
Member #8,794
July 2007

You uploaded it where?. I downloaded the binary in the first post and it's the same as before.

Also, I have MinGW and I never have this DLL errors, so that's kinda weird.

Victor Williams Stafusa da Silva
Member #4,212
January 2004
avatar

kenmasters1976:

I double-checked google-code download and it is definitely not the same. Are you sure that the browser did not cached the download or something weird as this?

And, about these DLL errors, I never saw them before too. If you did not reported them, I probably would never notice.

[The attack of the space bugs - Speedhack 2005] [Rambananas - Speedhack 2006] [Make clean - Speedhack 2009] [The source god - TINS 2010]

http://www.orkut.com/Profile.aspx?uid=4435454830107696443

kenmasters1976
Member #8,794
July 2007

Weird. It keeps downloading the older version (a 711 KB file). Might be an issue with the Firefox 4 Beta.

I downloaded it using Chrome and it downloaded the new version.

Now it runs but I couldn't play it 'cause it seems to hang right after the first programmer is killed.

Anomie
Member #9,403
January 2008
avatar

It sounds like a neat game, but my experience wasn't great. :( It failed to start at first due to my 1024x600 netbook resolution, but luckily it fit into the 1024x768 mode that mine semi-supports.

I read the in-game readme (which was nice, but the urge to tl;dr was there :-[) and started it up, possessed the leftmost guy and mashed the space bar to hopefully kill the bug that was already in his face, but nothing happened! :o I died, and the 'end' key (which I just barely managed to find on my keyboard) did nothing. Ctrl-alt-del, killed it, started it up again ready to give it a good play-through. Killed the first bug and the game crashed immediately. :(

______________
I am the Lorax. I speak for the trees. I speak for the trees for the trees have no tongues.

Victor Williams Stafusa da Silva
Member #4,212
January 2004
avatar

I uploaded a new version to fix the bugs and edited the first post in the topic. Also, I created a different URL to ensure that the browser will not cache the download. In advance, I thank to everybody who tried and that will try to play my game.

Anomie said:

It failed to start at first due to my 1024x600 netbook resolution, but luckily it fit into the 1024x768 mode that mine semi-supports.

Sorry, The game assumes that the resolution is greater than 800x600 because I, forgeting about netbooks, misleading thought that no one would use a smaller resolution nowadays.

[The attack of the space bugs - Speedhack 2005] [Rambananas - Speedhack 2006] [Make clean - Speedhack 2009] [The source god - TINS 2010]

http://www.orkut.com/Profile.aspx?uid=4435454830107696443

kazzmir
Member #1,786
December 2001
avatar

g++ -o sourcegod  obj/character.o obj/debug.o obj/fase.o obj/filtros.o obj/homempalito.o obj/jogo.o obj/main.o obj/mao.o obj/menuinicial.o obj/monstro.o obj/monstrosimpl.o obj/objetos.o obj/pathfind.o obj/pathfind_test.o obj/personagem.o obj/readsource.o obj/readsource_test.o obj/tela.o obj/todasfases.o  `allegro-config --libs` 
asdobj/filtros.o:(.rodata._ZTI22ViolenciaContraPalitos[typeinfo for ViolenciaContraPalitos]+0x10): undefined reference to `typeinfo for PathFindFiltro'
obj/pathfind.o:(.rodata._ZTI14VizinhancaGrid[typeinfo for VizinhancaGrid]+0x10): undefined reference to `typeinfo for Vizinhanca'
obj/pathfind_test.o:(.rodata._ZTI15MinhaVizinhanca[typeinfo for MinhaVizinhanca]+0x10): undefined reference to `typeinfo for Vizinhanca'
collect2: ld returned 1 exit status
make: *** [game] Error 1

I'm working on a fix unless you know of one. This is on linux.

$ g++ --version
g++ (Ubuntu 4.3.3-5ubuntu4) 4.3.3

edit:
Ok the fix was to make all methods pure virtual in the interface class you were using.

include/pathfind.h

virtual float h(int vertice) = 0;
virtual std::map<int, float> *get_destinos() = 0;

include/game.h
virtual void processa(Personagem *p, VizinhancaGrid *v) = 0;

edit2:
The game crashed hard after the intro text screen.

*** stack smashing detected ***: ./game terminated
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x48)[0xb7466ef8]
/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x0)[0xb7466eb0]
./game(_Z18get_source_by_linePKci+0x308)[0x8075130]
./game(_ZN4FaseC1EPKciS1_iifP9FaseStart+0x6b)[0x805f445]
./game(_ZN12ConjuntoFaseC1Ev+0x32f)[0x8076193]
./game(_ZN4JogoC1Ev+0x93)[0x8062bb9]
./game(_ZN11MenuInicial8do_logicEv+0xa4)[0x806cf92]
./game(main+0x1ee)[0x806be9a]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb737f775]
./game[0x805e731]

Victor Williams Stafusa da Silva
Member #4,212
January 2004
avatar

kazzmir, thanks for the fix, already commited and I already updated the first post.
I am using GCC 4.5.0 with GNU make 3.82 from MinGW and GNU ld 2.20.51.20100613. Don't know why such compilation problem does not occurs to me (not even a warning).

Can you test the game now, please?

God, I am very afraid with this. Really, nobody here except for me and the friend that created the game with me could run the game? I hate those bugs and issues that looks like that they are able to detect if the user is the programmer.

Really, this is very frustrating. It would be a shame to lose TINS because no one could play my game. I accept losing it if my game sucks or if the other entries are better, but not simply because no one could play it. :(

Edi: Duh, i posted it wrong in the first time. If you download it in the first 5 minutes after I posted that, it was wrong. Already fixed.

[The attack of the space bugs - Speedhack 2005] [Rambananas - Speedhack 2006] [Make clean - Speedhack 2009] [The source god - TINS 2010]

http://www.orkut.com/Profile.aspx?uid=4435454830107696443

kenmasters1976
Member #8,794
July 2007

There are no winners or loser at TINS. You did submit an entry which is more than some of us can say.

I'll give a try to the new version.

[EDIT:] Now it runs well. I reached level 9 before dying mysteriously with 4 programmers still alive. Nice entry.

In the screenshot you can see I have 1 programmer left but when I got the Game Over screen there were 4 but the bugs kept killing them.
{"name":"602137","src":"http:\/\/static.allegro.cc\/image\/cache\/4\/0\/40e611e04b51f3e5b019cc32bbc3b5d0.png","w":805,"h":631,"tn":"http:\/\/static.allegro.cc\/image\/cache\/4\/0\/40e611e04b51f3e5b019cc32bbc3b5d0"}602137

Victor Williams Stafusa da Silva
Member #4,212
January 2004
avatar

I reached level 9 before dying mysteriously with 4 programmers still alive.

Quote:

You need 60% of code, you have 34%

If you let the code go below 60%, it is game over. I did not had time to do game balance, so this level is almost unbeatable. If you want to finish the game, you may open todasfases.cpp, in the constructor ConjuntoFase() and replace level 9 and 10 by other things, or maybe rewrite the levels (classes Fase9 and Fase10).

It is a relief that somebody else than myself could play the game. :)

I want to open a branch with some improvement in the game. Since now most of bugs are fixed, I would be pleased with improvement suggestions and suggestions in level design.

[The attack of the space bugs - Speedhack 2005] [Rambananas - Speedhack 2006] [Make clean - Speedhack 2009] [The source god - TINS 2010]

http://www.orkut.com/Profile.aspx?uid=4435454830107696443

kenmasters1976
Member #8,794
July 2007

Oh, so that's the reason for the game over?. I was thinking that as long as I had programmers left I could keep playing.

As for suggestions... well, maybe just fixing levels 9 and 10 so they're not unbeatable.

Go to: