• ### Blog Entries

• entries
14
15
• views
10588

Beginning game programmer and musician, procrastinating extraordinaire.

## ...More Terrain

So today I decided to implement this rendering list I've been thinking about for the terrain quadtree. After some mucking about I came up with a pretty awesome method that maintains a static list of nodes. This way I only add/remove nodes that have either become hidden or visible since the last frame rather than rebuilding the entire thing every time. This only applies generally to 10 or less nodes a frame so it ends up being pretty fast. Most of the nodes also stay in order which cuts down on the sort run time as well.

This bit of code isn't long, but I'm particularly proud of it for some reason:

private void FillList(){    if (CameraManager.ActiveCamera.Frustum.Contains(mNodeBoundingBox) != ContainmentType.Disjoint)    {        if (mIsEndNode)        {            mDistance = Vector3.DistanceSquared(mPosition, CameraManager.ActiveCamera.Position);            if (!mIsListed)                mRenderSort.Add(this);        }        else        {            mNodeUL.FillList();            mNodeUR.FillList();            mNodeLL.FillList();            mNodeLR.FillList();        }        mIsListed = true;    }    else if (mIsListed)        RemoveChildren();}private void RemoveChildren(){    mIsListed = false;    if (mIsEndNode)        mRenderSort.Remove(this);    else    {        mNodeUL.RemoveChildren();        mNodeUR.RemoveChildren();        mNodeLL.RemoveChildren();        mNodeLR.RemoveChildren();    }}

You guys are probably starting to hate pictures of the same old terrain, so I promise this will be the last one. Tomorrow I move on to something new!

Just got back from a Radiohead show. at the hollywood bowl. fucking mindblowing. the bowl is a pretty awesome place as well:

exit music was great and is probably my new favorite radiohead song. they did a completely out of control version of idioteque. I felt like i was at a justice show. paranoid android is pretty much the perfect rock song. street spirit was another classic although I was really hoping to hear an acoustic version of it. the acoustics were busted out for wolf at the door and faust arp however. the show ended with johnny greenwood and ed o'brien doing a drum machine/synth "everything in its right place" jam which was a perfect ending to the night.

set list:

1. 15 Step
2. There There
3. Morning Bell
4. All I Need
5. Pyramid Song
6. Nude
7. Arpeggi/Weird Fishees
8. The Gloaming
9. The National Anthem
10. Wolf at the Door
11. Faust Arp
12. Exit Music
13. Jigsaw Falling into Place
14. Idioteque
15. Climbing up the walls
16. Bodysnatchers
17. How to Dissappear Completely

encore:

Videotape
Dollars and Cents
Paranoid Android
Street Spirit
Reckoner

2nd encore:

House of cards
Lucky
Everything In Its Right Place

## Game Concept

I finally put my jumbled weed-induced thoughts on the game in to something resembling words. I was originally opposed to this explanation because of all the shit people trying to make online RPGs get, but here it goes:

It's going to be a online action RPG set in a fantasy world. There will only be player vs player combat and I want the gameplay to be fast, almost on the level of a FPS. It will be based around nations fighting each other to take control of various points of interest (towns, towers, etc.), each of which will be in its own seperate instance. Guilds within a nation can claim locations their nation owns which will provide them with bonuses and a steady supply of resources with which they can craft equipment. Players will join instances through a battle.net style interface where a list of game lobbies will be displayed showing all contested locations a player can join. Characters will progress through a skill system based on PvP participation/results and a simplistic crafting system.

Because there are no monsters to grind or long roads to travel before you can do anything interesting, I'm hoping people will find this game a lot more accessible than the average online RPG. Resources will be gained through winning battles and owning locations over time rather than clicking on trees, and combined with the simplistic crafting system will make getting decent equipment not too time-consuming. Locations will be locked to a certain range of levels so players won't be playing against people far lower/higher levels than themselves. In this way everyone can contribute to their nation as lower levels will fight for outposts and towers while higher level players fight for castles and keeps which provide a greater benefit to their nation. Once a nation takes a certain portion of all locations (~90%?) the entire game will reset, ensuring no player or nation can become unstoppably overpowered. I'm hoping the game will cause players to feel loyalty to their nation rather than their character, eliminating any drama over character resets.

