Allegro.cc - Online Community

Allegro.cc Forums » The Depot » [SH15] Elders of Ethos

Credits go to bamccaig, Bruce Pascoe, devo_au, Edgar Reynaldo, Elias, GullRaDriel, Mark Oates, Peter Hull, and SiegeLord for helping out!
This thread is locked; no one can reply to it. rss feed Print
 1   2 
[SH15] Elders of Ethos
Onewing
Member #6,152
August 2005
avatar

{"name":"609511","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/0\/80e245fe9794e4f0fc7edda64c2084c3.png","w":799,"h":623,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/0\/80e245fe9794e4f0fc7edda64c2084c3"}609511

Source
Resources

Windows Binary
Version 1.1 - speedhack entry (see thread for windows compatibility code modifications)

I'll try to put the binary (Mac app) up later. For now, time to put up the white flag and get a nap in before work. 8-)

EDIT:
=== Some Side Notes===

  • You can press the Up key to cycle through previously input commands

  • I did program the BACKSPACE function...for a Mac keyboard. In windows, this seems to map to the DELETE key. :(

  • There is a crash that I didn't solve in time if you press two arrow keys at the same time (or close to the same time). This is probably the root of other crashes as well.

  • If you are not getting particles in the background, that's concerning. The windows build I just uploaded has them fine.

  • To get the annoying sound, put all your spirits to guidance and proceed until ghosts fill up the game. They make the sound (and flash white as particles in the background)

  • If you get angels, you will start to see them appear as white spirit-particles in the background. This apparently is less frequent than I intended, so you might have to wait a bit.

  • I was going to have all the levels of The Hierarcy of Needs, but I didn't make it in time and cut out the planes I couldn't get to.

  • I was going to have other tribes that were doing the same thing as you and you could see their progress, as well as trade with them or potentially send spirits to slow them down if they were getting ahead of you.

  • My main objective was I wanted the user to feel out where to put spirits based on game feedback, but since I didn't get the rest in, this usually just takes a single play through to figure out. I've got some random events that can trigger at any moment to try to keep it somewhat exciting. :)

------------
Solo-Games.org | My Tech Blog: The Digital Helm

GullRaDriel
Member #3,861
September 2003
avatar

Well done Onewing !
Can't wait to have all SH binaries ^^

Edit:
Mac Only ?

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Onewing
Member #6,152
August 2005
avatar

Mac only

For now...yes. I have a PC at home too that I'll try to get a functioning windows build, but gonna have to spend family time tonight and got a big site launch tomorrow evening, so that will have to wait a bit.

------------
Solo-Games.org | My Tech Blog: The Digital Helm

GullRaDriel
Member #3,861
September 2003
avatar

I'll wait for your build then ^^

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

devo_au
Member #15,282
August 2013

From the screenshot, looks like you put a lot of effort into the dialog.. Look forward to a windows version when you get around to it..

it wasn't me, it was other kids

Edgar Reynaldo
Member #8,592
May 2007
avatar

I too am waiting for a windows binary. I tried building it with CB and MinGW but it fails to compile with several warnings and an error about not being able to find the arc4random function. Also, how do you compile .m files? Are those Obj-C?

Bruce Pascoe
Member #15,931
April 2015
avatar

Yes, it's completely nonsensical but .m is an Objective-C file. No idea how that will ever be able to be ported, I thought Obj-C was an Apple-only thing.

Onewing
Member #6,152
August 2005
avatar

Yeah, I haven't been coding very much past few years and when I do, I'm coding Objective-C for non-allegro projects in xcode. I've completely forgotten the make processes and how to do so.

Our site just launched, so I'm going to eat some dinner and play around with getting a windows build for you guys. Apologies for the delays!

------------
Solo-Games.org | My Tech Blog: The Digital Helm

Edgar Reynaldo
Member #8,592
May 2007
avatar

Here's the full compile log for the *.cpp files at least :

#SelectExpand
1 2c:\ctwoplus\progcode\allegro5\SpeedHack2015entries\Elders_of_Ethos>srclist.bat 3 4c:\ctwoplus\progcode\allegro5\SpeedHack2015entries\Elders_of_Ethos>mingw32-g++ -Wall -g -Ic:\mingw\LIBS\A5111distro\include -o EldersOfEthos.exe -Lc:\mingw\LIBS\A5111distro\lib *.cpp -lallegro_monolith-debug.dll 5game.cpp:426:2: warning: #warning "Currently skipping AI turns" [-Wcpp] 6 #warning "Currently skipping AI turns" 7 ^ 8In file included from game.cpp:14:0: 9game.h:77:23: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 10 Game(Game const&)=delete; 11 ^ 12game.h:78:33: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 13 void operator=(Game const&)=delete; 14 ^ 15game.cpp: In member function 'void Game::ProcessCommand()': 16game.cpp:226:24: warning: unused variable 'from' [-Wunused-variable] 17 TRIBEPARAMETER from = this->currentTribe->FindParameterInUstrInRange(this->input, 0, (int)al_ustr_length(this->input)); 18 ^ 19In file included from main.cpp:15:0: 20game.h:77:23: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 21 Game(Game const&)=delete; 22 ^ 23game.h:78:33: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 24 void operator=(Game const&)=delete; 25 ^ 26main.cpp: In function 'int main(int, char**)': 27main.cpp:25:11: warning: unused variable 'bouncer_x' [-Wunused-variable] 28 float bouncer_x = SCREEN_W / 2.0 - BOUNCER_SIZE / 2.0; 29 ^ 30main.cpp:26:11: warning: unused variable 'bouncer_y' [-Wunused-variable] 31 float bouncer_y = SCREEN_H / 2.0 - BOUNCER_SIZE / 2.0; 32 ^ 33main.cpp:27:11: warning: unused variable 'bouncer_dx' [-Wunused-variable] 34 float bouncer_dx = -4.0, bouncer_dy = 4.0; 35 ^ 36main.cpp:27:30: warning: unused variable 'bouncer_dy' [-Wunused-variable] 37 float bouncer_dx = -4.0, bouncer_dy = 4.0; 38 ^ 39In file included from message.cpp:10:0: 40game.h:77:23: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 41 Game(Game const&)=delete; 42 ^ 43game.h:78:33: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 44 void operator=(Game const&)=delete; 45 ^ 46In file included from parameter.cpp:11:0: 47game.h:77:23: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 48 Game(Game const&)=delete; 49 ^ 50game.h:78:33: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 51 void operator=(Game const&)=delete; 52 ^ 53In file included from particle.cpp:13:0: 54game.h:77:23: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 55 Game(Game const&)=delete; 56 ^ 57game.h:78:33: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 58 void operator=(Game const&)=delete; 59 ^ 60particle.cpp: In constructor 'Particle::Particle(PARTICLESPIRIT)': 61particle.cpp:16:26: error: 'arc4random' was not declared in this scope 62 this->x = arc4random() % SCREEN_W; 63 ^ 64particle.cpp: In member function 'void Particle::Draw()': 65particle.cpp:68:105: error: 'arc4random' was not declared in this scope 66 al_draw_filled_circle(this->x-this->dx*4, this->y-this->dy*4, this->size, al_map_rgb(arc4random() % 20 + 235, arc4random() % 20 + 235, arc4random() % 20 + 235)); 67 ^ 68particleengine.cpp: In member function 'void ParticleEngine::Update(int, int, int)': 69particleengine.cpp:58:102: error: 'arc4random' was not declared in this scope 70 if(this->count < (maxCount + ghosts + angels) && this->count < MAX_PARTICLES && (int)(arc4random() % 100) >= 80) { 71 ^ 72In file included from plane.cpp:10:0: 73game.h:77:23: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 74 Game(Game const&)=delete; 75 ^ 76game.h:78:33: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 77 void operator=(Game const&)=delete; 78 ^ 79In file included from tribe.h:13:0, 80 from tribe.cpp:12: 81game.h:77:23: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 82 Game(Game const&)=delete; 83 ^ 84game.h:78:33: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] 85 void operator=(Game const&)=delete; 86 ^ 87tribe.cpp: In member function 'void Tribe::KillRandomSpirit()': 88tribe.cpp:102:24: error: 'arc4random' was not declared in this scope 89 if((arc4random() % 100 < 20 || breakOut > 100) && this->purity->spirits > 0) { 90 ^ 91tribe.cpp: In member function 'bool Tribe::RandomlyDetermineUnwillingSpirit()': 92tribe.cpp:145:29: error: 'arc4random' was not declared in this scope 93 int choose = arc4random() % 50; 94 ^ 95tribe.cpp: In member function 'void Tribe::UpdateEnergy()': 96tribe.cpp:344:43: error: 'arc4random' was not declared in this scope 97 this->energy->stock -= arc4random() % 10; 98 ^ 99tribe.cpp: In member function 'void Tribe::UpdateMeditation()': 100tribe.cpp:359:47: error: 'arc4random' was not declared in this scope 101 this->meditation->stock -= arc4random() % 10; 102 ^ 103tribe.cpp: In member function 'void Tribe::UpdateGuidance()': 104tribe.cpp:374:45: error: 'arc4random' was not declared in this scope 105 this->guidance->stock -= arc4random() % 10; 106 ^ 107tribe.cpp: In member function 'const char* Tribe::DetermineEvent()': 108tribe.cpp:601:29: error: 'arc4random' was not declared in this scope 109 int choose = arc4random() % range; 110 ^ 111tribe.cpp: In member function 'const char* Tribe::ProcessEvent(EventChance*)': 112tribe.cpp:629:33: error: 'arc4random' was not declared in this scope 113 deaths = arc4random() % 4 + 1; 114 ^ 115 116c:\ctwoplus\progcode\allegro5\SpeedHack2015entries\Elders_of_Ethos>echo off 117 118c:\ctwoplus\progcode\allegro5\SpeedHack2015entries\Elders_of_Ethos>

Onewing
Member #6,152
August 2005
avatar

Little progress, but I'm (obviously) going to have to get allegro 5 installed on a windows machine. My PC is not connected to the internet and is running Windows XP. I'll have better luck on my work machine which can dual boot to windows. Got to refresh up on makefiles, so that's good. ;)

Fortunately, the only error I'm seeing from Edgar's post is regarding arc4random, which will just need the right include file most likely. The warnings don't look too concerning.

------------
Solo-Games.org | My Tech Blog: The Digital Helm

Mark Oates
Member #1,146
March 2001
avatar

I tried compiling on clang but realized I needed to for solve Cocoa and ended up getting distracted on Facebook. #windowsbuild

--
AllegroFlareallegro.cc markdownAllegro logo
disclaimer: I have no idea what I'm talking about.

Onewing
Member #6,152
August 2005
avatar

FYI, the two .m files (ViewController.m and main.m) can be deleted and are not required for building. I deleted them (apparently, just the reference) from the project and never touched/saw them again, but accidentally blindly copied them into the source I uploaded.

------------
Solo-Games.org | My Tech Blog: The Digital Helm

Mark Oates
Member #1,146
March 2001
avatar

So I've created a build. I had to make a few modifications.

modifications

1

I created a replacement for the arc4random() function, just using rand()

#include <time.h>
#include <stdlib.h>

int arc4random()
{
  static bool initialized = false;
  if (!initialized) { srand(time(0)); initialized = true; }

  return rand();
}

2

Added the *.wav files into the resources file (the game would crash without them).

3

Took out the unnecessary .m files.

4

Compiled with -std=gnu++11

5

Added #include "allegro5/allegro_primitives.h" and al_init_primitives_addon() in main.cpp. The game was crashing without the addon being initialized.

6

Had to go hunt down chintzy.ttf on the internet, and put it in the root folder. The font rendering appears different than in your screenshot, I'm not sure what the cause of this is. A result is that the fonts are quite a bit more difficult to read. It's possible that I grabbed an older version of chintzy.ttf that doesn't render as well.
{"name":"609560","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/e\/3e9951383b82d2eed478b3d5b645e0f1.png","w":838,"h":662,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/e\/3e9951383b82d2eed478b3d5b645e0f1"}609560

7

I did my make like this

CPP_FILES := $(wildcard *.cpp)
OBJ_FILES := $(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o)))

