Archive for the c++ Category

ProjectZombies and networking

Posted in c++, programming, project zombie on May 24, 2009 by bey0ndy0nder

I’m back to talk about thoughts on whether we can get project zombie (i.e.: that stupid game with lots stuff running around– that one!) over the network.

Well… the latest game play I’m imagining (or scenario, depending on whether you are conversing about the MMO) is some sort of Tower Defense game, where you are controlling a space ship (that you, the avatar, will have the ability to get inside and control) to battle –insert evil guys to fight–. Latest storyline I’m toying with, is that you are

type of character flying around doing nothing, until you hit this planet with –near-future equivalent tech– and they are battling the GHOST army… a unspeakbly evil magic entity with an army of GHOST…that out of nowhere (actually, in the middle of a city) begins their un-speakbly evil plan to kill kill kill! They must be stopped! (Can you imagine the opening scene; the camera pans to the city center; ominous fog begin to creep-out; shinny lights emanating from it; then undead GHOST army begin rushing out; WTF to do???!!!)

So it’s a mixture of chaos between GHOST (magic), near-future tech, and insane high-tech. Shit blowing up everywhere!

Or if not that…just have simple little RED versu BLUE and you fly around blasting the shit out of everyone.

So is it possible to do this as a multiplayer game? I think it is! We do the crowd simulation on the client. We generate the cellular automata map on the server, update the this map occsionally (every second?)…The map controls the behavior of the crowd! To sync the clients crowds we simply have to make sure the seed is the same, and assuming they are then they should be synced! We can also occassionally sync using the server too.

For entities that are not crowd based, we simply track their location on the server, and update each client at a fast rate, to sync. And have the client interpolate the orientation and position. Like a traditional shooter game, for example.

Server/Client using RakNet

Posted in c++, programming, project zombie on May 24, 2009 by bey0ndy0nder

I started some preliminary server/client work. I’m using the RakNet library. I don’t have much to comment on except it seems like a really nicely-developed engine, with lots of cool-features very useful for a online UDP based game.

It’s a simple client/server. So simple right now all it does is connect the server to the client. This gives me a good excuse to present my desktop, however(note the console’s connection msgs):

desktop

Although “we” have been brain-storming on a massive multiplayer game (oh, the dreaded MMORPG as a first project). Frankly, I think we are just trying to do too much. Well, I promised that we’d build this thing as modules with the eventual hope of getting our utlimate dream game–and that’s fine with me–but I have some doubts on whether we can realize such an ambitous project as a MMO, without careful planning. We have some planning, it’s just I really don’t think just making a list and just going over details while sitting around consistue a good plan. What I mean by planning is setting out and really charting the entire system, with proper tools. Sure, I could do that, but I don’t think I have the time right now to fully chart such an ambitious system.

What I want to do, is to take the stuff I have right now, and expand on that, to make a fun, cool-looking, small little multiplayer project. Along the way we will gain the experience in building a more ambitious project, and a project that we can actually get it done! We can then build on top of that experience, whether it is reusebly software code, or models, or other things.

Though I admit, maybe this is exactly what we mean we are talking about building it up a little by little…but I feel that we sometimes tend to go over-board and chart some really crazy shit, that not even some of the most advanced MMO out there is doing now. But dreaming is good.

final video (really high rez this time and high rez characters. And no, I’m NOT in a satanic cult)

Posted in c++, programming, project zombie on April 13, 2009 by bey0ndy0nder

1.) I’m not in a satanic cult.

2.) I’m not “vampire.”

3.) I’m not a warlock.

4.) The “engine” shown is an very early version. It is supposed to suck. THE POINT is it is going to kick-ass… one day!

Doh! (And more ideas)

Posted in c++, programming, project zombie on April 12, 2009 by bey0ndy0nder

Yes. What was I thinking! As I said before: zombies interaction do not rely on direct interaction, but through an effects map (e.g. population density map). So I simply have to do is enable alpha blending to “append” to the a pixel. There is no need for read-read-modify on a single position to store multiple values.

