• Advertisement
Sign in to follow this  
  • entries
    14
  • comments
    15
  • views
    10588

About this blog

Beginning game programmer and musician, procrastinating extraordinaire.

Entries in this blog

...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!

Radiohead

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:
detail mapping
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:
VertexPosition


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%
Normal MappingTerrain4


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.
Animation



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:

Free Image Hosting at www.ImageShack.usFree Image Hosting at www.ImageShack.us

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.

Quadtree

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).

Free Image Hosting at www.ImageShack.us

Free Image Hosting at www.ImageShack.us

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.

fineclipping

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).

exit screenscattering

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.5
1: 7.25
2: 5.349137931034482
3: 5.011394106532552
4: 5.000012953048684
5.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.0
1: 6116306.666666666
2: 5825053.968253967
3: 5547670.4459561585
4: 5283495.662815389
5: 5031900.631252751
6: 4792286.31547881
7: 4564082.205217914
8: 4346744.957350394
9: 4139757.10223847
10: 3942625.811655686
11: 3754881.7253863676
12: 3576077.8337013023
13: 3405788.4130488588
14: 3243608.0124274846
15: 3089150.4880261756
16: 2942048.083834453
17: 2801950.556032812
18: 2668524.3390788687
19: 2541451.7515036846
20: 2420430.239527318
21: 2305171.6566926837
22: 2195401.5778025556
23: 2090858.6455262434
24: 1991293.9481202317
25: 1896470.426781173
26: 1806162.3112201646
27: 1720154.5821144425
28: 1638242.4591566117
29: 1560230.9134824872
30: 1485934.2033166543
31: 1415175.4317301468
32: 1347786.1254572824
33: 1283605.8337688402
34: 1222481.7464465143
35: 1164268.3299490612
36: 1108826.9809038676
37: 1056025.6960989216
38: 1005738.7581894491
39: 957846.4363709039
40: 912234.7013056226
41: 868794.9536244024
42: 827423.7653565736
43: 788022.6336729273
44: 750497.7463551689
45: 714759.7584334941
46: 680723.5794604706
47: 648308.1709147338
48: 617436.3532521274
49: 588034.6221448832
50: 560032.9734713172
51: 533364.7366393497
52: 507966.41584699973
53: 483777.5389019045
54: 460740.513239909
55: 438800.4887999134
56: 417905.22742848896
57: 398004.9785033228
58: 379052.36047935503
59: 361002.2480755762
60: 343811.66483388207
61: 327439.6807941734
62: 311847.3150420699
63: 296997.4428972094
64: 282854.70752115175
65: 269385.4357344302
66: 256557.5578423145
67: 244340.53127839477
68: 232705.26788418548
69: 221624.0646516052
70: 211070.53776343353
71: 201019.5597746986
72: 191447.19978542722
73: 182330.6664623116
74: 173648.2537736301
75: 165379.28930821913
76: 157504.08505544678
77: 150003.8905289969
78: 142860.8481228542
79: 136057.9505931945
80: 129579.00056494711
81: 123408.57196661629
82: 117531.97330153933
83: 111935.21266813269
84: 106604.96444584065
85: 101528.53756746728
86: 96693.8453023498
87: 92089.37647842837
88: 87704.16807469368
89: 83527.77911875588
90: 79550.26582738655
91: 75762.15793084433
92: 72154.43612461365
93: 68718.51059487014
94: 65446.20056654298
95: 62329.71482527903
96: 59361.633166932406
97: 56534.88873041181
98: 53842.751171820775
99: 51278.8106398293
100: 48836.962514123145
101: 46511.39287059347
102: 44296.56463866044
103: 42187.20441777185
104: 40178.28992168747
105: 38265.038020654734
106: 36442.8933530045
107: 34707.51747905191
108: 33054.778551478004
109: 31480.741477598098
110: 29981.658550093427
111: 28553.960523898502
112: 27194.248117998573
113: 25899.283921903403
114: 24665.98468752705
115: 23491.413988120996
116: 22372.7752267819
117: 21307.404977887523
118: 20292.766645607164
119: 19326.444424387773
120: 18406.13754703597
121: 17529.65480670092
122: 16694.90933971516
123: 15899.913656871578
124: 15142.774911306265
125: 14421.690391720253
126: 13734.943230209763
127: 13080.898314485486
128: 12457.998394748081
129: 11864.760375950553
130: 11299.771786619573
131: 10761.687415828164
132: 10249.226110312537
133: 9761.167724107178
134: 9296.350213435406
135: 8853.66686993848
136: 8432.063685655696
137: 8030.536843481615
138: 7648.130327125347
139: 7283.933644881283
140: 6937.079661791698
141: 6606.742535039712
142: 6292.135747656867
143: 5992.510235863682
144: 5707.152605584459
145: 5435.3834338899605
146: 5176.555651323772
147: 4930.053001260734
148: 4695.288572629271
149: 4471.703402504067
150: 4258.765145241968
151: 4055.96680499235
152: 3862.8255285641426
153: 3678.8814557753735
154: 3503.696624547975
155: 3336.8539281409285
156: 3177.956122038979
157: 3026.6248781323607
158: 2882.4998839355817
159: 2745.2379847005536
160: 2614.5123663814798
161: 2490.011777506171
162: 2371.4397881011146
163: 2258.514083905823
164: 2150.9657941960218
165: 2048.5388516152584
166: 1950.9893824907222
167: 1858.0851261816401
168: 1769.6048820777526
169: 1685.337982931193
170: 1605.0837932678028
171: 1528.6512316836215
172: 1455.8583158891634
173: 1386.5317294182507
174: 1320.5064089697626
175: 1257.6251513997738
176: 1197.7382394283559
177: 1140.7030851698628
178: 1086.3838906379644
179: 1034.651324417109
180: 985.38221373058
181: 938.4592511719809
182: 893.7707154018866
183: 851.2102051446539
184: 810.6763858520512
185: 772.0727484305249
186: 735.3073794576427
187: 700.292742340612
188: 666.9454688958209
189: 635.1861608531627
190: 604.9392008125359
191: 576.1325722024151
192: 548.6976878118238
193: 522.5692264874513
194: 497.68497760709647
195: 473.9856929591395
196: 451.4149456753709
197: 429.91899588130565
198: 409.4466627441006
199: 389.9492026134291
200: 371.3801929651706
201: 353.695421871591
202: 336.8527827348486
203: 320.8121740331891
204: 305.5354038411324
205: 290.98609889631655
206: 277.1296179964919
207: 263.9329695204685
208: 251.36473287663665
209: 239.3949836920349
210: 227.9952225638428
211: 217.1383072036598
212: 206.7983878130093
213: 196.95084553619935
214: 187.57223384399938
215: 178.64022270857083
216: 170.13354543673412
217: 162.03194803498488
218: 154.3161409856999
219: 146.96775331971418
220: 139.96928887591824
221: 133.30408464373164
222: 126.95627108926821
223: 120.91073437073163
224: 115.15308035307775
225: 109.66960033626452
226: 104.44723841549
227: 99.47356039570477
228: 94.73672418638549
229: 90.2254516060814
230: 85.92900152960134
231: 81.83714431390604
232: 77.94013744181527
233: 74.22870232553835
234: 70.69400221479842
235: 67.32762115695087
236: 64.12154395900082
237: 61.068137103810294
238: 58.16013057505742
239: 55.390600547673735
240: 52.75295290254642
241: 50.24090752623468
242: 47.84848335831874
243: 45.569984150779746
244: 43.39998490550452
245: 41.33331895762335
246: 39.365065673927
247: 37.49053873707333
248: 35.70527498768888
249: 34.005023797798934
250: 32.3857369502847
251: 30.843559000271142
252: 29.374818095496323
253: 27.976017233806022
254: 26.643825936958113
255: 25.375072320912487
256: 24.16673554372618
257: 23.01593861307255
258: 21.919941536259568
259: 20.876134796437682
260: 19.882033139464458
261: 18.935269656632816
262: 18.03359014917411
263: 17.174847761118198
264: 16.356997867731618
265: 15.578093207363445
266: 14.836279245108043
267: 14.129789757245755
268: 13.456942625948336
269: 12.816135834236508
270: 12.205843651653817
271: 11.624613001575062
272: 11.071060001500058
273: 10.543866668095294
274: 10.041777779138377
275: 9.563597884893698
276: 9.108188461803536
277: 8.674465201717693
278: 8.261395430207433
279: 7.86799564781688
280: 7.493329188397769
281: 7.136503988952219
282: 6.796670465673989
283: 6.473019491131907
284: 6.1647804677813465
285: 5.871219493222397
286: 5.591637612850939
287: 5.325369155781161
288: 5.0717801501805955
289: 4.8302668145184
290: 4.6002541218609245
291: 4.381194435723326
292: 4.1725662193424515
293: 3.9738728288645904
294: 3.784641423571073
295: 3.6044220860537064
296: 3.4327874036355905
297: 3.269333182232988
298: 3.113682076939584
299: 2.965494870717574
300: 2.8245019073472775
301: 2.6905874849393436
302: 2.5640114729390593
303: 2.4459716140163272
304: 2.339907021423322
305: 2.2537477575579974
306: 2.199930047543687
307: 2.1819299313374882
308: 2.18028084576654
309: 2.1802682525677963
310: 2.1802682518403618
2.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
-study for AD (fuck china...)

-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.
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.
Sign in to follow this  
  • Advertisement