GDR Forum Index
Podcast Podcast
Dev Dev Logs
Search Search
RSS RSS
Register Register
Log in Log in
Reply to topic GDR Forum Index -> Game Developer's Refuge -> Development Log - Rogue-Opcode game framework Page 1, 2  Next
View previous topic :: View next topic  
Author Message
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sun Jun 14, 2009 10:15 pm    Post subject: Development Log - Rogue-Opcode game framework Reply with quote

So what's all this then, you may be asking?

As some of you will recall, I got a pretty sweet deal this summer, with a paid "research" position making games. Well Rogue-Opcode is the framework I am building to support this end. I've been kinda keeping this under wraps until I really had something worth talking about, so only a few people even know this exists. A little while ago, I decided I was overdue for a proper version control repository. I had gotten to the point where I had done enough work that I would be super bummed if my hard drive crashed, or I made some crazy change that ruined every other system.

I decided to go with Google Code hosting for a variety of reasons: remote backups and revision history, access to my code from any computer, free webspace for a wiki and code downloads, and really it's just soooo much more friendly that SourceForge. My project is free/opensource, because it's being funded as an academic research project, so that fits in nicely with Google's OSS policy. But because it's a publicly accessible repository, I didn't want to just throw my code up there as it stood. See, this framework is drawing together about 6 or 7 unrelated projects that I've written at various times over the past 5 or so years, updating and adapting them, in addition to all new stuff I'm adding. Aside from differences in the quality of code, and the kinds of techniques I was using, I have varied my file and identifier naming conventions quite a bit over the years. So I took a couple days to clean up the code and then pushed it onto my new google mercurial repo.

Since then, I've made quite a bit of progress in various interesting areas. In general, I have been feeling like I've been kinda dicking around. But when I took the time to log all the changes I made for a particularly epic code commit, I realized that I have actually been getting quite a bit done, from day to day. Seeing everything I'd accomplished laid out in writing was a real psychological boon when my confidence was starting to wane. That's when I realized the true use of the dev log post: to help the programmer stay sane, by letting him know he's actually accomplishing something.

Thanks for letting me vent. More specific updates on what I'm up to (and maybe some pictures from time to time) will follow.

http://code.google.com/p/rogue-op/
http://newcod.uberfinity.com/bt
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
sonrisu
Moderator

Joined: 31 Aug 2005
Posts: 4970
Location: Silicon Valley!
PostPosted: Sun Jun 14, 2009 10:31 pm    Post subject: Reply with quote

Nice.

Also, that's the badassest of badass moustaches I've seen. Please say it is actually on your real face. You will gain win points.
_________________
loomsoft :]
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sun Jun 14, 2009 11:27 pm    Post subject: Reply with quote

I have good news for you... +10 internets, please.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9380
Location: Not Finland
PostPosted: Mon Jun 15, 2009 3:10 am    Post subject: Reply with quote

Quote:

That's when I realized the true use of the dev log post: to help the programmer stay sane, by letting him know he's actually accomplishing something.


Yeah, that pretty much nails it. It's entertaining for others to read, but it's a life saver for the developer.
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Mon Jun 15, 2009 11:18 am    Post subject: Reply with quote

Well now I know. And knowing's half the battle! So without further ado, adieu, or uh-doo, here's some of what I've been up to:

I pushed an initial commit of the entire codebase. Much of the code hadn't really been touched in at least a couple years, and some of it even longer. So I cleaned it up, normalized my naming conventions, and made sure it all at least compiled. This push also included several weeks of new development, including application logic management, a generic render manager, a custom scripting language and VM and, because it's all publicly downloadable, license info and a patent disclaimer (just in case).

A good deal of the codebase was written specifically toward Allegro. This is not such a bad thing, since it runs almost anywhere, and supports GL rendering if I need it. In fact, much of the code was canibalized from a similar if somewhat less ambitious project I'd started a while back that I was simply calling AllegroLib. The downside of this is that I I am targeting the iPhone in addition to LinMac'dows, so Allegro can't work as the one-size-fits-all solution I was hoping for. I was looking at SDL briefly, but decided to stick with Allegro and just use GL for graphics and isolate all the other platform-specific code. I've made a lot of progress in that direction.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Madgarden
Contributor

