Jump to content

  • Log In with Google      Sign In   
  • Create Account

ZwodahS

Member Since 11 May 2010
Offline Last Active Jun 16 2013 05:18 AM
-----

Topics I've Started

Pixel garden (Prototype)

08 May 2013 - 01:34 AM

Hi , I am not sure if this is the place for this, so if it is not, please help me move it to the correct place.

I have made a prototype for an idea that I had over the last weekend and I would like to have some feedback for it. Personally I like the idea but I don't think it would be fun for many people. I have many ideas to make it into a full game but I would like some feedback before doing so.

I have attached the files for mac and windows.

Attached File  Pixel Garden(MacOSX).zip   200.28KB   13 downloads
Attached File  Pixel Garden(win).zip   1.41MB   27 downloads

Let me know if you can't run it and I will try to fix it.

The game revolve around planting pixel seed. Each seed will grow in different ways to different size at different speed. They will then stay matured for a while before they decay. When 2 different seed tries to grow into a pixel that is still growing, that pixel will mutate and form a new type of seed. The new seed will inherit traits from the parents. Some traits may be lost in the process of breeding. The starting 8 seeds contains all the genes in the game but they are not expressed by them. However, children of theirs may inherit these genes and express them.

Since I intend the game to be an experimental game, I don't want to spoil more stuffs by saying how they breed and how things are inherited.

Let me know if you enjoy it =).

PS: If the instructions is not clear, let me know. They are added at the last minute.

SDL multiple layer transparency issue

11 April 2013 - 12:16 PM

Hi guys I have another issue with SDL recently. Here is the smallest segment possible.

Circle is a circle with a hole in the middle and square is just a square.

SDL_Surface* loadImage(std::string filename)
{
    SDL_Surface* img = IMG_Load(filename.c_str());
    if(img == NULL)
    {
        return NULL;
    }
    SDL_Surface* optimized = SDL_DisplayFormatAlpha(img);
    SDL_FreeSurface(img);
    return optimized;
}

int main(int args , char* argv[] )
{
    if(SDL_Init(SDL_INIT_EVERYTHING) == 1)
    {
        std::cout << "error" << std::endl ;
    }
    SDL_Surface* surface = SDL_SetVideoMode(100,100,32,SDL_SWSURFACE);
    SDL_Surface* circle = loadImage("circle.png");
    SDL_Surface* square = loadImage("square.png");
    SDL_PixelFormat* format = surface->format;    
    SDL_Rect rect = {0 ,0 , 100 , 100};

    // draw code
    
    SDL_Flip(surface);


 

so for the draw code , this works.

    SDL_BlitSurface(square,&rect,surface,&rect);
    SDL_BlitSurface(circle,&rect,surface,&rect);

However, I want to draw to a temporary surface first before drawing.

Then this don't work.

    SDL_PixelFormat* format = surface->format;
    SDL_Surface* temp1 = SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,32,format->Rmask,format->Gmask,format->Bmask,format->Amask);
    SDL_Surface* temp2 = SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,32,format->Rmask,format->Gmask,format->Bmask,format->Amask);

    SDL_BlitSurface(square,&rect,temp1,&rect);
    SDL_BlitSurface(circle,&rect,temp2,&rect);
    SDL_BlitSurface(temp1,&rect,surface,&rect);
    SDL_BlitSurface(temp2,&rect,surface,&rect);

 

When I do this, the temporary surface has a black background and the final output is only a circle.

 

I checked and I found out that surface->format->Amask is 0 , so the created surface do not have alpha enabled.

So instead of using surface-> format, i tried using circle->format instead. The result ? , nothing is drawn.

 

I tried other stuffs as well, like doing a SDL_FillRect onto temp1 and temp2 , but it still doesn't do what i want. =( 

I tried doing SDL_SetAlpha as well but still didn't work. What am i missing ? =/

 


SDL multiple layer - why doesn't this work?

21 March 2013 - 07:08 AM

Hi , i was playing around with SDL but I couldn't get a surface to be blit onto another surface.

 

Here is the code

 

#include <iostream>

#include "SDL/SDL.h"
#include "SDL/SDL_image.h"


int main(int argc , char * argv[])
{
    if(SDL_Init(SDL_INIT_EVERYTHING)==-1)
    {   
        return -1; 
    }   
    SDL_WM_SetCaption("Testing",NULL);
        
    SDL_Surface* _screen = SDL_SetVideoMode(500,500,32,SDL_SWSURFACE);

    SDL_Surface* img = IMG_LoadPNG_RW(SDL_RWFromFile("img/blocks.png","rb"));

    SDL_Surface* f1 = SDL_CreateRGBSurface(SDL_SWSURFACE,500,500,32,0x000000ff,0x0000ff00,0x00ff0000,0xff000000);

    std::cout << SDL_BlitSurface(img,NULL,f1,NULL) << std::endl;

    std::cout << SDL_BlitSurface(f1,NULL,_screen,NULL) << std::endl;

    SDL_Flip(_screen);
    SDL_Delay(3000);

}

 

 

I tried many things but it still doesn't work.


I think i am missing something here but I am not sure what.


C++ Opengl on Mac OSX

19 March 2013 - 05:18 AM

Hi guys,

 

Recently I started learning C++ Opengl and I have encountered problems with setting up certain things

 

I am currently following the examples in http://lazyfoo.net/tutorials/OpenGL/index.php

 

I am very new to C++ but I managed to set up most of the tools/libraries needed. However, I can't seems to install glew properly.

I mainly use vim to code so I do not have a IDE. 

 

Currently in tutorial 15, he introduced glew. I downloaded the latest glew from sourceforge and compile it myself.

When i try to compile it(the example in tutorial 15) gave me the following error

 

g++ *.cpp -o gl -framework GLUT -framework OpenGL -lIL -lILU -lILUT

 

Undefined symbols for architecture x86_64:
  "_glewInit", referenced from:
      initGL()    in ccfz5EFV.o
  "_glewGetErrorString", referenced from:
      initGL()    in ccfz5EFV.o
  "___GLEW_VERSION_2_1", referenced from:
      initGL()    in ccfz5EFV.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [compile] Error 1
 
from my limited knowledge of C++, i think this is a problem with using a 32bit library on a 64bit one. I can't seems to be able to find a solution after few hours of search on google. 
 
Can anyone help ?

Does this exist ?

27 February 2013 - 10:44 PM

Hi guys, not sure if this is a correct place to post this, if not please help me move it.

 

The simple way to put the idea is Sid meier's pirate + Dwarf fortress

 

I was thinking of an adventure game where you control a small crew of adventurers where you can choose your own destiny in a randomly generated world, somewhat like dwarf fortress. Instead of building a fortress, you take the crew and explore the world, creating a name for yourself. You can be a pirate, pillaging villages , robbing other ship, or be an adventurer exploring the world and collecting artifacts. 

Each of your crew member will also have personalities and can become famous in their own right. Fighters can become legendary and famous throughout the world, Doctors on your ship can also become legendary if they found cure for diseases. Craftsman can become famous if they make good weapon/armor.

 

I not sure how the gameplay would be like since I am focusing on the experience that the player will have when playing the game.

 

Any idea if such game exist ? 


PARTNERS