This option has been explored in non-parametric particles, such as what is talked about here (PDF)

(The other option I read about first was an article in GPU Gems 3 called Rigid body simulation on the GPU. Now I remembered I didn’t really came up with the idea –like I mentioned in a previous post–but got it from that article).

Another problem is how to “fake” it so it looks like the zombies (they can be humans,zombies,cars,etc) are interacting. For example, let’s say a group of zombies attacks another group of humans. We can have an average map for “direction,” so they will turn towards this direction, and initiate attack animation. So, if the grid precision is high enough, we should be able to fake “direct” zombies interaction.

CPU/GPU message:

Implement a msg. service, so we have an AI process which computes global behavior for zombie groups. We then pass msgs by streaming data to the GPU, then have the GPU zombies “carry the order out.”

True 3-d environments:

Due to the nature of the game, we have to have procedural exterior and interior. We have to try to get this feature in!

Destructible environments: (not high on priority list)

I will implement destructible buildings on the CPU. The idea is to define all structures using parametric surfaces. Where at each integral points we have the “sample” points. On the CPU: we generate the pieces in between integral points (i.e. the damn parametric surface), batch it all up, and stream it to the GPU (we don’t need a lot of heavy geometry, we can go for simple shapes for now.) On the GPU we would just have a map of all the integral points, and we can interpolate it if we want for processing. We can also embed specific information at these points, maybe something that tells us whether a sector is impassable.

WOW that’s a lot of junk to implement.

More on zombie behavior

Posted in c++, programming, project zombie on April 11, 2009 by bey0ndy0nder

Here are some of the problems and my thoughts on them:

Broad phase and narrow phase collision between actors and zombies:

Say you want to shoot a zombie properly: in order to do this properly we need precision targeting. Without some sort of search to detect local zombie entities, we have to use a pooling method. For each frame, we upload a small frame of data — an 1d array quad tree –which contains all targeting rays for all CPU based actors in a spatial hierarchy. Then we apply target response kernel on the zombie entities to have the zombie entities pool for collision hit. The output of this kernel is state change to zombies hit (say, to initiate blood spattering effects).

What is wrong with this picture? We have to apply this to every zombie entity! But this could potentially be fast if we put our hit rays in a quad tree, and may even be faster with some specialized assumptions (1d array?).

I think, as long as you don’t have a lot of hit rays per-tree leaf, then it should be relatively okay — given a powerful machine.

It is definitely something we need to experiment with.

The other method is to implement spatial sort on the GPU using Cuda (or equivalent. I will blog about my BEEF with ATI in this regard in a bit. But, since OpenCL is coming out soon…I digress) and push hit rays to zombie entities.

Zombie to zombie interaction:

Now we are talking about a method without implementing spatial sort on the GPU (again, using CUDA-like things. Not even going to attempt doing something without it):

Everything will be chance and density based.

Updating (details not worked out, may contain unworkable solutions):

The first step is to prepare an action map using a behavior kernel (the input to this kernel could be a CA) in order to prepare a behavior solution map (e.g. which direction to apply behavior destroy car. Or swarm sector to kill humans). Next, we run a behavior output kernel which scatters the behavior into an effects map. We have to be careful to think about the effects of multiple scatters into the same position. An possible solution is to use and stencil buffer (was stenciL?). The point is, we need to have some logic so that each scatter appends instead of overwriting the a pixel. I may need to read up on what Vertex Array writes are and perhaps can figure something out.

So the output of the above kernel is an effect map. For example, an fire CA kernel can then sample this map to produce a fire spread simulation.

Another question is can we put multiple behaviors into a single map, or do we implement multiple behavior effect kernels to output multiple effect maps. The first could be an input into multiple effects kernels, which takes input number out from a corresponding component of the effects map, to produce results.

As you can see… doing a zombie game with massive crowds is hard. Plus you don’t know whether everything will work out, whether the fun factor and game play will be worth it.

AS OF RIGHT NOW: I’m still imagining a game where you travel around a burn out city infested with zombies. It will be survival in a totally non-scripted environment.

The story? At the start you are a regular army guy (not spec-ops) as part of one of the last units send into a city with an zombie outbreak.

The initial scene will be your squad arriving at the outskirt. We will implement a cinematic technology so we can create cut-scenes with CPU controlled zombies and etc…

You will then be dropped into the city as the simulation starts.

Arghh, the more I think about it, the more impossible everything is looking.

Should just keep it simple and just have survival and shooting zombies. What more story do you need man?

Yeah. I’m need to get some sort of game-play in, and be done with this project! LOL.

One more video (432*432 number of robots,zombies,eat-them-freaks–whatever)

Posted in GPU Random Number, c++, gpu, programming, project zombie with tags on April 9, 2009 by bey0ndy0nder

Next version will look very different and hopefully with better crowd behavior! I want flying things, destructible environments, fire effects and atmospheric effects, buildings…and definitely some sort of behavior.

BTW, sound clip IS FREE and was taken off some site advertising Resident Evil Apocalypse–this is off google search on FREE Resident Evil music. Also, I’m not making any political or general statement with choice of sound clip.

PLUS, WTF IS WRONG with the quality man??? IT DOES HOWEVER is giving the scene a darker feel to it.

OH noes! Frapping Zombies!!!

Posted in GPU Noise, GPU Random Number, c++, gpu, programming, project zombie with tags on April 8, 2009 by bey0ndy0nder

Finally fixed the issues.

I’m going to spend the next few days going back and document the hell out of everything. Maybe do some resource refactor… then again, maybe not, I want to start working on Spherical harmonics!

BTW, what do I have to do to get some better vid qualities. I encoded it at 3000kb/s… hmmm, maybe I have to increase duration in order for youtube HD to kick-in?

It don’t matter. The video sucks any

C++ namespace pollution

Posted in c++, programming, this blog sucks with tags on April 2, 2009 by bey0ndy0nder

I didn’t know this was very bad practice:


//someheader.h
#include
#include "somesstupidheader.h"

using namespace std; //!!! BAD !!! NAMESPACE pollution. Don't do it in the header.

namespace CrapCodeNamespace
{
class NoGoodCode
{
};
}

I will be back tomorrow to explain more in depth. I think I know why it is bad practice.

Surprisingly, g++ 4 doesn’t complain while VC2005 craps out during compilation.

This reminds me again of how much I do not know and how much more practice I really need!

Here goes the execuse part:

blah blah… Didn’t take the C++ class in school… blah blah… all I did was read some book 9 years ago… blah blah

can’t believe I helped some people program in C++

I’m back? And WINDOZE still sucks!

Posted in c++, gpu, linux, programming, thoughts with tags , on March 21, 2009 by bey0ndy0nder

Hello,

Am I back? Maybe. I won’t be updating, regularly, for sure. What I need (we) is more actions and results and less bullshyte. What this means: I won’t update, unless I have something really kick-ass; so, after getting this — kick-ass — thing out, I will then update and write about development, like I used to. Until then, adios..

There is the thing about my new computer: I’ve bought an AMD Phenom II X4 system, with ATI (the X2 one) hardware (GASPPPPPP!!!) ATI???

Yes. Even though I think ATI has shitty Linux drivers, but my friends and I decided that we are doing this “coalition of the willing thing,” — as far as computer ‘nerd’ shyt is concerned — where we are supporting the underdog (to further competetion for nerd shyte) — where we’re going gangsta on Intel and Nvidia and showing love to AMD and ATI! (No, my friend didn’t put it like that. I’ve taken liberties to sprinkle the “coaliation of the willing” thing. Cos I’m gangsta like that.)

HAHA. Initially I was not too sure about this choice, since I wanted the best hardware possible (one has to admit that the current Intel Nvidia X2 line kicks ass, performance-wise). But, after evaulating the price/performance ratio, I think AMD Phenom is a great choice. I’m still not complete 100% on the ATI decision, since I’ve been an Nvidia dude forever. But since this is gangsta… we got do gangsta stuff… so ATI it is. (I.E. we’re repping the AMD/ATI clique now)

And lastly… Windows (Vista) STILL SUCKS BALLS!!!!!!!!!!!!!!!! Haha, but I’m downloading Visual C++ express edition as we speak; parse what you will whatever meaning and implications from that :)

(So much hate… oh the humanity)

Effective C++ blurb:

Posted in art, c++, dao, programming, tao, thoughts, zen with tags , , , , , on November 12, 2008 by bey0ndy0nder

I finally went out and got one of “the” c++ book that every c++ programmer should have on their desks. C++ as a language is unforgiving; it’s the language that allows the programmer to easily shoot one’s self in the foot, due to the myriad ways of doing things, and the kaleidoscopic amount of options. Effective C++ effectively helps the intermediate C++ user to safely navigate the jungle and trap is the powerful and dangerous computer language known as C++.

Thank god there is effective c++ for a noob such as myself. Now, don’t get me wrong, I’ve programmed my share of C++ programs , and read my C++ references, but I’ve yet to truly master it, since C++ is so difficult. The purview of effective C++ is a collection of best practices for someone who is comfortable with all the features and syntax of the language, but who yearns to be a true master. The book is divided into a series of items, with each items examining a particular aspect of c++, and it’s connections to other “items” of c++.

Going over the items in the content, I recognize many, plus quite a few that I’m not too familiar with. To effectively recognize some of these items one should have gotten it by learning the language, or from “doing” the language. However, the point of interest for me is not that I recognize the items but that I truly master and wholly comprehend the content of these items. To have someone who is is both knowledgeable (i.e. PH.D) and experienced (a master) to put their mastering of a subject beautifully laid out and written on a page, is to help one get closer to achieving the goal of becoming a master. That is, the book’s items bring to the forefront those things that you may vaguely be aware of (with respect to the programming language) and uses but in a way that fully analyzes these concepts in glorious and rigorous detail. And many of the concepts presented in the book one should have some exposure to in a course on Programming Languages taken in college, but the book effectively brings them forward in the light of the concreteness of C++. If not that, it’s a GOOD review!

I truly want to master the art of programming. I view it something that is art which is framed in the frame work of rigorous math and engineering. (In other words I probably need to get a girlfriend, lol). I like to think myself as both a master craftsman and a master artist similar to those of time long past (oookkkayy). And to put it into Eastern philosophical terms, I want to feel the Tao and Zen (my gawd you are stretching it today bud) of programming. But what I really want to do is to make programs that DON’T FREAKING CRASH and is easy to maintain. So Effective C++ effectively brings me one step closer to this goal (and some may argue one step closer towards total insanity.) (Another way to describe it is … it’s Science. It’s something that has a definite set of rules, yet these rules have a myriad of exceptions…So one have to constant experiment, to constantly update one’s purview of the world, to improve!!!)

Effective C++ is a piece to a giant puzzle, the art and craft that is applied Computer Science (by applied CS I mean doing a job that people are paying you for), in the sense that it helps one to master one particular aspect of that trade, namely C++. Together with say study of algorithms, discrete math, (speaking of which, I think I need to buy Art of Programming by Knuth) plus software engineering, combined to form the key which solves this huge yet interesting piece of machinery. (I realllllllyyyyyy need a girlfriend, HAHA. Let’s also see how you feel after 30 years in the field).

I wholly recommend the book.

(Seriously. Maybe many of the things I said above is BS. But really it IS ART. There are the rules, the theories, and then there is reality. The reality is that you have to take in each moment at hand and try to apply everything you’ve experienced up to this moment, in order to “live” in the moment. But you can’t ‘over think it,’ because the moment is so brief, so if you try to ‘chase’ after it you will never get it. So you just have to be yourself and give it all you got! I’m a ZEN master baby… Not.)