main.exe: $(OBJ_FILES)
	g++ -o $@ $^ -LE:/allegro-5.1.11-mingw-edgar/lib -lallegro_monolith-debug.dll

obj/%.o: %.cpp
	g++ -std=gnu++11 -c -o $@ $< -IE:/allegro-5.1.11-mingw-edgar/include

conclusion

I haven't played the game through, yet, but I'm assuming it will work to the end. Here's the binary (including the DLLs).

Elders of Ethos - Win32

And here's the revised source and makefile I used:

EoE - revised source

--
AllegroFlareallegro.cc markdownAllegro logo
disclaimer: I have no idea what I'm talking about.

SiegeLord
Member #7,827
October 2006
avatar

Got it compiled, and after 1 false start, I managed to win it. That was pretty fun! By the way, you're missing the font (I had to substitute it with a different font without issue).

This is another game that could have used the backspace key ;).

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Mark Oates
Member #1,146
March 2001
avatar

It's possible that I grabbed an older version of chintzy.ttf that doesn't render as well.

Sure enough ;)

I downloaded the chintzy.ttf font from another website and it was a newer verion. It renders much more nicely now.
{"name":"609561","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/4\/24642286653b61209b05da0a93ac2482.png","w":842,"h":662,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/4\/24642286653b61209b05da0a93ac2482"}609561
I've updated the downloads to include the new font.

--
AllegroFlareallegro.cc markdownAllegro logo
disclaimer: I have no idea what I'm talking about.

Edgar Reynaldo
Member #8,592
May 2007
avatar

Bruce Pascoe
Member #15,931
April 2015
avatar

I'll have to try this now. The screenshots look very 90s-retro (that's a good thing). Like a Wolfenstein 3D-era DOS game. :)

