Jump to content

  • Log In with Google      Sign In   
  • Create Account

The Inner Circle

Music FTW

Posted by , 06 December 2015 - - - - - - · 1,042 views
music, openal
Music FTW

"It'll only take an hour and it'll make this feel like a real game," I said last week. I was off by an order of magnitude on the first count, but it was worth it.

 

OpenAL streaming is tricky. The Programmer's Guide example was sketchy as hell, so I took an example from the OpenALSoft source, adapted it to use libsndfile to read OGG, FLAC, etc, and rewrote it to fit my game. My original SFX code was crap so I rewrote that too, dropped a dependency (ALURE: fancy C++ OpenAL helper lib), and added a Playlist class and playlist scripting in the scene parser, with per-track repeat count & volume. Good to go!

 

One slight problem when playing OGG: I hear a crackling noise whenever there's a peak (clipping) in the input waveform. I've noticed that in some released games too. I narrowed it down to OGG+sndfile and did some searching... some MuseScore devs figured it out 2 years ago: it's a libsndfile bug that'll be fixed if version 1.026 ever gets released. I could take my chances with the dev version. But... LibSndFile requires libogg & libvorbis which I never got to work in my Windows build; it's trouble. More likely I'll switch to stb_vorbis if it works ok; there'll be some extra buffering complexity between it and OpenAL but it's just one C file. Word.

 

And I did some recording this morning...

 

Here's a preview > https://soundcloud.com/tnovelli/fine-companion

 

I don't know about you but I can listen to that over and over. I think it'll make the final cut for one of the safe (-ish) areas in game. Apparently it's from an early 1600s play about a douchebag slacker guy, however, it reminds me more of the Companion from Firefly... and what RPG would be complete without the oldest of professions? :D

 

1 down, 5 more like that on my list, and 10+ originals to go... a few in that style, some edgier stuff for dangerous areas, heavy metal for combat, and foreboding silence in the woods, swamps, etc.

 

And... what a difference from the old days! Remember when music was all tinny OPL synths and MOD/S3M/IT?




Color.. not that simple

Posted by , 28 November 2015 - - - - - - · 896 views
color, perception, theory
Color.. not that simple Last year when I started drawing characters for my "Cult RPG", I noticed how the standard RGB and HSL/HSV color pickers are no good at selecting real-world colors. So I studied up on color perception. The good news: this problem was solved 100 years ago. Bad news: software developers are still in the dark. So, fellow devs, check it out...

I won't go into all the details. Here's a good visual overview of the "color spaces" I'm talking about: http://www.colorbasics.com/ColorSpace/. And if you want to read some code, https://github.com/fponticelli/thx.color looks like one of the more complete colorspace conversion/manipulation libs, but I haven't looked closely.

To see just how bad RGB/HSL are, try to draw your skin color in a paint program. Using HSL, you have to guess at the closest hue (red-orange, if you're lucky) then adjust the saturation & lightness toward a tan or brown. Then tweak H toward red or yellow, then readjust S and L. Unfortunately there's no way to add a little pink, or vary between tan and brown; you have to move all 3 sliders blindly.

The crux of the problem: HSL shows a 2D gradient of shades for a given hue (e.g. black-white-orange) and a 1D scale of hues (a rainbow).

Can we have a 2D view of hues and a 1D black-white scale?
Yes. The old XYZ colorspace from 1931 does exactly that. LAB and LUV and LCH are improvements on it.

Color picker implementations

I wrote a JQuery perceptual colorpicker plugin (pictured above). I use it in my homebrew game graphics editor. It's not great but it's an improvement.

GIMP recently added one. It's too small and glitchy as of GIMP 2.8.10, but it's a start. I think Photoshop did it better and slightly sooner.

The ideal would be a huge perceptual colorpicker filling half the screen (with room to view your artwork in the other half), zoom controls for fine-tuning the hue, and smaller RGB/HSL/etc colorpickers so you have all the options.

What matters

RGB monitors can only represent a subset of the colors we can see in the world?
Yes, it's true, but there's nothing you can do about it when you're making game art.
"Wide gamut" monitors can represent more colors...
Most LCD monitors have bluish white backlight LEDs, but you can get professional color-calibrated monitors with wide-spectrum backlights and IPS panels; basically they fill out the red side of the spectrum. I have one (Dell U2413) and it's nice... a huge improvement over cheap monitors. But for gaming I'd opt for a high-refresh TN panel instead. I have one of them as well, and I can barely tell the difference, and I have eagle eyes (when I'm wearing my glasses).
So, a "pro" monitor is nice to have, but any decent monitor will do.

Which colorspace - LAB vs LCH vs LUV?
CIE LAB is the standard colorspace you'd use to tell someone an exact color. But the math is more complicated. LUV is simpler and corresponds more closely to RGB monitors. LCH is a more uniform version of LUV, with fancy math.
LUV is good enough for picking colors for game art.

Saving colors... RGB or perceptual colorspace coordinates?
Standard 24-bit RGB "#aabbcc" notation is adequate for any color a monitor is capable of displaying.

Colorspace conversion math is overkill.
To convert RGB to LUV (etc), you do a matrix transform to XYZ then another transform to get to LUV.
That's overkill for a color picker. I could probably come up with a simpler colorspace with a one-step RGB conversion formula but I haven't gotten around to it. Maybe someone else has.


Finishing the job

Posted by , 14 November 2015 - - - - - - · 1,198 views

Finishing the job I've been getting back to my main game project after a few months of home renovations. It started when I bought some drums and moved my studio to the basement. Then I had to put in a sump pump. Then I was on a roll so I started scraping off the ugly ass 50s wallpaper in my hallway, patching up the century-old plaster, painting, and wrapping up some other little unfinished projects. It never ends, but I like to alternate between programming and manual labor so it's allright. And it's sweet having a basement studio/workshop, away from the office. Keepin' my work and play ..other work.. separate. Posted Image

So I finalized the story/dialogue system, complete with speech bubbles... layout needs work but the UI is 100% functional. And I overhauled the rendering pipeline. Not much to show in that regard, but there's an OpenGL stencil mask around the eyes to clip the iris & pupil, and sprites are split into tiers from back to front (backdrop, scene, set, actors, objects, etc) kinda like a theatre production. That was mostly a matter of changing the scene file format and parser. There's not much of a system to it. The render loop is one big special case, with potientially 2 or 3 procedural graphics tiers mixed in. Combat collisions are only actor-vs-actor and actor-vs-object. Motion collisions are only actor-vs-set. Shrug. No need to over-generalize.

Attached Image

There are problems I decided not to solve. This game is what it is: pure 2D, fast paced, close-up, action RPG, with freakin' vector splines in realtime... that's enough. I could go part-3D and rely on depth buffering to solve draworder problems, since it has become clear that my old HTML5 Canvas version of this engine is hopeless performance-wise. Some glitches are acceptable. And I don't even want this game to look too sexy. People like us can't compete on that front, when every other thumbnail on GOG, Steam, Youtube and Netflix is T&A clickbait... which means crap content anyway. So in a way that makes creative decisions easy: when in doubt, female NPCs shall wear pants. Animating those skirts is a pain in the ass by the way. Long dresses, forget it except in scripted setpieces. I tried, I failed. This is a very limited engine. It's meant to be fast and not to overshadow gameplay.

(I haven't completely given up on HTML5... Firefox and Chrome are bloated and rotting, but now we have PaleMoon (salvaged from the wreckage of Firefox) and some other serious contenders. I don't bother looking for HTML5 games to play anymore because 99.99% of them are utter crap; but if I happen to hear of a good one I'll give it a chance. I'm not hopeful about HTML5. It's not my first or second choice... but it's still an option... and I'm still doing a little maintenance on HTML5 projects I started.)

The other day I felt inspired to crank out a backstory. It no longer takes place in a cult (glad to be rid of that old RPG cliche!) ... but it's still governed by a Machiavellian inner circle, and it's still a microcosm of society - the concept that spawned this whole project.
Time to get on with maps and gameplay... then writing, art, music... and release it. New ideas can wait til the sequel, if there is one.

I'm tempted to make a classic turnbased CRPG next... with crappy (but vibrant) graphics... not even iso. It's in the planning stage. Here's a very early prototype: http://tnovelli.net/junk/rpg3a


The new language

Posted by , 13 June 2015 - - - - - - · 1,009 views

Making a new language:
  • brainstorming, code mockups
  • feature triage
  • design specs
  • experiments
  • implementation
I've been iterating on the first 3 steps for a year, my specification is pretty well nailed down, and now I'm laying down plans for a compiler. Turns out I'm closer than I thought. In 2010 I was experimenting with a Lisp-APL hybrid, then I had some doubts about Lisp so I set it aside unfinished. But the main parser/compiler functions were working, and that's all I need for a gamedev language without Lispy stuff like closures and GC. However, for games I'll need the ability to write game code that links with C/C++ libraries, and to that end I dug up some old ELF loader/linker code from my 2003 osdev projects. Still works, just needs some 64-bit support. So I'll do a few experiments with that, let the design stew for a few months, then try to bang out a working prototype in a week whenever I'm able to clear the decks.

Gotta say gamedev has been incredibly liberating. Compilers are easy compared to games and game engines. Text files in, machine code out, no big deal! Posted Image


Online map editor - review/planning

Posted by , 18 October 2014 - - - - - - · 720 views

Online map editor - review/planning I'm getting ready to combine and improve some HTML5 Canvas stuff I prototyped two years ago - Ocean Melee / Great Guns and the 2D character animation modeler for the future "Cult RPG" (crude demo here). My ultimate goal is to create complete online editors for both games, and other games... a separate editor app for each game, and some shared core libraries.

For starters, I want an online map editor for OMGG so I can start recreating historic naval battles. The old map+ship graphics are Inkscape SVG... it kinda works, and I've written SVG load/render code in both JS and C++, but I never felt right about any of it. I vaguely remember a major WTF about certain "modern" browsers failing to parse SVG (XML) correctly. Anyway, I only need to display scanned map images, scale/rotate them into position (rubber-sheet orthocorrection not necessary), and trace over them with polygons and splines. Ships will just be splines, with hidden collision polygons. No need to import the old graphics - it was just rapid prototype stuff.

The character modeler lets you draw spline shapes, choose fill/outline colors, and edit some metadata. There's also a bunch of skeleton animation stuff tied into it. It saves/loads JSON files via a tiny PHP backend.

I've also ported the cultRPG spline renderer (used in modeler & demo) to C++, which forced me to use "primitive" data structures... namely lots of interleaved [x0,y0, x1,y1, ...] point arrays like OpenGL requires, which I'll need in JS if I port any of this stuff to WebGL. It goes against a lot of compsci theory and best practices, but this is definitely a change for the better.

Server stack constraints: assume only PHP 5.4+ and MySQL. NodeJS should also be available for some build scripts.

Well, that's what I've got to work with, so here's the plan:
- Rewrite the modeler.
- Animation stuff as a separate library. Don't need it cluttering up the OMGG editor. Need it for cultRPG, so do implement & test it - don't kick it down the road.
- Shape editing library - splines (existing), polygons, images/textures.
- Save to MySQL instead of JSON files. Versioned structures TBD. For now, KISS.
- Incorporate OMGG build scripts into the PHP backend. One-button test build & launch game in new tab.
- Incorporate cultRPG model format exporter (because C++ + JSON = headache).
- PHP+MySQL user account system.
- Access control, just enough so I can let a few artists into the system. Posted Image
- Deploy to a public server and get crackin'...

P.S. - those dashed red and green lines you can see if you click the map thumbnail - I don't even want those anymore. Just the shoreline. I had an idea of tracing 5-foot and 20-foot depth contours and LERPing between them to see if you've run aground. That way a Navy frigate could wreck on a reef while a shallow-draft pirate schooner escapes, for example. But it just makes the gameplay confusing, so forget it! :D


Scripting

Posted by , 02 September 2014 - - - - - - · 671 views

I just read @rbritt's journal entry about scripting... and I said, check out LuaJIT. If in doubt that's what I'll use for my C++ game. But I really want to roll my own. I've been messing with language design & implementation for 20 years on and off. I've done it before, I can do it again. Might even be practical. But it won't be anything special. So why bother?

Well, coding a simple compiler is nothing compared to coding a substantial game; weeks vs years. Being a game script lang helps keep it simple. And I don't have to worry about a user community; it's just me and my game and a few demos.

Ultimately <uncharacteristic optimism> I hope there'll be languages that are less than ideal, but popular and standardized AND simple enough that any decent programmer can write a compiler that'll run any code written in that language. Forth was kinda like that, and I think we can do better... simple but more mainstream. Unlikely, but maybe my language will be a big hit. Maybe I'll find some other language I like, write a better compiler for it, and suggest a few tweaks. Maybe other people do all that before I get around to it, and I catch a free ride. Doesn't really matter. Any of that would be better than the most likely outcome, </optimism> that all languages will suck forever and ever, so get used to it. But that's no reason to give up. If this problem is ever going to be solved, who's gonna solve it? Gamedevs!


Archery

Posted by , 22 March 2014 - - - - - - · 811 views

Archery Sweet... I've passed another architectural milestone. Archery required a bunch of details: weapon slots, Bow subclass, lightweight Missile subclass, gravity, collisions. It's all working as intended. Now the other weapons will be a cakewalk.

Next, movement controls... it's time. Then sound and scoring. That's all this game needs to start being fun.

(Why so many arrows, you ask? That's how it was really done in combat, according to videos of Lars Andersen, Turkish archery techniques, etc... pretty cool!)

P.S. - I finally added a pause button.. handy for screenshots!


Revamped animation and a sweeeeet new control scheme

Posted by , 16 March 2014 - - - - - - · 887 views

Revamped animation and a sweeeeet new control scheme My animation system needed rethinking, as it didn't quite fit the gameplay, plus it was overcomplicated. So I let that stew all week until I had something worth coding in C++ yesterday.

First step was to ask: what controls do I want? A: Simple ones!
Just gamepad Dpad+ABXY or keyboard WASD+arrows. Nothing analog. Aim by moving around, emphasis on timing.

hmmm.... 4 attack buttons, 4 arms and legs.
Not QWOP-style though - running's instinctive! So, A=left jab, B=right cross, Y=kick... or hold the button to grapple... X to pull your opponent toward you. All kinds of *natural* combos emerge. Down-up-B=uppercut. Y-B-X=trip. A+B=head grab, X+Y=knee smash... awww yeah!

With this scheme, animation makes sense. Originally, I had a stack of animation cycles - stand, run, jump, sword swing, sword thrust - which could each control any combination of bones in the skeleton. Now there's ONE looping "base action" cycle (stand, run, fighting stance) for the whole body, and ONE temporary override cycle (punch, kick, etc) for each arm and leg and the head+torso. Temporary overrides correspond directly to the attack buttons... although some attacks control 2 or 3 limbs. For instance, the torso leans forward to give right-hand attacks the same reach as left-hand attacks. Realistic? Hell no - but it *feels* realistic. I take that as a damn good sign I'm on the right track. Posted Image

Next: collisions...

In the demo I made for LD26, I did line-intersection tests between all bones of each character. Weapons dealt damage, and *any* collision caused a 50-pixel knockback. You can't walk past each other. It's also too easy to impale yourself on the enemy's sword with them even trying. So... now I'll *only* do collision tests on *attacking* weapons (including hand/elbow and foot/knee)... and I want more body hits, so arms will only protect you if you execute a well-timed block (X+A?)
Then... gore!

I just remembered... in HTML5 Canvas I showed cuts as red dots because I couldn't draw accurate cuts without killing performance. If I just drew a red line across on arm, it'd stick out into the air. Now, with the OpenGL rendering technique I'm using in C++, I've got this lovely stencil buffer to crop it. So that's cool. And if I can be a really productive coder... a powerful slash delivered to a wrist, elbow, neck, etc, will sever said appendage and blood will spurt out of the stump -- in the adult version with the badassery knob cranked up to 11. Posted Image


C++ porting progress

Posted by , 09 March 2014 - - - - - - · 984 views

C++ porting progress Did some more porting this weekend... C++ version is now able to load & render a character model from my HTML5 Canvas demo (far right screenshot, in Chrome). A few glitches to debug, but it's basically done. Performance is better indeed... 3% CPU with one character, probably 10% during busy gameplay -- versus 60% in HTML5.

Next: animations, keyboard/gamepad controls, and collisions.

Hoping it won't be a total pain to do a Windows build so I can run this on my laptop at a local gamedev get-together on Tuesday.


Some concept art

Posted by , 04 March 2014 - - - - - - · 792 views

Some concept art Feeling inspired. Made a few Inkscape mockups & freehand sketches for my most ambitious project. It's a sidescrolling RPG with intricate AI and hand-to-hand fighting.
Unlike my topdown sea shooter, this game is too demanding for HTML5, so I've begun porting the engine back to C++/OpenGL. This allows for easily 1000% more visual complexity if needed, and I could use some shader magic for fog, blur, lighting, hair, etc. I have a decent browser-based drawing program I'd like to keep (I'll switch from Canvas to WebGL if necessary). That would be a distraction at this stage, though, so I'm using Inkscape/GIMP/etc to explore a wider range of possibilities.

Attached Thumbnails

  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image







December 2016 »

S M T W T F S
    123
4 5 678910
11121314151617
18192021222324
25262728293031

Recent Entries

Recent Comments