Joined: 31 Aug 2005
Posts: 324
Location: Kitchener, ON, CA
PostPosted: Tue Jun 16, 2009 6:29 pm    Post subject: Reply with quote

I've used Allegro to great effect while working on the iPhone version of Saucelifter, since 97.5% of the code is platform agnostic anyway. One-size solutions are way overrated. I mean, just look at Java. ;)
_________________
I know it sounds crazy, but it JUST MIGHT WORK
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Tue Jun 16, 2009 7:00 pm    Post subject: Reply with quote

Some updates with my synth module:

I switched over to floating point values centered around zero, internally. It's just way easier this way, even though the final output is 8-bit and unsigned. Fewer artifacts, too.
I have 8 distinct waveform generators, now:
  1. Square
  2. Saw
  3. Triangle
  4. Sine
  5. Tan
  6. Hemicycle
  7. Noise (AM)
  8. Noise (FM)

They are controllable via frequency, amplitude, duty cycle and phase shift, and can be modulated by another oscillator (frequency, amplitude or phase).


Signals can be mixed with different modes. They can be added:


Or the mean taken:


One waveform can mask out the other:


Or it can be used to mask out the rest of the amplitude space:


Some other basic effects are now available. I have an amplitude-coupled distortion effect, that proceeds from light fuzz to chaotic, as the amplitude of the signal increases beyond a programmable threshold. (Alternatively, a secondary oscillator can be fed to the amplitude input, to cyclically modulate the distortion intensity of signals at any amplitude.) You can see the blue "clean" signal peeking through from behind the fuzz below:


These can all be combined. Square wave, 0.75 duty cycle + sine wave (mean), amp coupled distortion:

_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Madgarden
Contributor

Joined: 31 Aug 2005
Posts: 324
Location: Kitchener, ON, CA
PostPosted: Tue Jun 16, 2009 7:03 pm    Post subject: Reply with quote

Something must be broken. All I see are squiggly lines.
_________________
I know it sounds crazy, but it JUST MIGHT WORK
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Gil
Developer

Joined: 14 Nov 2005
Posts: 2341
Location: Belgium
PostPosted: Tue Jun 16, 2009 7:17 pm    Post subject: Reply with quote

Awesome squiggly lines though. There's something about oscillators that I find extremely cool and seeing lots of waveforms triggers that part of my brain.
_________________
PoV: I had to wear pants today. Fo shame!
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Wed Jun 17, 2009 11:08 am    Post subject: Reply with quote

I added a duty modulated mode, where you can modulate the duty cycle of an oscillator with the amplitude of another. Took me a while to get the modulation expression just right, but it sounds really neat, kinda like when a power tool doesn't quite bite into a piece of wood, and kinda bounces and scrapes on the surface...
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Wed Jun 17, 2009 3:13 pm    Post subject: Reply with quote

Prototyped two new FX. Scaled overdrive and pixelator:


Overdrive multiplies the input signal by 2.2 and then clips it at +/- 1.0, then scales it to the original volume. This way you get some nice oldskool distortion that kicks in around 50% volume and intensifies as you crank it up. Pixelator multiplies the sample by 10, rounds it to an integer, and then divides the result by ten. The result, as you can see, is that the amplitude is clamped to one of only ten possible values, resulting in a very blocky waveform. It sounds pretty awesome.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Thu Jun 18, 2009 1:28 pm    Post subject: Reply with quote

Roughly prototyped envelope control in the test app. It works great, but I'm just applying a multiplier to the global volume, so amplitude sweeps are at buffer_size time resolution and are kinda choppy. It'll be silky-silky smooth when I make a proper envelope structure and move the calculations into the master synthesis routine.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9380
Location: Not Finland
PostPosted: Thu Jun 18, 2009 3:08 pm    Post subject: Reply with quote

Waveforms are teh sexy :)
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Fri Jun 19, 2009 3:06 pm    Post subject: Reply with quote

After struggling with several totally braindamaged bugs, I got envelope control moved into the synth core. It is silky, silky smooth, as promised :)
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sat Jun 20, 2009 6:56 pm    Post subject: Reply with quote

I've started working on the AI components. So far, it looks like the lineup is going to be Genetic Algos, Classifier Systems and Artificial Immune Systems. It should be pretty straightforward to create lightweight, reusable components in a generic way using a combination of polymorphism and templates. I want this to be as dead simple as possible, but it should be possible for the user to define a genome and how to decode it, drop that in, and have an operating computation mechanism.

Alas, I'm feeling a bit of writers block at the moment. I would just take the weekend off from programming, or work on something else instead. But I have a meeting with Dr. Lewis on Monday morning, and I want to have something to show him. At the very least it will be useful to have him say, "Yes, like that," or, "No, do it like this."

So progress is slow, and concentration is wavering, but on I slog. Ideally I'd like to have the most basic functionality of the classes in place with a toy demo of some sort. I can do this...
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sun Jun 21, 2009 12:34 am    Post subject: Reply with quote

I named the AI module Smarty :)

After talking things out with a friend of mine, I gained some perspective here. And suddenly writing code became a helluva lot easier. Everything that is application-dependent is abstracted away in a pure virtual method, a template, or just completely omitted from the base classes. This keeps it lean, clean, and clearly delineates what is core AI functionality and what is domain specific.

I have most of the core classes written in what I imagine to be pretty close to a complete state. The next step will be to write some toy implementations in a test app, and see what, if any, additional functionality really belongs in those base classes. This is also where I will find out if I actually know what the hell I'm doing here.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9380
Location: Not Finland
PostPosted: Sun Jun 21, 2009 5:20 am    Post subject: Reply with quote

Quote:

This is also where I will find out if I actually know what the hell I'm doing here.


:P I've said that to myself so many times in the past!
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Mon Jun 22, 2009 12:40 am    Post subject: Reply with quote

Ah, the joys of figuring out how to write something by writing it...

The AI stuff is being a much larger pain in my arse than I had expected. The up side is that I figured out a much simpler way to structure things than I originally was using. The down side is that converting it over to a manageable structure is almost worse than using it how it was.

But then again, this is pretty much exactly why I am doing it this way: I don't really know what I'm doing, so I gotta just see what works. Hopefully I won't have to dump it all and start from scratch, but the zen prototyper in me wants to say that that would be ok...
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Thu Jun 25, 2009 3:13 pm    Post subject: Reply with quote

After 5 days at a grueling pace (no cholera, but Timmy did break his arm) I finally have the artificial intelligence stuff working... intelligently. This is one of those subjects where the devil is definitely in the details, and he's kinda surly.

I had something of a breakthrough this morning around 4 or 5 AM, when I got the genetic algorithm and the action selection algorithm that drive the classifier system to behave a bit less deterministically. This added bit of (weighted) uncertainty spells the difference between an infinite loop and finally making its way to the goal. The results were rather inefficient, but I was at least able to consistently get results.

I met with Dr. Lewis at 11, and I showed him what I had come up with. He said he was impressed because most people struggle to understand this technique over the course of a semester, and I had done it in the 2 weeks since our last meeting. What's even more impressive is that I had only actually been working on AI stuff for less than one week. That's a nice stats buff, since I have been rather concerned than I didn't really understand the subject that well (or at all). We discussed the various variables that were tunable to control the overall behavior of the system. We tweaked a few lines of code, and he described a few novel strategies for reining in the randomness of the system when we are close to an optimal solution.

After our meeting, I changed a few things around, and immediately got beautiful results, without needing to resort to the more exotic tuning solutions. Part of this was the result of fixing a pointer bug, which allows me to now keep a longer history of previous moves. In more complex applications, his ideas may still have merit, so I will investigate those as well.

Now, because we all like looking at something concrete:
Code:

100 Rounds
Number of Moves Each Round:
0: 59
1: 7    <-- GA didnít run here. Buckets mustíve buffed a loser.
2: 191
3: 68
4: 63
5: 6    <-- Dramatic improvement to optimal
6: 6
7: 6
8: 6
9: 6
10: 6
...
98: 6
99: 6


100 Rounds
Number of Moves Each Round:
0: 74
1: 50
2: 155
3: 48
4: 138
5: 76
6: 64
7: 135
8: 151
9: 10
10: 82
11: 219
12: 28    <-- huge genetic improvement
13: 8
14: 6    <-- bucket brigade brings it home
15: 6
...
98: 6
99: 6

The above run is interesting because I printed out everything the bot did, and it displayed a behavior I hadnít even conceived of--as it moved along it activated the claw at each space it visited, ensuring it would grab any cups along the way. Because the message queue allows it to effectively make two actions per turn, this is a pragmatic strategy that adds trivial computational overhead. Awesome.

_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sun Jun 28, 2009 1:21 am    Post subject: Reply with quote

I'm in the process of integrating all the generally useful bits that I discovered while writing the Smarty test app into the main classes. When this is done, the next step is a more complex test: Froggy!

Froggy will be a nice step up in complexity because, while the basic problem of navigating to a goal will be the same, it will introduce the aspects of time progression, an interactive environment, and negative feedback (getting hit by a bus is always a Bad Thing) without becoming too large.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Wed Jul 01, 2009 10:26 am    Post subject: Reply with quote

Froggy is up and running. With stationary cars, it usually survives more than 95% of the time, with a run of 1000 rounds. Now that I've got it somewhat tuned, it's time to make the cars start driving, and see how miserably it fails :)
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Wed Jul 01, 2009 10:41 am    Post subject: Reply with quote

oh, and here's the layout of the stage:
Code:
static const string initial_world[] =
{
    "..........",
    "CC=CC=CC=C",
    "..........",
    "==C==C==C=",
    ".........."
};

Dots are safe areas. Froggy starts out at the bottom (of course). Equal signs are road, C is cars. Getting to the next level of dots gives the Classifier System a small reward, getting to the top gives a big reward, and colliding with a car gives a big negative reward and resets the simulation.

The cars will be moving in opposite directions. When I've got that working pretty well, I'll work on expanding the playfield. I'm not sure how closely I really care to reproduce actual frogger maps, but some of their design elements could pose interesting challenges to the AI.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Wed Jul 01, 2009 1:12 pm    Post subject: Reply with quote

Moving traffic, slightly expanded gameboard, reduced move history to 1:
Froggy wrote:
1000 Rounds
Died 840 Times

Not bad for 10 minutes of work.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Wed Jul 01, 2009 1:34 pm    Post subject: Reply with quote

Seems to perform best with a history size of 3 or 4:
Froggy wrote:
1000 Rounds
Died 8 Times

That's a 0.8 percent death rate. That's a better record than I have in Frogger ;) Of course, this is still a much simpler test, so we'll see how far we can push this thing.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sun Jul 05, 2009 9:07 pm    Post subject: Reply with quote

Turns out my early optimistic results were kinda tainted. I made the world bigger, but I forgot to move the goal back. It was declaring victory prematurely, while still in the middle of a busy traffic lane, thus achieving stellar results.

After way too much time hacking on this thing, I have it displaying generally reasonable behavior, and it survives in the 50 - 90% range. That's a pretty wide range, which means it's still pretty unstable. It's trickier than I had anticipated to find a balance between adaptability and stability.

Additionally, I am getting a lot of bizarre errors related to my use of STL containers. I get a bunch of different runtime and system-level exceptions that show up intermittently. None of it makes any sense. I am almost ready to say "fuck you" to the STL and write all my own data structures. Does anyone know of a good, reliable, lightweight (i.e. not BOOST) library of such things, which are so awesome I really shouldn't bother with my own?
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Reply to topic GDR Forum Index -> Game Developer's Refuge -> Development Log - Rogue-Opcode game framework Page 1, 2  Next

Use this link to get a Sign-On Bonus when you get started!

All trademarks and copyrights on this page are owned by their respective owners. All comments owned by their respective posters.
phpBB code © 2001, 2005 phpBB Group. Other message board code © Kevin Reems.