Mark Oates
Member #1,146
March 2001
avatar

Oates, your first download link gives a 404 not found error. The second source link works though.

Yikes! Sorry about that. Fixed now. Here's that link again:

Elders of Ethos - Win32

--
AllegroFlareallegro.cc markdownAllegro logo
disclaimer: I have no idea what I'm talking about.

GullRaDriel
Member #3,861
September 2003
avatar

SiegeLord said:

This is another game that could have used the backspace key ;).

Yes!

That aside it was a nice polished entry. A bit monotone but it's not crashing and the ambiance is cool :-)

Thanks Mark for the Windows build ;-)

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Peter Hull
Member #1,136
March 2001

Mark: On the subject of arc4random, I don't think your implementation is strictly correct

int arc4random()
{
  srand(time(0));
  return rand();
}

Reason (from cppreference)

Quote:

Generally speaking, the pseudo-random number generator should only be seeded once, before any calls to rand(), and the start of the program. It should not be repeatedly seeded, or reseeded every time you wish to generate a new batch of pseudo-random numbers.

I think it actually doesn't matter here because the time between each of the user's entries is going to be random anyway.
Since we're in C++11, might as well use <random>:

#include <random>
#include <stdint.h>

static std::uniform_int_distribution<uint32_t> uni;
static std::default_random_engine engine;

