Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

SimonForsman

Member Since 18 Oct 2005
Online Last Active Today, 04:48 PM
*****

#4821097 3D MMORPG makers for newbies?

Posted by SimonForsman on 08 June 2011 - 03:39 PM

Maybe it takes me ten years to make a MMORPG. But if I make fifty smaller games before making it, it'll take thirty years. I want to put all my efforts as directly into my project as I can.


If you're going to use something like Hero Engine or Big World then just go for it, with those tools the technical challenges are solved for you (Its still an insane amount of work but everything you do will get you closer to your goal)

If you're going to make something from scratch then the recommendation to start smaller applies, any code you write as a beginner will be of poor quality and difficult to maintain and expand upon , thus pretty much any code you write for your mmorpg while you're still a beginner will be worthless and has to be thrown out and replaced. (This means that you won't really make any progress at all until you've learned the things you need to know and therefore learning those things quickly should be the highest priority (smaller projects teach you the basic concepts alot faster than large projects do and you'll have something to show for your efforts faster aswell)


#4820749 3D MMORPG makers for newbies?

Posted by SimonForsman on 07 June 2011 - 06:36 PM



Yes, I am interested in the "Massive" portion. If the game gets very popular, which I hope it would, I still want it to be stable and everything. I want it to be designed for "massive" amounts of people from the start.

If not on a scale for complete newbies, then the easiest to use program would be nice.


MMORPGs are probably the most difficult,  the most expensive and the largest games to build and maintain, creating one would take a lot of experience, knowledge and funds, and would be as good as impossible to do on your own

If you are serious about wanting to create a game, then start small and simple, learn how to program and learn all the basic concepts, then when you have your years of experience you can try to tackle that MMORPG project


I'm not working on this on my own, but we're all just as inexperienced. I don't want to make other games before I try to make this one, and I don't want half-heartedly made games lying around just to create experience, I would rather put all my effort into this and gain experience while still (slowly) progressing on my game project.

I don't need the "general advice for people who don't understand how much work a game project would take", but thank you anyway.


If you're looking for shortcuts you don't have that much to choose from
Hero Engine is probably the best option out there, its license costs are quite high though unless you go with the HeroCloud service ($0 starting fee but then it costs 30% of your revenue in royalties) (Hero Engine is used for Biowares upcoming Starwars MMO so its definitly capable of delivering).

An easier but far more restrictive and less scalable (unless you go with the professional edition that is currently in beta it doesn't scale at all and won't support a massive number of players) would be Realmcrafter.

If neither of those is good enough then you're pretty much forced to make your own. (This is hard enough if you go the easy route realmcrafter did and do your scaling through zones and instances, more flexible solutions would require a fairly solid understanding of distributed simulations and is not something i'd recommend you attempt as a beginner)


#4820560 Please lay me a hand.

Posted by SimonForsman on 07 June 2011 - 09:52 AM

i think that you problem is in this

if (x_vel<0)
{
	radians = 0-(3.1416-atan2(y_vel,x_vel));
}

you can't flip image by rotateing. you need to do this

if (x_vel<0)
{
      for(int x=0; x<width; x++) for(int y=0; y<height; y++)
          image_fliped.buffer[(y+1) * width - x] = image.buffer[y * width + x];
}


if (x_vel<0)
{
	radians = 0-(3.1416-atan2(y_vel,x_vel));
}

doesn't flip the image, it adjusts the rotation so that the flipped image faces in the correct direction (as flipping the image effectivly changes the direction its facing by pi radians the performed rotation has to be adjusted by the same amount to compensate to avoid having the flipped image face the wrong way)

it should probably be changed to:

float radians = atan2(y_vel, x_vel);
if (x_vel<0) {
radians -= 3.1416;
} //This should be equivalent but avoids one atan2 call and thus should be faster (unless the compiler is capable of optimizing out calls to pure functions when the variables passed doesn't change)

I'm assuming owl has a flip function aswell that he calls when xvel<0 since he said he was flipping the image in his original post (yet the code he posted doesn't flip it).

The remaining "special cases" could probably be solved if we knew in what ranges they occured (If it happens when moving close to straight up or straight down for example)


#4820496 Please lay me a hand.

Posted by SimonForsman on 07 June 2011 - 07:16 AM



You're right about that. Yet, ironically, doing it the right way brings worst results! Now the image never faces the direction it's going! What's going on? O_o

Do you still have any of the 'corrective' code in place? That is, are you modifying the angle returned by atan2() in any way?

Also, although this is probably too obvious, are you missing any degrees<->radians conversions anywhere?


Yes, correcting the order of the parameters in the atan2 function, the code that rotates the image is *exactly* this one:

[source lang="cpp"]void rotate(){    float radians = atan2(y_vel, x_vel); //0; //1.5708; //    if (x_vel<0)    {        radians = 0-(3.1416-atan2(y_vel,x_vel));    }    float cosine=(float)cos(radians);    float sine=(float)sin(radians);    int bmp_width = image.get_width();    int bmp_height = image.get_height();    float point1_x=(-bmp_height*sine);    float point1_y=(bmp_height*cosine);    float point2_x=(bmp_width*cosine-bmp_height*sine);    float point2_y=(bmp_height*cosine+bmp_width*sine);    float point3_x=(bmp_width*cosine);    float point3_y=(bmp_width*sine);    float minx=min(0,min(point1_x,min(point2_x,point3_x)));    float miny=min(0,min(point1_y,min(point2_y,point3_y)));    float maxx=max(point1_x,max(point2_x,point3_x));    float maxy=max(point1_y,max(point2_y,point3_y));    int dest_width=(int)ceil(fabs(maxx)-minx);    int dest_height=(int)ceil(fabs(maxy)-miny);    if (image_rotated.buffer.size()!= (uint32_t)dest_width*dest_height)    {        image_rotated.new_transparent(dest_width, dest_height);    }    for(int x=0;x<dest_width;x++)    {        for(int y=0;y<dest_height;y++)        {            int src_bitmap_x=(int)((x+minx)*cosine+(y+miny)*sine);            int src_bitmap_y=(int)((y+miny)*cosine-(x+minx)*sine);            if( src_bitmap_x>=0 && src_bitmap_x<image.get_width() && src_bitmap_y>=0 && src_bitmap_y<image.get_height() )            {              image_rotated.buffer[y * image_rotated.get_width() + x] = image.buffer[src_bitmap_x * image.get_width() + src_bitmap_y];            }        }    }}[/source]

Given that code, now the image never faces towards the direction it's going... I still think I should cap the rotation to 180º if I flip the image before rotating it. Yet I'm not sure how to limit it... As far as I can tell everything seems to work in radians here... *blocked*

EDIT: If I change the order of the parameters in the atan2 function to be as they should (y, x) and I swap the sin and cos then it works exactly as having the atan2 function with the parameters as (x,y).


    float cosine=(float)sin(radians);
    float sine=(float)cos(radians);


You shouldn't need to cap the rotation, xvel<0 should always result in a rotation between pi/2 and 3pi/2 (90-270 degrees) while xvel > 0 results in one that is either between 0 and pi/2(0-90 degrees) or between 3pi/2 and 2pi (270-360 degrees)

The fact that your image gets rotated at all when the angle is 0 means that you've messed up your rotation formula. (when radians is 0 there should be no rotation)

//some mindless typing to help me keep my mind on track, possible conclusion further down.

sin(0) = 0
cos(0) = 1

Thus your 3 points when you're not supposed to rotate anything becomes:

float point1_x=0;float point1_y=bmp_height;

float point2_x=bmp_width;float point2_y=bmp_height;
float point3_x=bmp_width;float point3_y=0;

then:

float minx=min(0,min(point1_x,min(point2_x,point3_x)));float miny=min(0,min(point1_y,min(point2_y,point3_y)));float maxx=max(point1_x,max(point2_x,point3_x));float maxy=max(point1_y,max(point2_y,point3_y));

minx = 0
miny = 0
maxx = bmp_width
maxy = bmp_height

//Image size doesn't change atleast.

Then for each pixel in the rotated image you do
int src_bitmap_x=(int)((x+0));     	
int src_bitmap_y=(int)((y+0)); 
if(  src_bitmap_x>=0 && src_bitmap_x<image.get_width()  && src_bitmap_y>=0 &&  src_bitmap_y<image.get_height() )  {          	
	image_rotated.buffer[y * image_rotated.get_width() + x] = image.buffer[src_bitmap_x * image.get_width() + src_bitmap_y];      	
} 
shouldn't:
image_rotated.buffer[y * image_rotated.get_width() + x] = image.buffer[src_bitmap_x * image.get_width() + src_bitmap_y];

be

image_rotated.buffer[y * image_rotated.get_width() + x] = image.buffer[src_bitmap_y * image.get_width() + src_bitmap_x];


#4820308 Please lay me a hand.

Posted by SimonForsman on 06 June 2011 - 06:13 PM


hmm wouldn't it work to rotate 0-(π-atan2(xvel,yvel) if xvel<0 ?(after flipping the image)

(Also , it should be 3/2π at 0,-1


Almost! With your tip the image gets well rotated when heading left, but when heading right (edit: or left) and going towards (x=1,y=1) or( x=-1,y=-1) (that is diagonally) the angle is flipped vertically (heading down when going up and the opposite).

here is the code I'm using to rotate the bitmap with your suggestion included:


[source lang="cpp"]void rotate(){    float radians = atan2(x_vel, y_vel); //0; //1.5708; //    if (x_vel<0)    {        radians = 0-(3.1416-atan2(x_vel,y_vel));    }    float cosine=(float)cos(radians);    float sine=(float)sin(radians);    int bmp_width = image.get_width();    int bmp_height = image.get_height();    float point1_x=(-bmp_height*sine);    float point1_y=(bmp_height*cosine);    float point2_x=(bmp_width*cosine-bmp_height*sine);    float point2_y=(bmp_height*cosine+bmp_width*sine);    float point3_x=(bmp_width*cosine);    float point3_y=(bmp_width*sine);    float minx=min(0,min(point1_x,min(point2_x,point3_x)));    float miny=min(0,min(point1_y,min(point2_y,point3_y)));    float maxx=max(point1_x,max(point2_x,point3_x));    float maxy=max(point1_y,max(point2_y,point3_y));    int dest_width=(int)ceil(fabs(maxx)-minx);    int dest_height=(int)ceil(fabs(maxy)-miny);    if (image_rotated.buffer.size()!= (uint32_t)dest_width*dest_height)    {        image_rotated.new_transparent(dest_width, dest_height);    }    for(int x=0;x<dest_width;x++)    {        for(int y=0;y<dest_height;y++)        {            int src_bitmap_x=(int)((x+minx)*cosine+(y+miny)*sine);            int src_bitmap_y=(int)((y+miny)*cosine-(x+minx)*sine);            if( src_bitmap_x>=0 && src_bitmap_x<image.get_width() && src_bitmap_y>=0 && src_bitmap_y<image.get_height() )            {              image_rotated.buffer[y * image_rotated.get_width() + x] = image.buffer[src_bitmap_x * image.get_width() + src_bitmap_y];            }        }    }}[/source]


Hmm, if you get things wrong when heading right aswell then the problem shouldn't be with the code i added (as it only applies when facing left) but rather with the rest of the rotation code.

I'm having a hard time wrapping my head around that at the moment though. (lots of math, might need a pen and paper for this)


#4820291 Please lay me a hand.

Posted by SimonForsman on 06 June 2011 - 05:16 PM

Hi. I've been trying to figure this out and I kind of can't.

I have an image that represents a character. By default, the character depicted in the image is standing and heading right.  ( -> )

Then, inside the "game" the character has a velocity vector (x,y).

So, given this velocity vector I'm calculating an angle in the following way:

float radians =  atan2(x_vel, y_vel);


So far, so good. A first problem was that when the velocity represents an angle of (180 CCW) the image gets upside-down. So what I did was to check if the x velocity was smaller than zero, and if it was, then I'd flip the image horizontally.

But now I can't figure out how to apply the rotation.  I need a way to adjust the rotation that comes from atan2 depending on whether the image is heading left or right.


                          coord (0,1)
                              π/2
            
       						│
       						│
                <-heading left  │  heading right ->
       						│
       						│
       						│
       						│
coord (-1,0) π  ────────────────┼─────────────── 0 or 2π  coord (1,0)
       						│
       						│
       						│
       						│
                                │
       						│
 				
                              3/4π
                          coord (0,-1)


Thanks in advance.


hmm wouldn't it work to rotate 0-(π-atan2(xvel,yvel) if xvel<0 ?(after flipping the image)

(Also , it should be 3/2π at 0,-1



#4819983 Substrings in Java

Posted by SimonForsman on 05 June 2011 - 11:09 PM

Here's the list:
Beef
Cheddar Cheese
Lettuce
Ranch Dressing
Salsa
Tomato
Tortillas

So each of these entries is loaded into autocompleteList from an external text file.
For example, as "Tortillas" is typed, here's the text inside the JTextField along with the caret position and the eventual error.

T|omato
To|mato
Tor|tillas
Tort|illas
Torti|illas
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: 5


You are making the comparison with all strings in the list, Beef is 4 characters

change:
if (testText.equals(autocompleteList.get(i).substring(0, caretPosition)))

to

if (testText.equals(autocompleteList.get(i).substring(0, Math.min(caretPosition,autocompleteList.get(i).length())))
and your problem should go away.


#4819531 C++ Graphics Programming

Posted by SimonForsman on 04 June 2011 - 03:31 PM

EDIT: I have done some research and chose SFDL as my library.

Hello to all,
I would like to ask a few simple questions in hope to get straight answers.

  • I want to develop on Windows using OpenGL + C++. Should I use an engine that does the Win32 calls for me to create the window for me (like GLUT, GLFW, SDL, and others...) or should I do them myself?
  • If the answer to 1 is using an engine, than what is the best, AAA game engine out there that allows full control? If not then see 3.
  • If the answer to 1 is doing it myself, then I can't seem to find good enough documentation on how to initialize a simple Win32 window, even on MSDN, so I'm having a tough time.
Thanks in advance,
David D.


Neither of the libraries you listed are game engines, they're just fairly basic frameworks to abstract away some platform specific details, you don't really lose control of anything important by using an up to date framework. (SDL 1.3 or SFML are good choices in general)

Using a Game Engine is a better option if your goal is to make a game but will cause you to lose some control, AAA game engines come with AAA price tags (Which can be as high as a few hundred thousand dollars for a license), the closest you'll get here is probably UDK (Which is effectivly a restricted version of Unreal Engine 3 targeted at hobbyists and small indie studios) or Unity. (Neither of those allow you to code in C++ though (Unity Pro allows C++ plugins, the free version doesn't)).

as for 3. don't bother doing it yourself, Win32 is an ancient and awful API and if you ever intend to port your code to for example Linux you have to take that ancient and awful win32 code and port it to equally ancient and awful X11 code. (I don't know how bad Apples APIs are), the only reason Win32 still exists is because changing it would effectivly break compatibility with old software, Microsoft has provided .Net as a modern replacement for windows UI development.


#4819516 internals of cout?

Posted by SimonForsman on 04 June 2011 - 02:47 PM

im curious as to if anyone knows the internals of how cout works?

for example the step by step internals of what happens when executing the following statement in c++

cout << "hello world" << endl;

-thx

http://gcc.gnu.org/libstdc++/

Thats one way it can work. (Other vendors c++ libraries most likely have different implementations)


#4816784 Where i can get a programmer for a clientless bot?

Posted by SimonForsman on 28 May 2011 - 09:07 AM

If you need to advertise in chat in your own mmorpg you should have the server send those messages rather than creating new characters for it (Easier to implement and far less overhead).

If you want to advertise in chat in someone elses mmorpg you should contact the owners of that game and work out an advertising deal with them.

If you want to send spam in someone elses game without permission then you should rethink your business model, i don't think anyone here will help you.(This is against the terms of service for most mmorpgs)


#4815207 Exporter to DX

Posted by SimonForsman on 24 May 2011 - 11:28 AM

Does blender 2.5 support export for directx ?

If it doesent, how to make one?



Modern Direct X doesn't support any model format directly, Blender can export to most commonly used model formats or if needed your own custom formats (you have to write an exporter for that though), You can then use a model loading library or write your own model loader for whatever format you're using (This has nothing at all to do with DirectX).

What professionals use is pretty much irrelevant, expensive tools like 3dsmax and Maya won't let you create better models than the ones you can make with a free tool like Blender, they might reduce the time it takes you to make the models though.

Their main advantage however is the renderer. (This is an area where blender is lagging behind quite a bit and integration with third party renderers like Mental Ray is far better in 3dsmax and maya than it is in blender)


#4814322 Ants vs computer

Posted by SimonForsman on 22 May 2011 - 01:59 PM

Use Linux.


http://ant.apache.org/manual/install.html ?


#4814030 Confused about C++

Posted by SimonForsman on 21 May 2011 - 06:29 PM

I've been wanting to learn C++ for awhile now, I recently finished an object-oriented programming class and did fairly well there. So today I decided I'm going to start learning C++ in my spare time between my other classes. So I cracked open my C++ for Dummies book I've had lying around and went through the steps of setting up Dev-C++ on my machine and started reading through the book. The books says that everything in the book is command line based.  This is where I am confused, I know that C++ is used for many applications and most games, but am I missing something? How can I learn to create games if everything is command line based. I did a quick search here and couldn't find my answer.


Basically everything your game does that affects any hardware(such as the graphicscard) besides the cpu and ram is platform dependant, if you're using a realmode OS (such as DOS) you can get graphics by writing directly to the graphics card, for modern operating systems (Windows/Linux/etc) direct hardware access is restricted to drivers and you have to use the APIs provided by the OS and/or drivers in order to access the hardware. (Even access to the keyboard is restricted so C++ can only access the standard input (Which may or may not get its data from the keyboard just like the standard output may or may not be printed into a console window) (Full keyboard access is obtained through the OS just like access to any other piece of hardware)

For Windows this means that you have to use Win32 to talk to the OS and Direct3D / OpenGL / Direct2D or GDI for graphics. You can also use a higher level API that sits on top of the APIs your OS supports directly (Many such high level APIs will allow you to use the same code on multiple platforms and are in general far better than the OS specific APIs they use under the hood). (Both Win32 and X11 are awful APIs so for games something like SDL or SFML are far better options)


#4814013 How Gamestop Reduces Developers' Sales

Posted by SimonForsman on 21 May 2011 - 05:11 PM

The right of a consumer to sell items he bought is absolute, if i buy a copy/license of a game i own that copy/license and have the right to sell/transfer it to someone else if i see fit to do so, GameStop has the right to buy copies/licenses from individuals and resell them at a higher price, If the amount of money they make doing so is unreasonably high it should be possible for competing stores to offer more for trade-ins or charge less for used games. This is how the free market works,

While the free market itself is far from perfect one should think very carefully before allowing governments or corporations from interfering with how it works. (Some interference can be justified (Copyright and Patents for example are an acceptable way to make products with high R&D costs but low marginal production costs profitable, but those are regulated by law and the people has the power to get these changed if they see fit to do so).

Those attempting to restrict basic property rights for the paying customers (Through the use of restrictive DRM, or restrictive EULA/ToS) are the real thieves in the software world. (Copy protection is fine as long as it only prevents piracy), If the right to resell a license is restricted in any way it should be made clear to the customer before any payment goes through. (This is something most publishers are bad at, DRM infected or restrictivly licensed software should have clear warning labels informing the customer of all the restrictions that are in place (shrinkwrapped licenses in general are a very bad thing and at the very least a  basic outline of the permissions and restrictions given should be on the box itself.


#4813569 Problem starting out with SDL and OpenGL

Posted by SimonForsman on 20 May 2011 - 12:46 PM

I worked through most of Lazy Foos Tutorials on SDL without problems and am now trying to get the last one to work: Using SDL with OpenGL 2.1

However, I can't even get the sample code to compile. I'm using Visual Studio 2010 and this is what I get:

1>main.obj : error LNK2019: unresolved external symbol __imp__glGetError@0 referenced in function "bool __cdecl init_GL(void)" (?init_GL@@YA_NXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glOrtho@48 referenced in function "bool __cdecl init_GL(void)" (?init_GL@@YA_NXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function "bool __cdecl init_GL(void)" (?init_GL@@YA_NXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "bool __cdecl init_GL(void)" (?init_GL@@YA_NXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function "bool __cdecl init_GL(void)" (?init_GL@@YA_NXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function "public: void __thiscall Square::show(void)" (?show@Square@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glVertex3f@12 referenced in function "public: void __thiscall Square::show(void)" (?show@Square@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glColor4f@16 referenced in function "public: void __thiscall Square::show(void)" (?show@Square@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function "public: void __thiscall Square::show(void)" (?show@Square@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glTranslatef@12 referenced in function "public: void __thiscall Square::show(void)" (?show@Square@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _SDL_main

Probably overlooking something really simple here. I tried searching whether I missed something I should have set up, but so far no luck.



On a related note, is OpenGL the way to go for 2D games with SDL or are there alternatives? (not looking to get into 3D just yet) I have read that the SDL renderer is rather slow, so I imagine I want some sort of hardware acceleration in any case.

Thanks for any help.




make sure opengl32.lib is linked with your project.

SDL 1.2 has a fairly slow 2D renderer, SDL 1.3 however has hardware acceleration for 2D aswell.

the "fairly slow" 2D renderer is fast enough for most 2D games, it just doesn't use hardware acceleration which makes some operations (realtime scaling/rotating/etc of sprites for example) a bit expensive. (This isn't necessarily a big problem as you can do those things in advance and cache the resulting sprites), (We had realtime 3D graphics done in software on ~100 mhz pentiums without any hardware acceleration, a modern machine won't break a sweat if you throw some 2D rendering at it, even if its a software renderer)




PARTNERS