OpenAlchemist !

You are not logged in.

Announcement

Registrations are currently closed, because of too much spam. We are looking for a solution.

#1 2009-03-18 14:32:18

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Question on source code

Hi there!

I am sorry about this specific question, maybe it is a dummy one but, I study the code source of openalchemist and I could not understand a part of it in the SkinsMenuState class :

Code:

std::string path = get_save_path();
std::string file_path = path + get_path_separator() + "skins-" + get_version();

I wanted to find this file where the configuration should be saved and I could not find it.

I missed something, but what?

Thanks in advence for your help

Offline

 

#2 2009-03-19 11:46:24

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

In Linux, the configuration is saved in $HOME/.openalchemist/skins-{version}

In Windows, in $User\Application Data\OpenAlchemist\skins-{version}.ini (from my memory).

Does it help you ?

Offline

 

#3 2009-03-19 17:37:29

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

Yes, very much actually!!
So I will have to change this entirely!

Thank you!

Offline

 

#4 2009-03-27 15:18:16

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

Hi again!
Sorry to bother you but I have another question for you on the source code.

I am actually trying to port your code replacing the ClanLib by SDL only (on parts that could be). I am facing an issue concerning the keyboard events management.

Could you explain me what does exactly this code :

Code:

if(CL_Keyboard::get_keycode(key))

Does it get a keyboard event from a pile?
Does it get a keyboard event on the fly?
In fact I don't really get the strategy for the keyborad event management in the whole code...
From my point of view, I would treat a keyboard event like

Code:

switch(event.keyboard.key)
{
   case KEY_UP:
  ...
   case KEY_DOWN:
...
}

and so on, in the main loop, so somewhere like in GameEngine::run(). But when I do that I have a lot of events (too many, of course) for a key pressed...

And if I replace the Clanlib keyboard call in the KeyboardKey::get() method by an SDL event catch to get the keyboard I can only match the first case of the XXXstate::events() method... I don't know whether I'm clear...

Could you give me a little hand on this event management please?

Thank you in advance for your answer.


EDIT : Well, I found a solution to get the input in GameEngine::run() and manage the events correctly...  Sorry to bother for nothing... But still, this way of managing keyboard events is weird, don't you think?

Last edited by Gecko667 (2009-03-27 16:40:20)

Offline

 

#5 2009-03-28 15:20:00

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

You can do something like that :

Code:

Uint8 *keystate = SDL_GetKeyState(NULL);

  if(keystate[SDL_KEY_UP])

Events are managed with "if test" for each keys at each frame.

I know the other way : using event stack as you show me. But how to check if a button is pressed during more than one frame ? I guess there is an option with SDL but, well, for instance, it works.

Offline

 

#6 2009-03-28 15:27:12

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

Other thing : Why are you porting the game to SDL only system ? Clanlib provides very good way to manage resources, with Zip compression and XML data descriptions (like sprite position, size, animation...). You will lose a lot of flexibility or be forced to rewrite a lot of things. Sometimes, using a good framework is the right thing to do, don't you think ?

Keph.

PS : on the svn repository, I am making a new menu system. Maybe this could interest you.

Offline

 

#7 2009-03-28 18:29:03

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

For the event thing I put this in the GameEngine::run() method :

Code:

    SDL_Event event;
    SDL_PollEvent(&event);
    if (event.type == SDL_KEYDOWN)
       if ( (previousKey != event.key.keysym.sym) || (repeat >25))
    {
       repeat = 0;
           resources -> CurrentKeyPressed = event.key.keysym.sym;
           previousKey = event.key.keysym.sym;
    }

    repeat++;

This is a good way to prevent from too many events from keyboard. I admit that it is not the prettiest but it works fine.

To answer your question concerning the porting, well, actually I did not want to tell until it is finished but, as I run an alpha version that works fine (even the skin thing tongue) I think now I can tell : I am porting your game on sony PSP.

So as the Clanlib is not compiled for PSP I had two choices : porting your game on SDL and Zlib or porting Clanlib on PSP.... I admit that I chose the easiest way...

I have still a lot of work to do, resize all the pics correctly (for the moment I just resize with PSP ratio, not so pretty) , manage appearing and disappearing animations, do a Bitmap font for high score...

As soon as I will have a correct version to present I promise to post it here in first wink

Thank you for your time, I will let you know my progress...
Cheers,
Gecko

Offline

 

#8 2009-03-28 21:13:31

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

Your welcome.

Your project is exciting. Good luck for your work, I really want to see your progesses !

How does it works ? You will propose a CD-iso that user have to burn, or you need a special hardware for PSP hacking ?

Offline

 

#9 2009-03-28 21:50:33

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

Thank you!

I think I will propose a simple archive with the pictures and the "EBOOT.PBP" file that is the specific executable file for PSP at first. It is sufficient, users would have to put them on a memory stick in the correct path. It is basically a homebrew.

You can find a lot of information about PSP homebrews on www.pspgen.fr website. I don't want to be more precise, but yes basically you'll have to hack the PSP firmware to make my homebrew work.

I hope to be able to present you some "screenshots" soon : I'll take a picture of my PSP tongue

I go back to work, I have a bitmap font to make wink

Hope this website will answer your questions...

Offline

 

#10 2009-03-29 09:12:41

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

Oh and I forgot, I am interested in your new menu system, thank you.
On which svn should I fetch to get it?

I fact I was thinking about making a title menu instead of beginning by the demo player... Something that looks more like PSP game...

Offline

 

#11 2009-03-29 11:28:38

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

Hi.

For SVN, it's here : https://openalchemist.svn.sourceforge.n … alchemist/

I will probably try your work with an emulator : I don't want to hack my brother's PSP ^^.

Offline

 

#12 2009-04-01 11:02:37

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

Hi again,
I am sorry I did not get the time to see your new menu yet ...

I am facing an issue with your code.
I try to change the width of the pieces and if I choose a size below 30 the fall action is corrupted. You can try it on your code simply, it fails too.

I think maybe the reason is that the calculation of piece_bottom_x and piece_top_x in Board::add_pieces is corrupted, the coords are corrupted because a value below 30 corrupts the position.

For example in a case, if I use 30 as pieces_width value I obtain a piece_top_x equals 2.5, so int casted 2
But with 25 as pieces_width value I obtain 3...

Could you take a little time to make a try and see why this happens? It's been 2 days I am searching and your code seems fine to me... I don't understand...

Did you see that limitation?

Thanks for your time
cheers

Offline

 

#13 2009-04-01 12:34:25

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

I won't be able to see it until tomorow night, please remind me if I forget...

Offline

 

#14 2009-04-01 13:16:29

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

Ok no problem, I have still a lot to do on other sides...

PS : sorry I did ask you about the SVN, I should have seen it by myself on the doc tab...

Offline

 

#15 2009-04-02 09:55:51

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

Next time I will yell at you "RTFM !" wink

Offline

 

#16 2009-04-02 18:57:48

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

Actually, it seems to work with even numbers (nombres pairs). So, you should be right : there is a division witch corrupt the system. For the moment, you can set a bigger width. It's great because it add margin between sprites in the game board.

Yeah, it's not really a bug fix :p

Offline

 

#17 2009-04-03 14:07:45

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

Ok so let's go for 26 as piece size but this is cheatting! tongue

So now, I have :
- functional board : game engine and events mngt ok!
- global display
- score display (font based on SDL clips)
- Almost all dialogs ok (options and skin management need some little fix)
- skin change during game
- Demo player ok (but need little fix on start phrase)

Next milestones :
- Little fixes seen upper...
- Animation on appear/disappear pieces
- Animation on combos (not managed at all)
- file management adapted to PSP folding
- Try to manage xml resources files or equivalent to adapt position of mini piece score indication (or change skins background ;P)
- and a lot of other things a thought about...

To see a sample of my work I could give you a linux compiled version, this is my way to debug it. It could be easier than find a correct PSP emulator. And in fact it gives exactly the same thing as on a PSP...

I think that I could maybe present you something in about a few weeks, I have a job you know and I have less time for fun programming these last days...

Thanks again for the support

Next news soon (I hope)!

Offline

 

#18 2009-04-04 00:56:19

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

I can propose you a special branch in our svn repo. Are you interested ?

Offline

 

#19 2009-04-04 09:17:08

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

Wohao, it would be really great thanks!
For the moment my repository is my mailbox, and my svn command is tar -cvf wink

I am just wondering what you will think about the code when you will see the massacre of your pretty C++ by C routines calls everywhere tongue...

I am really interested, thank you very much. Let me know how I could use it!

Offline

 

#20 2009-04-04 11:00:37

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

First, you need a Sourceforge account.

I started this game when I was a student. Now, I have a job too, and it's C++ programming. So, I just can't do the same thing at home! I'm not giving up the project, but I work on it very slowly.

Offline

 

#21 2009-04-06 10:03:52

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

Sourceforce account opened. I sent you a mail from there.

I think that I will work slowly too on this... My job includes assembly/C programming on SoC so I understand your point of view...

Still, C++ programming for psp is so much more fun than what I am doing right now at work... Oh, btw, pieces animation done...

Offline

 

#22 2009-04-06 13:35:50

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

I sent you an e-mail.

Offline

 

#23 2009-04-06 15:41:22

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

Thank you,
I apologize in advance for dummy stuff I could make. I am new at svn.
I made my firsts revs and I already see some mistakes...
With what I commit you would be able to run my actual version.

If anything in the path or directories or tree does not seem good to you please let me know the way you would rather.

Thanks again, in fact this repository will help me a lot!

Offline

 

#24 2009-04-06 16:59:43

Keph
Developer / Moderator
From: Paris
Registered: 2008-07-18
Posts: 79
Website

Re: Question on source code

It looks good to me. Maybe you should create a folder called "System" in which you put your SDL engine files. It's what I do with my SDL projects. It may simplify merges if you devide "upstream" code and "specific" ones. But do it as you want.

PS : It's not difficult to cheat the highscores ^^

Edit: Grr, you have changed the number of columns !!!

Offline

 

#25 2009-04-06 19:34:21

Gecko667
Member
Registered: 2009-02-26
Posts: 21

Re: Question on source code

Yeh well, for highscores, I needed something easy to manipulate it and see whether the progress bar and the font were ok. I hope to put that in a real "savegame" psp file.

Yes I change the number of columns, but in fact it is a matter of proportions. Less columns make me increase the size of the pieces to fit in background and then I don't have enough room for the number of rows...

Edit: I sent you a mail from my new mailbox

Last edited by Gecko667 (2009-04-07 15:12:31)

Offline

 

Board footer

Powered by FluxBB