Delphi-PRAXiS
Seite 92 von 103   « Erste     4282909192 9394102     Letzte »    

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Software-Projekte der Mitglieder (https://www.delphipraxis.net/26-software-projekte-der-mitglieder/)
-   -   Andorra 2D [Ver. 0.4.5.1, 31.12.08] (https://www.delphipraxis.net/81314-andorra-2d-%5Bver-0-4-5-1-31-12-08%5D.html)

3_of_8 18. Jan 2009 11:59

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Kein Problem. Jetzt sind eh nur noch drei übrig, mal schauen, wann ich die angreife.

Romi 18. Jan 2009 22:14

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Zitat:

Zitat von 3_of_8
Kein Problem. Jetzt sind eh nur noch drei übrig, mal schauen, wann ich die angreife.

Ich hatte die letzten Wochen viel zu tun, deshalb dauerts etwas, aber Particle ist bei mir halb fertig. Nur das du damit nicht anfängst ;)

Codewalker 21. Jan 2009 15:36

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Ich hätte noch eine Anregung/Bitte: Könnte man jedem Item in der TAdImageList noch ein String-Feld hinzufügen, dass man zur freien Verwendung nutzen kann und per AdImgEdit auch mit Text belegen kann? Hintergrund: Ich würde gerne Bilder in der Liste mit Tags/Kategorien versehen. Wäre so etwas möglich oder habt ihr eine alternative Idee? (Der Name des Bildes kommt nicht in Frage, soll schon ein anderes Feld sein)

xZise 21. Jan 2009 16:42

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Naja du könnest gucken, ob du vielleicht an den Bilddaten noch Informationen dranhängen kannst?

MfG
xZise

Florian H 23. Jan 2009 17:55

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Gibts eigentlich irgendwo eine Demo oder ein Tut bezüglich "Lights"?
Würde mir das gerne mal anschauen, aber das ganze rein über die Doku zu machen ist sehr anstrengend und oft von Misserfolg gekrönt ...

igel457 23. Jan 2009 18:12

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Hallo,

"Lights" sind eigentlich nur am besten für 3D-Modelle geeignet. Schau dir mal die "Simple3D"-Demo an, dort verwende ich ein Lichtobjekt.

Für reine 2D-Anwendungen würde ich (wie in der Bounce-Demo) einen Lichtkreis additiv auf die Szene zeichnen.

Edit:
@Codewalker: Ich habe vor irgendwann das ImageList-Dateiformat auf etwas dynamischeres Abzuändern, ich hatte da an etwas XML-Basiertes mit Binärdatenteil gedacht. Aber vorerst möchte ich noch nichts daran ändern.

@FlorianH: Wegen deinem Problem mit den Surfaces: Eine (suboptimale) Lösung ist, den Hintergrund nicht in der GPU zu rendern, sondern das ganze in die CPU auszulagern. "TAdBitmap"s kannst du mit TAdBitmap.DrawBitmap aufeinanderzeichnen. Dabei musst du ja nur die veränderten Farbkleckse zeichnen. Woran das Problem mit dem DirectX-FBO liegt, habe ich bis jetzt noch keine Ahnung - bei mir (Radeon 9800/ HD 4650) funktioniert es ja.

igel457 28. Jan 2009 22:16

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Hallo,

gerade habe ich in Andorra 2D die Möglichkeit zum Laden von 3D-Modellen eingebaut. Wie alles andere auch, findet das Laden in modularer Weise statt. So können Loader für die verschiedenen Modelformate einfach durch hinzufügen zur Uses-Klausel eingebunden werden (so mache ich das ja auch schon bei den Bildformaten.)

Momentan arbeite ich an einem Loader für 3DS (Danke hierbei an Noeska, dessen Bibliothek "glModel" ich hierbei teilweise als Referenz für das 3DS Dateiformat missbrauche). Die entsprechende Unit gibt es hier zum Anschauen: http://andorra.cvs.sourceforge.net/v...as?view=markup

Aktuell lade ich weder Texturen/-koordinaten noch Materialien aus der 3DS-Datei, doch das kommt in den nächsten Tagen noch.

Weitere Formate, die ich unterstützen möchte sind .X und .OBJ

Außerdem habe ich einen "Maskottchen Wettbewerb" gestartet, bei dem ich ein 3D-Maskottchen für die Verwendung in den 3D-Demos von Andorra 2D suche.
Siehe: http://www.delphipraxis.net/internal...t.php?t=151171

Kommentare sind wie immer erwünscht, ;-)
Andreas

Codewalker 29. Jan 2009 10:54

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Supi, dann kann ich in meinem Spiel vielleicht das Würfeln tatsächlich mit fallenden Würfeln darstellen (wobei man ja dann noch die Newton-Physics für Modelle oder Boxen bräuchte. Planst du das zufällig auch?).

Wann gibt es denn von dir den nächsten zusammengepackten Release?

3_of_8 29. Jan 2009 15:46

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Es gibt ein altes Projekt von mir, in dem Loader für MD2 und MS3D sowie Anbindungen an Newton enthalten sind - wenn ich mal viel Zeit habe, kann ich schauen, in wie weit ich das in Andorra integrieren kann.

3_of_8 27. Mär 2009 22:27

Re: Andorra 2D [Ver. 0.4.5.1, 31.12.08]
 
Another wee translation for ye. ;)

(Es heißt im Übrigen "das Partikel", nicht "der Partikel". "die Partikel (sing.)" gibt es auch, aber damit ist ein Wort gemeint, das nicht gebeugt wird)

Zitat:

Andorra 2D tutorials
Particle systems


What are particle systems?
You want to use graphical effects such as explosions or magic spells many times in your game.
To do this, so-called "particle systems" are often used. As the name suggests, particle systems consist of single "particles", which in turn are mostly rather unspectacularly looking images that move in a certain direction and disappear again after some time:
http://andorra.sourceforge.net/tutots/particle.png
If you have several of these particles, you get this effect:
http://andorra.sourceforge.net/tutots/part1.png
The particle system manages the particles and their movements.

Particle systems Andorra 2D

Loading particles
In Andorra 2D, there is the class "TAdParticleSystem" in the unit "AdParticles".
The class expects a parameter of the type "TAdDraw" in its constructor specifying the surface which the output should be displayed on.
To create particles, you have to assign the particle's image first.
This is done by the following code:
Delphi-Quellcode:
//Creating the particle system
partsys := TAdParticleSystem.Create(AdDraw);
//Assigning the image
partsys.Texture := AdImageList.Items[0].Texture;
To achieve the best effect, make sure the particle has an alpha channel. Use this image, for example. (Note that in order to load PNG images you have to include the AdPNG unit and the library PNGDelphi has to be in the search path, if needed).

Now we're already done. Add the following line to your rendering routine:
Delphi-Quellcode:
partsys.Emit(1, 0, 0);
This line adds a new particle to the particle system at the position 0,0. The particle system has its own coordinate system in which the particles move. We create our new particle at the origin of ordinates.

Now we have to tell the particle systems to move its particles and draw them. This is done by the following lines:
Delphi-Quellcode:
PartSys.Move(AdPerCounter.TimeGap / 1000);
partsys.Draw(bmAdd, AdDraw.DisplayRect.Right / 2, AdDraw.DisplayRect.Bottom / 2);
The coordinate system's point of origin is temporarily moved to the centre point of the screen, so that new particles also appear there.
Do not forget to also free the particle system in the end and execute the programme:
http://andorra.sourceforge.net/tutots/part3.png

If you want to have the source code, take a look at the demo "demos\Particles\Simple\simplepart". Or take a look at this: http://andorra.cvs.sourceforge.net/a...iew=markup#l_1

The behaviour of particles
As you have seen, the particles have a default behaviour. But where does it come from?
To find that out, we take a look at how the "emit" function of the particle system works in detail:
http://andorra.sourceforge.net/tutots/creation.png
In the beginning, the specified amount of particles is created, which inherit their properties from the particle system's "default particle". Then the fuction "SetupMovement" of each particle is called, in which a movement vector is generated.
To change the overall appearance of the particle system, you only have to adjust the properties of the default particle. To adjust the life time of the particles, for example, write the following:
Delphi-Quellcode:
PartSys.DefaultParticle.LifeTime := 2; //Specified in seconds
You can adjust the particles' properties with the comfortable particle editor (parted.exe). Just play around with it a bit. You can also write the particles into a file with it and load them again with:
Delphi-Quellcode:
PartSys.DefaultParticle.LoadFromFile('particle.apf');
Note that the image you have loaded into the particle editor is not saved into the file.

That was virtually everything there is to say about particles.

Custom particle classes
If you want to create particles with a chaotic movement pattern, you can derive your own particle class, which you can pass on to the particle system by assigning the default particle. Take a look at the source code of TAdStdParticle or TAdBillboardParticle respectively. It's the easiest way to derive your own particle class from those.

Particles in the sprite engine
The class "TParticleSprite" exists to use particle systems in the sprite engine. It has its own particle system. You can also tell it how many particles to create per second. This, however, is a chapter on its own and will be covered separately in the sprite engine tutorials.

Copyright and licence
(c) by Andreas Stöckel February 2007
Translation by 3_of_8 (Manuel Eberl)

The content of this tutorial is subject to the GNU Licence for Free Documentation.


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:13 Uhr.
Seite 92 von 103   « Erste     4282909192 9394102     Letzte »    

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz