FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

2D Arcade Game Library graphics primitives + more
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic     Forum Index -> ArcLib
View previous topic :: View next topic  
Author Message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Tue Apr 04, 2006 9:34 pm    Post subject: 2D Arcade Game Library graphics primitives + more Reply with quote

This topic is a continuation of the topic http://www.dsource.org/forums/viewtopic.php?t=1401 ("OpenLayer Port")

Here is my latest reply...
_______________________________________________________________

Phr00t wrote:

Hrm... is there much un-needed overhead when creating 'frames' that you are not going to use any collision detection with? (for instance, you could want to have a "button" frame that you will just click)


There is no overhead for the Box collision and Radius collision types. The PerPixel collision, on the other hand, stores collision maps for every # of degrees of the frame.

Quote:

I checked-out your /arc/ stuffs and put it in my /dmd/import directory, so I should be able to use it Smile I assume your updates will be reflected in the SVN repository


I wouldn't recommend putting arc/ in the dmd import directory. Here is what I use...

mpong/
-->arc/
-->derelict/
-->pongbin/
-->run-build.bat

The run-build.bat file looks like... (assuming you have build on your PATH)

build main.d -g -debug -Rn -full -cleanup -unittest
PAUSE
main.exe

The run-build.bat allows you to click the 'build project with bat file' button in Poseidon and makes building projects easy.

If you don't have build, get it here (www.dsource.org/projects/build).
If you don't know how to put build on your path, look here (http://www.digitalmars.com/techtips/command_prompt.html) this is for DMD, but the same will go for build. I usually just keep build in my dmd/bin directory anyway.

When I get the updates on, you can just do 'svn update' or similar.

Quote:

I'm not sure if you have this yet or not, but support TTF through FreeType fonts (or something) for your text rendering?


I havn't looked much into freetype as it seems like a lot of complexity to do something simple such as rendering a font, although I know of its benefits. This is one of the areas that I would need help in.

http://dsource.org/projects/bindings/browser/trunk/freetype and http://oglft.sourceforge.net/ will probably be a good start.

Another area I need help in is using the RakNet library I ported to D to do networking, I can make a simple chat and line drawing program but I havn't figured out how to make my pong game networked yet.

Quote:

Your GUI looks pretty interesting too Smile keep up the work, I'd love to help when I have the time -- let me know if you need it


FreeType and RakNet integration would be big helps, although another big help would be if you just started making a game using arc and telling me how it is broken and what I can do to make it better.

Right now my GUI is interesting and works but is rather lame and difficult to program.

If I get the time, I'll be working on a new gui called 'SoftGUI' which will allow for different skins (so a good artist can make it look professional) and it will be very easy to create new GUI's as I want to make a program

GUIBuilder --> Allows Visual GUI design and will save to either a .lua file or a binary file.

And all the programmer will have to do is this to load, process, and draw the GUI.

SoftGUI gui = new SoftGUI("gamemenu.gui");
gui.process();
gui.draw();

if (gui.clicked)
{
...if (gui.action == "New Game")
......startNewGame();
...if (gui.action == "Video Options")
......videoOptions();
...etc.
}

I also have the same planned for a 'Creature Creator' and I've managed to extract StarCraft characters as my test data Razz I plan to have some sort of visual tool that allows the creation of a character, set and name animations, give sounds to animations, and then save it all into one big .zip file. Of course to do this I need a good GUI, which is the point of SoftGUI.

But right now all I have time for is simple maintainance and simple codes.
Back to top
View user's profile Send private message AIM Address
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Wed Apr 05, 2006 12:42 am    Post subject: Reply with quote

I got primatives working, check out

http://warbots.dsource.org/ and http://warbots.dsource.org/arc/arc/gfx/prim.html .

I also got the pong to compile with the latest DMD and updated the docs slightly. Let me know if you need help compiling anything.
Back to top
View user's profile Send private message AIM Address
Phr00t



Joined: 03 Mar 2006
Posts: 203

PostPosted: Wed Apr 05, 2006 8:48 am    Post subject: Reply with quote

Quote:
The run-build.bat allows you to click the 'build project with bat file' button in Poseidon and makes building projects easy.


Hrm.. I place the arc in my import directory, so it is already added to the -I list. I can just use the "build" button without any .bat file to build the project Smile

Build is some good stuff, by the way. Smile

Quote:
FreeType and RakNet integration would be big helps, although another big help would be if you just started making a game using arc and telling me how it is broken and what I can do to make it better.


I SVN'ed freetype from bindings, and I'll see what I can get from this. I might have time this week to look into it... although I want to get started on my game Wink

I'm thinking on making a 2D MicroSoft Freelancer kinda game, but have it generate "space" randomly (space stations, planets, ships, gates etc.), and all items are random -- so there are an infinite amount of items/places to explore. I already have quite a bit of experience in this field Wink

I don't know if I like the idea on relying on scripts for too much stuff... I think you should make things functional without scripts first:

SoftGUI gui = new SoftGUI();
gui.addButton(char[] graphic_filename,size,x,y,char[] action_string)
gui.addTextBox(....)
gui.draw

...

gui.action == action_string

...

gui.ImportScript("gamemenu.gui")

...

(i think your current GUI already does this? -- you shouldn't have "two" GUI systems in your library.. just add functionality to your current Gui without making it more "complex")

Couple of things you could improve on:

In the "snd" libraries: have the open() function be able to take in arguments for sample rate etc.

Can you also have samples be played at different frequencies? Like play(1000) would play at normal rate, play(2000) would play twice as fast/high pitched etc.?

Also, your primitives should have an alpha argument e.g. drawRect(...,r,g,b,a...)

I played your pong game -- cool Smile I love the square explosions Wink
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Wed Apr 05, 2006 2:05 pm    Post subject: Reply with quote

Quote:

I'm thinking on making a 2D MicroSoft Freelancer kinda game, but have it generate "space" randomly (space stations, planets, ships, gates etc.), and all items are random -- so there are an infinite amount of items/places to explore. I already have quite a bit of experience in this field Wink


Impressive, can't wait to see what you can cook up.

Quote:

I don't know if I like the idea on relying on scripts for too much stuff... I think you should make things functional without scripts first:


You'll be able to create GUI's programatically as well, and I will only have 1 GUI system.


Quote:

Couple of things you could improve on:

In the "snd" libraries: have the open() function be able to take in arguments for sample rate etc.


Done.

Quote:

Can you also have samples be played at different frequencies? Like play(1000) would play at normal rate, play(2000) would play twice as fast/high pitched etc.?


I'm looking through the SDL_mixer docs ( http://jcatki.no-ip.org/SDL_mixer/SDL_mixer.html ) and the only function that uses frequency is Mix_OpenAudio, I don't see any support for changing the frequency of a particular chunk at runtime. Maybe I'm missing something? I'll keep it in mind for the future if I figure it out.

Quote:

Also, your primitives should have an alpha argument e.g. drawRect(...,r,g,b,a...)


Done.
Back to top
View user's profile Send private message AIM Address
Phr00t



Joined: 03 Mar 2006
Posts: 203

PostPosted: Wed Apr 05, 2006 2:53 pm    Post subject: Reply with quote

Quote:
I don't see any support for changing the frequency of a particular chunk at runtime. Maybe I'm missing something? I'll keep it in mind for the future if I figure it out.


This was a feature I liked about Allegro, because you could play sounds at slightly different frequencies randomly, so sounds didn't sound too "repetitive". Don't worry about it too much if SDL doesn't support it already.

I'll begin work on my game soon, I'm going to call it FreeUniverse Smile

I'll let you know if I can come up with anything more for ARC. I think its good to start with now.. maybe do a little more work on the documentation?

Thank you mucho!
Back to top
View user's profile Send private message
Phr00t



Joined: 03 Mar 2006
Posts: 203

PostPosted: Wed Apr 05, 2006 3:05 pm    Post subject: Reply with quote

ahhh maybe I have thought of things -- can you make a constructor for your particle class that doesn't require Lua? I haven't looked too much into your explosion code, but do they all make square explosions?

and with the new "snd" open() function... I'm not sure what format/chunksize variables I should set. Maybe still have the default values in the arguments? so like open(int sample_rate = 22xxx, uint16 format = ?? ... )

I'm sure I can find this in the SDL_mixer docs somewhere... Very Happy

[ edit ] can I have access to commit stuffs to the SVN? I made some updates to the soundfx.d file -- I fixed some compiler errors by changing some ~~ to ~, private imported std.file, and made sdl_mixer imports public (so I can use MIX_DEFAULT_FORMAT types etc.)

[ edit2 ] mouse -- can I hide or change the default mouse pointer? I might want to use my own mouse pointer graphic. Add a function like setMouseSprite(char[] filename) and setMouseVisible(bool enable) and getMouseVisibility() ?
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Thu Apr 06, 2006 4:48 am    Post subject: Reply with quote

About the changing sound frequency at runtime, OpenAL most likely has this functionality, and Audiere http://audiere.sourceforge.net/audiere-1.9.4-users-doxygen/ seems to have it as well. Audiere looks a lot easier to use than OpenAL, so I'm leaning towards that.

Phr00t wrote:
ahhh maybe I have thought of things -- can you make a constructor for your particle class that doesn't require Lua? I haven't looked too much into your explosion code, but do they all make square explosions?


Done (but not tested), and yes.

Quote:

and with the new "snd" open() function... I'm not sure what format/chunksize variables I should set. Maybe still have the default values in the arguments? so like open(int sample_rate = 22xxx, uint16 format = ?? ... )


I use DDoc to generate my documentation so just look at the top of each file, usage is most likely there.

Quote:

[ edit ] can I have access to commit stuffs to the SVN? I made some updates to the soundfx.d file -- I fixed some compiler errors by changing some ~~ to ~, private imported std.file, and made sdl_mixer imports public (so I can use MIX_DEFAULT_FORMAT types etc.)


Sure, I'll contact Brad about that.

Quote:

[ edit2 ] mouse -- can I hide or change the default mouse pointer? I might want to use my own mouse pointer graphic. Add a function like setMouseSprite(char[] filename) and setMouseVisible(bool enable) and getMouseVisibility() ?


Done (not tested extensively), API is in the docs.

------------------------------------------------------------------------------------
Just a note about indentation: In linux I used kate and I was able to use very specic tab controls (tab = 3 spaces and convert tab into spaces). Poseidon doesn't allow this so I'm stuck trying to fix a whole lot of indentation.
Back to top
View user's profile Send private message AIM Address
Phr00t



Joined: 03 Mar 2006
Posts: 203

PostPosted: Thu Apr 06, 2006 9:20 am    Post subject: Reply with quote

Quote:
Audiere looks a lot easier to use than OpenAL, so I'm leaning towards that.


Sounds good... if you can, try and keep your current simple interface (open(..), play(...)) because its easy to use Smile just add optional arguments and functions to access more complex features...

Hrm.. maybe I can look into making your explosion code better -- I'm going to need explosions for my space game Wink

I found out the arguments for open(...) in the SDL_mixer docs... I'm not sure if the info was at the top of the source file or not...

OK -- Algorithms class is starting, have to go! Very Happy
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Thu Apr 06, 2006 10:08 am    Post subject: Reply with quote

I'm going to be changing the graphics primitive arguments from ints to floats, and the colors to shorts.

Also, I was told you now have SVN access, I ask you to just make a post somewhere for changes (maybe even start a new forum topic for them) so I'm not surprised to see certain things change.

edit: also, i was thinking of giving the mouse cursor per-pixel collision ability, but not sure if it is really needed. Currently I have the mouse X, Y in the center of the image, I don't know if you'd rather have it at the top left or not.

edit2: as far as docs go, I'm reluctant to spend much time every time I make a little change, as updating the docs takes a long time. But for the next doc updates I'm going to look into CandyDoc ( http://www.dsource.org/projects/helix/wiki/CandyDoc )
Back to top
View user's profile Send private message AIM Address
Phr00t



Joined: 03 Mar 2006
Posts: 203

PostPosted: Thu Apr 06, 2006 10:27 am    Post subject: Reply with quote

Quote:
I'm going to be changing the graphics primitive arguments from ints to floats, and the colors to shorts.


OK, sounds good.

Quote:
Also, I was told you now have SVN access, I ask you to just make a post somewhere for changes (maybe even start a new forum topic for them) so I'm not surprised to see certain things change.


Hrm, how do I find out what my login/password is? Very Happy Sure, I'll do the posts.

Quote:
edit: also, i was thinking of giving the mouse cursor per-pixel collision ability, but not sure if it is really needed. Currently I have the mouse X, Y in the center of the image, I don't know if you'd rather have it at the top left or not.


I personally won't need it...

What other libraries usually do is have a setMouseFocux(int x, int y) function, where they can set which "pixel location" to set the mouse x, y to
(e.g. 0,0 is upper left)
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Thu Apr 06, 2006 3:55 pm    Post subject: Reply with quote

Quote:

Hrm, how do I find out what my login/password is? Very Happy Sure, I'll do the posts.


Your login/pass should be the same you use to access these forums.

Quote:

What other libraries usually do is have a setMouseFocux(int x, int y) function, where they can set which "pixel location" to set the mouse x, y to
(e.g. 0,0 is upper left)


OK. I'll work on it. Right now I'm adding a new feature for all my frames to be able to rotate around user set pivot points, instead of just the center Razz In addition, it will solve the 'setMouseFocus' problem.
Back to top
View user's profile Send private message AIM Address
Phr00t



Joined: 03 Mar 2006
Posts: 203

PostPosted: Thu Apr 06, 2006 4:57 pm    Post subject: Reply with quote

Quote:
Your login/pass should be the same you use to access these forums.


Aieet, sounds good.

Quote:
In addition, it will solve the 'setMouseFocus' problem.


Hrm... have to see how you do it. Remember that I might want to rotate an image from the bottom left, but draw it from the top right... which means you will need two sets of coordinates: drawing coordinate (to fix mouse focus issue) and then rotating center coordinates.

I want to use your linked list to handle my objects in space. Can you seperate the "description" and saving i/o from the linked list implementation? These two classes should be independent (e.g. I might want to use the linked list, but not your serialization functions) -- I'm not sure how you can keep the functionality (I tried to fix it up, but I don't know that much about D templates yet Sad ) -- Anyway, I don't want to have to implement my describe function for saving/loading to just use the linked list...

[ edit ] in your "time" documentation, in the sample program, you use some "Elapsed" class -- I assume this should be the "time" class? And your elapsedSec() and elapsedMili() docs... does it tell the time elapsed since the last call to this function, or since program start? I'm heading to bed in 2 seconds, I'd fix this myself otherwise Very Happy
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Thu Apr 06, 2006 10:12 pm    Post subject: Reply with quote

Quote:

Hrm... have to see how you do it. Remember that I might want to rotate an image from the bottom left, but draw it from the top right... which means you will need two sets of coordinates: drawing coordinate (to fix mouse focus issue) and then rotating center coordinates.


What I'm doing right now is a feature to set a rotation pivot point so the image can rotate around any position on itself or somewhere else, you could do 'orbit' like effects with it, having an moon circle earth circle sun etc. The point you set to rotate will determine how the image is drawn.

Once it is done i'll just send you a little demo, as I'm not 100? sure what you mean by rotate at bottom left but draw from top right *confused*


Quote:

I want to use your linked list to handle my objects in space. Can you seperate the "description" and saving i/o from the linked list implementation? These two classes should be independent (e.g. I might want to use the linked list, but not your serialization functions) -- I'm not sure how you can keep the functionality (I tried to fix it up, but I don't know that much about D templates yet Sad ) -- Anyway, I don't want to have to implement my describe function for saving/loading to just use the linked list...


The only way I can think of solving this is using version statements to turn features off. Such as -version=no_serializer .

Quote:

[ edit ] in your "time" documentation, in the sample program, you use some "Elapsed" class -- I assume this should be the "time" class? And your elapsedSec() and elapsedMili() docs... does it tell the time elapsed since the last call to this function, or since program start? I'm heading to bed in 2 seconds, I'd fix this myself otherwise Very Happy


The elapsedSec and elapsedMili gives the elapsed time since the last frame, assuming you call process every frame.
Back to top
View user's profile Send private message AIM Address
Phr00t



Joined: 03 Mar 2006
Posts: 203

PostPosted: Fri Apr 07, 2006 8:08 am    Post subject: Reply with quote

Quote:
Once it is done i'll just send you a little demo, as I'm not 100? sure what you mean by rotate at bottom left but draw from top right *confused*


I understand how your rotation pivot point functionality will work... but I'm confused on how this will solve the setMouseFocus issue. If the mouse's coordinates where X, Y -- but I wanted this X,Y to be set in the center of the mouse icon (e.g. crosshairs), I would want my focus set to the center of the image. If I wanted the upper left to be the where the mouse coordinates are (e.g. standard mouse pointer), I'd have the mouse focus set to 0,0. I guess this can be solved by simply offsetting the "draw" of the frame's X, Y coordinate. For example, when you set the coordinate of the frame, you could say mouse_frame.setPosition( mouse_x - 5, mouse_y - 5), equivelant to having your mouse focus be at (5,5)

Quote:
The only way I can think of solving this is using version statements to turn features off. Such as -version=no_serializer .


Hrm... OK... that might have to be the solution, I'll see if I can come up with any more solutions.

Quote:
The elapsedSec and elapsedMili gives the elapsed time since the last frame, assuming you call process every frame.


OK -- should be added/fixed in the documentation.
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Fri Apr 07, 2006 4:26 pm    Post subject: Reply with quote

Quote:

I understand how your rotation pivot point functionality will work... but I'm confused on how this will solve the setMouseFocus issue.

If the mouse's coordinates where X, Y -- but I wanted this X,Y to be set in the center of the mouse icon (e.g. crosshairs), I would want my focus set to the center of the image. If I wanted the upper left to be the where the mouse coordinates are (e.g. standard mouse pointer), I'd have the mouse focus set to 0,0. I guess this can be solved by simply offsetting the "draw" of the frame's X, Y coordinate. For example, when you set the coordinate of the frame, you could say mouse_frame.setPosition( mouse_x - 5, mouse_y - 5), equivelant to having your mouse focus be at (5,5)


The default pivot point of 0,0 will rotate around the images center, as I'm assuming most people just want to rotate around the center of an image.

If you want to draw the mouse from the top left, you'd just do
setPivot(-halfWidth, -halfHeight); As long as you don't rotate it, the image will be drawn from the top left. This is an overly complicated way of doing the same thing you with with a setPosition function with offset coords, but it is what came to my head and I decided to pursue it, even though I probably won't use it for the mouse anyway.

For the mouse I am thinking of adding a 'drawImage' primitive and combine it with x and y offsets to get the mouse drawn at different positions.

Even if I won't use the pivot point feature for the mouse, I still think it is very necessary to have. I already have devised a way to do pivots, and now I'm testing all the collision code to make sure none of it is broken and fixing it when it is. For example, today I rewrote my square --> pixel collision code as the previous attempt wasn't well documented or understandable in anyway. So, I wouldn't advise trying to do collisions until I am completely done with the setPivot code, which should be anytime soon now.

Quote:

Quote:
The elapsedSec and elapsedMili gives the elapsed time since the last frame, assuming you call process every frame.


OK -- should be added/fixed in the documentation.


The change will be there next time I upload the docs. If I have time tonight I'll try and fix up the docs and upload the results, but I might be busy.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> ArcLib All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group