===================================================

Now that that's over with, here's some secondary explanation. I understand I'm way out of my league trying to create this on my own. I also know the pitfalls of trying to make a team and developing online games. My current plan is to keep programming the game alone until I have something presentable, and then look into getting some artists to lend me a hand. It also helps that I have cut out many of the difficult aspects of online RPGs including content creation (no quests, only basic story elements, no NPCs whatsoever) and load balancing (the game instances can be very easily seperated on to multiple servers if needed, instances are capped to a manageable number of players).

I currently believe I'm capable of doing all or most of the programming on my own. There is still quite a long road ahead of me, but I can already see the small, dim light at the end of the tunnel. If you have any questions please feel free to shoot. I'm specially interested in any flaws you can see in the admittedly small overview of the game I've presented.

EDIT: I also noticed both imageshack and paint were blowing ass in their own special ways, so I switched the last couple posts to tinypic and will start saving pictures in GIMP. Here's detail mapping that went in before I pass out to honor the occasion:

All of these textures (four diffuse, blend, normal, detail) are really starting to slow down my rendering. hopefully sorting the quads will help this.

## More Terrain

Still slowing bangin away on the terrain. I've changed my mind slightly about the type of game I'm trying to make which cut down on the performance I'm going to need out of the terrain a lot. For now I'm trying to work with just one 1024x1024 map in any one round.

Anyway, here you can see the 1024x1024 map working pretty flawlessly:

This is due in part to two things
1) Drawing from a normal map rather than storing it per vertex, which allows for much smoother shading (and I think better performance?)
2) Switching from VertexPositionNormalTexture to my own VertexPosition format which cuts down on the vertex memory by ~60%

Lastly, I integrated XNAnimation into my project which took virtually no time at all. I was seriously amazed at how easy this library is to work with and hopefully it'll work for everything I'm gonna need out of animation. Here's a marine from the DirectX SDK chillin at 0,0,0 during all my testing. I'm gonna need to get some camerachase action going on for this guy soon.

What I'll be working on: sorting visible quadnodes by distance before rendering, maybe LOD? (might end up not needing it and the problems that come with it at all), terrain movement, water, a map editor using Forms, basic networking. See ya in a few years!

## Multitexturing

Just a quick little update-

multitexturing is of course a lot more presentable than LOD, so of course it had to go in first! Here are some shots:

I pull three texture values from a RGB color map and fill in missing values with a backup 'dirt' texture. My plan is to allow each quadnode to set its own four textures which will hopefully be enough for whatever I can fit inside one of them.

I managed to implement a quadtree into the engine to structure the terrain. Currently I'm displaying 9 sections of 512x512 terrain which are split up down to 128x128 quadnodes. I'm hoping properly scaled this will give me a decent view distance and good performance. That combined with removing savestate from my spritebatch draws gave me a large increase in FPS. I'm still not doing any LOD although I plan on implementing a single vertexbuffer and many indexbuffers like this post: LOD. Thanks to the comment from my last post I also turned the depth buffer back on after spritebatch draw calls and fixed the transparent terrain problem. I'll leave you with some screenshots although they're not much different from the last ones (I got bored with the grass texture I was using though :p).

Up next is multi-texturing and some LOD

## Back

It's been nearly two years since my last entry, but I've decided to get back into the game here. I'm currently entering my sophomore year at UC Santa Barbara as a computer science major, just as I had planned back then. Though I was hoping to get into a hip east coast private school I couldn't possibly be happier with where I ended up. If any of you are thinking about attending UCSB I can attest to the fun you will have here :)

I looked back on my previous entries before writing this which were fairly amusing. However, it almost feels like no matter how naive I was back then that what I know now doesn't amount to that much more. Hell, I even managed to finish a game back then, which I don't think will happen for a very long time with my new project. Still, what I've managed to accomplish so far has been very exciting for me and hopefully I will stick with this for the long haul.

Anyway, I'm now working with the XNA platform, the ease of which has made transitioning to 3D for me an extremely pleasant experience. I think having started with this is going to make me regret having to go into openGL or DX some day (which will undoubtedly happen). I've mainly been working on back end stuff and implementing various graphical structures through a couple sites (roecode and riemers) and riemer's new book which I knew based off his site would be a good purchase (and was).

On my terrain system I've been working on I'm experiencing a wierd problem where terrain viewed from one direction will look fine, but turn the camera 90 degrees and I get wierd clipping/transparent terrain issues.

I'm hoping it's just the basiceffect being weird because when I render it as a wireframe it turns out fine.

This is turning out to be longer than I intended so I'll leave you with some cool pictures of a basic menu and some atmospheric scattering (both with a tip of the hat to roecode).

## Thinking Functionally

I've been reading SICP and watching UC Berkeley's videos on programming paradigms. It uses Scheme and starts with functional programming, something I've been finding very enlightening compared to the C++ stuff I've done (and fun!)

Just now I wrote an Nth root solver:

; find nth power(define (nth x power)  (if (= power 1)      x      (* x (nth x (- power 1))))); find roots(define (rootsolve actual guess prec power count)  (define newguess (* (/ 1 power) (+ (* (- power 1) guess) (/ actual (nth guess (- power 1))))))  (if (> prec (abs (- actual (nth guess power))))      guess      (rootsolve actual newguess prec power (+ count 1))))    ; less precise root(define (root x power)  (rootsolve x (/ x 2.0) 0.001 power 0)); more precise root(define (root-prec x power)  (rootsolve x (/ x 2.0) 0.00000001 power 0))

And (root 25 2) reasonably solves as such:
> (root 25 2)0: 12.51: 7.252: 5.3491379310344823: 5.0113941065325524: 5.0000129530486845.000012953048684>

I just wiki'd an algorithm for nth roots, but I believe its a derivative of newton's method. The problem I'm having with it is for rather large values, say, (root 12844244 21), I'm starting at very poor guesses:

> (root 12844244 21)0: 6422122.01: 6116306.6666666662: 5825053.9682539673: 5547670.44595615854: 5283495.6628153895: 5031900.6312527516: 4792286.315478817: 4564082.2052179148: 4346744.9573503949: 4139757.1022384710: 3942625.81165568611: 3754881.725386367612: 3576077.833701302313: 3405788.413048858814: 3243608.012427484615: 3089150.488026175616: 2942048.08383445317: 2801950.55603281218: 2668524.339078868719: 2541451.751503684620: 2420430.23952731821: 2305171.656692683722: 2195401.577802555623: 2090858.645526243424: 1991293.948120231725: 1896470.42678117326: 1806162.311220164627: 1720154.582114442528: 1638242.459156611729: 1560230.913482487230: 1485934.203316654331: 1415175.431730146832: 1347786.125457282433: 1283605.833768840234: 1222481.746446514335: 1164268.329949061236: 1108826.980903867637: 1056025.696098921638: 1005738.758189449139: 957846.436370903940: 912234.701305622641: 868794.953624402442: 827423.765356573643: 788022.633672927344: 750497.746355168945: 714759.758433494146: 680723.579460470647: 648308.170914733848: 617436.353252127449: 588034.622144883250: 560032.973471317251: 533364.736639349752: 507966.4158469997353: 483777.538901904554: 460740.51323990955: 438800.488799913456: 417905.2274284889657: 398004.978503322858: 379052.3604793550359: 361002.248075576260: 343811.6648338820761: 327439.680794173462: 311847.315042069963: 296997.442897209464: 282854.7075211517565: 269385.435734430266: 256557.557842314567: 244340.5312783947768: 232705.2678841854869: 221624.064651605270: 211070.5377634335371: 201019.559774698672: 191447.1997854272273: 182330.666462311674: 173648.253773630175: 165379.2893082191376: 157504.0850554467877: 150003.890528996978: 142860.848122854279: 136057.950593194580: 129579.0005649471181: 123408.5719666162982: 117531.9733015393383: 111935.2126681326984: 106604.9644458406585: 101528.5375674672886: 96693.845302349887: 92089.3764784283788: 87704.1680746936889: 83527.7791187558890: 79550.2658273865591: 75762.1579308443392: 72154.4361246136593: 68718.5105948701494: 65446.2005665429895: 62329.7148252790396: 59361.63316693240697: 56534.8887304118198: 53842.75117182077599: 51278.8106398293100: 48836.962514123145101: 46511.39287059347102: 44296.56463866044103: 42187.20441777185104: 40178.28992168747105: 38265.038020654734106: 36442.8933530045107: 34707.51747905191108: 33054.778551478004109: 31480.741477598098110: 29981.658550093427111: 28553.960523898502112: 27194.248117998573113: 25899.283921903403114: 24665.98468752705115: 23491.413988120996116: 22372.7752267819117: 21307.404977887523118: 20292.766645607164119: 19326.444424387773120: 18406.13754703597121: 17529.65480670092122: 16694.90933971516123: 15899.913656871578124: 15142.774911306265125: 14421.690391720253126: 13734.943230209763127: 13080.898314485486128: 12457.998394748081129: 11864.760375950553130: 11299.771786619573131: 10761.687415828164132: 10249.226110312537133: 9761.167724107178134: 9296.350213435406135: 8853.66686993848136: 8432.063685655696137: 8030.536843481615138: 7648.130327125347139: 7283.933644881283140: 6937.079661791698141: 6606.742535039712142: 6292.135747656867143: 5992.510235863682144: 5707.152605584459145: 5435.3834338899605146: 5176.555651323772147: 4930.053001260734148: 4695.288572629271149: 4471.703402504067150: 4258.765145241968151: 4055.96680499235152: 3862.8255285641426153: 3678.8814557753735154: 3503.696624547975155: 3336.8539281409285156: 3177.956122038979157: 3026.6248781323607158: 2882.4998839355817159: 2745.2379847005536160: 2614.5123663814798161: 2490.011777506171162: 2371.4397881011146163: 2258.514083905823164: 2150.9657941960218165: 2048.5388516152584166: 1950.9893824907222167: 1858.0851261816401168: 1769.6048820777526169: 1685.337982931193170: 1605.0837932678028171: 1528.6512316836215172: 1455.8583158891634173: 1386.5317294182507174: 1320.5064089697626175: 1257.6251513997738176: 1197.7382394283559177: 1140.7030851698628178: 1086.3838906379644179: 1034.651324417109180: 985.38221373058181: 938.4592511719809182: 893.7707154018866183: 851.2102051446539184: 810.6763858520512185: 772.0727484305249186: 735.3073794576427187: 700.292742340612188: 666.9454688958209189: 635.1861608531627190: 604.9392008125359191: 576.1325722024151192: 548.6976878118238193: 522.5692264874513194: 497.68497760709647195: 473.9856929591395196: 451.4149456753709197: 429.91899588130565198: 409.4466627441006199: 389.9492026134291200: 371.3801929651706201: 353.695421871591202: 336.8527827348486203: 320.8121740331891204: 305.5354038411324205: 290.98609889631655206: 277.1296179964919207: 263.9329695204685208: 251.36473287663665209: 239.3949836920349210: 227.9952225638428211: 217.1383072036598212: 206.7983878130093213: 196.95084553619935214: 187.57223384399938215: 178.64022270857083216: 170.13354543673412217: 162.03194803498488218: 154.3161409856999219: 146.96775331971418220: 139.96928887591824221: 133.30408464373164222: 126.95627108926821223: 120.91073437073163224: 115.15308035307775225: 109.66960033626452226: 104.44723841549227: 99.47356039570477228: 94.73672418638549229: 90.2254516060814230: 85.92900152960134231: 81.83714431390604232: 77.94013744181527233: 74.22870232553835234: 70.69400221479842235: 67.32762115695087236: 64.12154395900082237: 61.068137103810294238: 58.16013057505742239: 55.390600547673735240: 52.75295290254642241: 50.24090752623468242: 47.84848335831874243: 45.569984150779746244: 43.39998490550452245: 41.33331895762335246: 39.365065673927247: 37.49053873707333248: 35.70527498768888249: 34.005023797798934250: 32.3857369502847251: 30.843559000271142252: 29.374818095496323253: 27.976017233806022254: 26.643825936958113255: 25.375072320912487256: 24.16673554372618257: 23.01593861307255258: 21.919941536259568259: 20.876134796437682260: 19.882033139464458261: 18.935269656632816262: 18.03359014917411263: 17.174847761118198264: 16.356997867731618265: 15.578093207363445266: 14.836279245108043267: 14.129789757245755268: 13.456942625948336269: 12.816135834236508270: 12.205843651653817271: 11.624613001575062272: 11.071060001500058273: 10.543866668095294274: 10.041777779138377275: 9.563597884893698276: 9.108188461803536277: 8.674465201717693278: 8.261395430207433279: 7.86799564781688280: 7.493329188397769281: 7.136503988952219282: 6.796670465673989283: 6.473019491131907284: 6.1647804677813465285: 5.871219493222397286: 5.591637612850939287: 5.325369155781161288: 5.0717801501805955289: 4.8302668145184290: 4.6002541218609245291: 4.381194435723326292: 4.1725662193424515293: 3.9738728288645904294: 3.784641423571073295: 3.6044220860537064296: 3.4327874036355905297: 3.269333182232988298: 3.113682076939584299: 2.965494870717574300: 2.8245019073472775301: 2.6905874849393436302: 2.5640114729390593303: 2.4459716140163272304: 2.339907021423322305: 2.2537477575579974306: 2.199930047543687307: 2.1819299313374882308: 2.18028084576654309: 2.1802682525677963310: 2.18026825184036182.1802682518403618>

is there a better function to find a decent place to start checking than dividing the input in half? Or some other fun things to do in Scheme?

p.s. <3 parenthesis h8 college apps kkthx bbai

## Life Goes On

I decided to try installing Ubuntu (my first shot at Linux) on my mostly defunct laptop (I spilled a drink on it destroying its keyboard functionality, so I have to use a USB keyboard with it). Getting the wireless network card to work with Linux has been loads of fun, no wonder so many people are making the switch.

But really, besides the frustrations with that I'm mostly optimistic for the future, and, should this test go well I think I'll be upgrading my desktop from windows 2000 to a vista/ubuntu or some other distro dual boot. If anyone has a recomendation for another interesting one please feel free to comment. My dad uses Suse, but after their whole sell-out to Microsoft I'm pretty sure I want to stay away from that.

Nanowrimo oriented, I pretty much gave up out of boredom with my story at the beginning of the weekend. The problem was I was trying to write a religiously-oriented (christianity) satire without any religious-background. I realized much of my humor was more mindless-drivel than actual useful commentary, and I couldn't churn out half-credible information on a rapid pace needed for nano. Also, I have so much to do in the beginning of senior year that it's really just poorly timed all around. I'll probably still write more in it and get to around 10k, but I've given up on 50k.

What this does mean is I can get back to programming, which is a good thing, because just having started so recently I don't want to lose my edge. And I think I can produce some good stuff before any of my interviews, which will be a lot more pertinent to the places and major (CS) I am applying to than nano.

Hopefully when next year rolls around I will find myself with slightly more free time and a much more nonsensical topic to write about.

## It's Crunch Time

As a reminder for myself:
-study for physics SAT (one month to learn everything I don't know - and I only learned mechanics in my physics C AP class)

-college essays
-college apps
-college interviews
-college recos
-college brag sheet

-do homework

-guitar
-run
-program
-write a novel in a month (nanowrimo)

-social life?

Yea yea, it's easy compared to having a job or walking 15 miles through the snow uphill both ways just to get to school back in your day.

Just gotta get this off my chest that right now I'm pretty god damn stressed out.

I wrote a tic tac toe game yesterday so I don't get rusty with C++. Hopefully after november I can come back and start work on the new version of console combat.

## V-v-v-vectors

Sorry, I was trying to come up with a really exciting entry name.

Anywho, I picked up the (YAY USED!) books:
3d Math Primer for graphics and game developers
Introduction to 3d game programming with directx 9.0

and will be working through them concurrently with my current Console Combat 2 project and finishing up C++ in 21 days (which is starting to seem like C++ in 16 days with a lot of random stuff thrown in at the end). I'm reading the math primer first and just finished creating a vector class which was bundles of fun:

It also helped a lot with my understanding of overloaded operators, now I'm the friggin king at it. It also feels good really understanding the proofs behind things like vector projection onto other vector so I don't have to resort to C&P without knowing what the hell I'm doing. Once I start the directx book I feel I'll be a lot better off learning the vector/matrix math beforehand.

In other news, college applications suck. Can't wait until I have them all sent out so I can relax for the rest of the year (until APs anyway).

## Release!

I've completely my first game titled Console Combat 1. Yay! It's currently in the Showcase: Console Combat 1

Source code is included and it's licensed under the do whatever the hell you want with any of my code (not that you would want to use that ugly uncommented clusterfuck) license(TM).

Error handling is rather difficult in the console (mostly input at wrong times) so attempting to screw it up will in fact screw it up. I also couldn't figure out how to allow spaces in input for the name, so that's out too.

Overall though, I'm happy with how it turned out and it makes for a fun little 10 minute time-waster. I learned a lot about OO design and why I need to use more commenting next time around. I also need to abstract things better functionally as well because I had a lot of word-for-word rewritten code.

On to Console Combat 2.

## Hackery: The Beginning

I implemented my first hacky design today =D In the console combat game I've been working on, on the weapon dealer screen it shows your gold as a fake menu option:

I've also been thinking a lot about how I'm going to portray Jesus in the novel I'm writing in November. Right now I'm thinking it can go two ways: he can either be our common every day wholesome, good-natured Jesus, or I can make him completely badass (a la Shwartzenqweqweqew in Predator). Having Jesus scream, "Get to the choppa!" could make for a good story.

Seeing as my work on Console Combat 1 is coming to a close ("all" I need to do is implement the arena, easy right? ...) I've been bouncing ideas off myself for Console Combat 2 which is far more open ended. Right now I want the screen to look like this:

Which would be totally awesome if I did it, but might 1) be out of my league or 2) be too much for console output to handle. We'll see.

To succeed in life, you need two things: ignorance and confidence.
-Mark Twain

## Hello World!

Hello citizens of gamedev, this will mark the beginning of my epic journey through developer journal land. I figure I'll just start with the basics on everything me and you leave you wondering why you spent the last couple minutes reading this.

I'm a 17 year old high school senior living in the very beautiful and smoggy Los Angeles. Today we experienced this wet stuff falling from the sky, I havn't been able to figure out what it is yet. I started getting really into programming just a couple monthes ago, having found the C++ Workshop here on gamedev. However, I first found gamedev a long time ago when I had started working with the Warcraft 3 map editor and more importantly its scripting language. I've also been doing hacky stuff with various languages for years.

What I've been working on recently is the first project of the Workshop, creating my first text-based RPG. Fun stuff:

Yay data processing!

My goal is to have this banged out in the next couple days, continue reading through the C++ book and then begin working on project 2 and eventually turn it 2D with SDL.

I'll also be doing Nanowrimo soon. I have my basic plot written down, involving the devil hiring a man to go back and stop Jesus from being killed. Hilarious events ensue. If you any suggestions feel free to volunteer them, as filling 50,000 words (~200 pages?) of storyline will be quite a feat.

Anywho, that's my first entry.

He giveth and He taketh away.