uint32_t arc4random() {
  return uni(engine);
}

Onewing: I've got a Linux makefile if you want.

Cheers,
Pete

Mark Oates
Member #1,146
March 2001
avatar

Mark: On the subject of arc4random, I don't think your implementation is strictly correct

You are correct, it isn't. I wasn't in the business of creating the ideal PRNG, just make a random number generator and make it work. My implementation of arc4random() doesn't meet the specification of the original arc4random() (return uint32_t for example), but it does adequately meet the requirements of its use case in the game.

--
AllegroFlareallegro.cc markdownAllegro logo
disclaimer: I have no idea what I'm talking about.

Peter Hull
Member #1,136
March 2001

but it does adequately meet the requirements of its use case in the game.

Well, yes and no. On my Linux it makes the particles go all in a line - and maybe affects the gameplay too, I couldn't tell.
{"name":"609564","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/5\/258550c9e7f0d5b59382a8404ea08a63.jpg","w":1600,"h":1200,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/5\/258550c9e7f0d5b59382a8404ea08a63"}609564

Mark Oates
Member #1,146
March 2001
avatar

Interesting. :-/

--
AllegroFlareallegro.cc markdownAllegro logo
disclaimer: I have no idea what I'm talking about.

devo_au
Member #15,282
August 2013

Spent 20 minutes getting 10 from purity to the top. Had some weird shit going on with meditation requiring every follower to rest at one point before stabilising and moving them back to other disciplines. Good speedhack entry, well done.

it wasn't me, it was other kids

Peter Hull
Member #1,136
March 2001

Aha! I see the definition of arc4random you gave in your spoiler isn't the same as I found in your source zip file; with the addition of the if (!initialized) bit, yes, I agree, it should work perfectly fine!
Cheers,
pete

 1   2 


Go to: