Autor Beitrag
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Do 29.07.04 16:17 
Hallo,
ich möchte gerne eine 2D landschaft mit DelphiX erstellen.
sie soll z.b. so aussehen:
du hast berege, täler und soweiter und sofort
und in den beren ist dann z.b. eine Goldtextur am besten ich poste mal ein bild wie ich mir es vorstelle(habe aber keiner ananung wie man es machen könnte)
www.clonk.de/contents_de.html dann unter Clonk Endeavour gehen *G*

wie könnte ich sowas hinbekommen ?
hat wer schonmal sowas gemacht ?
gibst tutors dafür (in deutsch)?

man soll die höhe und tiefen der berge und die anzahl einstellen können...

_________________
MFG
Michael Springwald, "kann kein englisch...."
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: So 08.08.04 12:44 
Hey cool!!! Du spielst Clonk?! Is ja krass!! Kannst du das auch so richtig gut?

Aber jetzt zu deinem Problem:

Wozu brauchst du das eigentlich?

_________________
Linux und OpenSource rulez!
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 08.08.04 13:56 
ich habe führer clonk gespielt... so schlecht ist das aber garnicht *G*
du hast eine scrip sprache die c änlich ist. die ich aber nie verstanden habe und im laufe der zeit ist clonk auch langweilig geworden. naja, ich wollte es einfach mal irgenwan nach machen schließlich stecken in so ein projekt eine menge problme die man zu lösen hat drin.#

- Landschaften erstellen/bearbeiten
- Objekte in und unter der Landschaft erstellen
- bewegung von einzelen "Clonks"
- collisions abfrage
- Objekte verwaltung

_________________
MFG
Michael Springwald, "kann kein englisch...."
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: So 15.08.04 14:00 
Falls du ein bisschen mehr Ahnung von C++ hast, dann kannst du dir den original Clonk Source-Code anschauen, den gibs auf der Webseite zum Donwload. Wenn nicht, dann könnt ich mal sehn, ob ich dafür mal Zeit finde.

_________________
Linux und OpenSource rulez!
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 15.08.04 14:02 
leider kann ich kein c++ sonst hätte ich es gemacht, kannst du in nicht übersetzten ?
bzw. die teile die für die landschaft erstellung wichtig sind ?

_________________
MFG
Michael Springwald, "kann kein englisch...."
umpani
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 389



BeitragVerfasst: So 15.08.04 14:55 
Hallo Mimi,

ich bin ein wenig überrascht, dass du jetzt jmd. bittest, Dir einen C-Code zu übersetzen.

Wir haben Dir doch in diesem www.delphi-forum.de/topic_17851.html
Artikel genügend Ansätze gegeben, mir denen Du bestimmt weitermachen kannst und auch eine ordendliche Landschaft generierst.

Ich habe das gefühl, dass Du den gesamten Quellcode für Deine Spiele geliefert bekommen willst. Das wirst Du hier jedoch nicht erreichen. Wenn Dir Ansätze, die man Dir gibt zu kompliziert sind, dass mußt Du leichtere Programmie entwickeln.

Ich bin gerne bereit, dir Hilfestellungen zu geben, aber nicht, dir einen kompletten Quellcode zu servieren.


Gruß Umpani

_________________
Lernen, ohne zu denken, ist eitel; denken, ohne zu lernen, ist gefährlich. Konfuzius
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 15.08.04 17:26 
das nicht, nur ich kann mir noch nicht so richtig vorstellen wie das funktoniert, trotz dein gutes beispiel.
naja, ich glaube ich werde mich damit erstmal später weiter beschäfdigen !!!!

_________________
MFG
Michael Springwald, "kann kein englisch...."
Lhid
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 831



BeitragVerfasst: So 15.08.04 17:56 
Meinung und mich grundlegend geändert-> alte beiträge gelöscht


Zuletzt bearbeitet von Lhid am Sa 26.09.09 13:06, insgesamt 1-mal bearbeitet
MathiasH
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 699

WinXP, Win98SE, Debian, Win95
D5 Stand, D6 Prof
BeitragVerfasst: Di 17.08.04 18:52 
wie wärs wenn du einfach einen Punkt nimmst und um diesen Punkt einen Kreis machst. die einzige Veränderung: du variierst den radius. Durch diesen einfachen Trick kann man bereits recht komplexe Muster erzeugen

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
const
DOT_COUNT=16

var
angle: integer;
points: array[0..DOT_COUNT-1, 0..1] of real;

for angle := 0 to DOT_COUNT-1 do begin
  x := cos(a/DOT_COUNT*2*pi)*Random;
  y := sin(a/DOT_COUNT*2*pi)*Random;
end;


wenn du darüber dann noch irgendein Raster legst, damit es bisserl aussieht wie in Clonk müsste man damit schon recht ansehnliche Ergebnisse erzielen können. Das ganze liefert dir ja ein array von Punkten, die ein Polygon definieren, dessen Inhalt das die zufällige fläche ist. natürlich musste du das ganze noch entsprechend skalieren und positionieren

PS.: mimi ich bin enttäuscht, immernoch DelphiX, ich glaub das nimmst du irgendwann mal mit ins Grab. Vermutlich ist DelphiX einer solchen Landschaft garnicht gewachsen.... :wink:

_________________
"Viel von sich reden, kann auch ein Mittel sein, sich zu verbergen."
Friedrich Nietzsche
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: Sa 21.08.04 13:51 
Hi mimi!

Warum hältst du dich nicht einfach an die Tutorials und generierst dann im Untergrund zufällige Vielecke. Falls du den Clonk-Code unbedingt brauchst musst du 2-3 Wochen warten, denn mein Terminkalender ist z.Z. sehr voll.

Aber eigentlich müsste die Idee von MathiasH auch passable Ergebnisse liefern.

_________________
Linux und OpenSource rulez!
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: So 22.08.04 15:38 
Hab heute mal 5 min Zeit gefunden und das hier fabriziert:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    PaintBox1: TPaintBox;
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  VPX1,VPY1,VPX2,VPY2:Integer;

implementation

{$R *.dfm}

procedure DLSPixA(x,y:Integer;Color:Byte);
begin
   Form1.PaintBox1.Canvas.Pixels[x,y]:=clBlack;
end;

function DLGPixA(x,y:Integer):Byte;
begin
   if Form1.PaintBox1.Canvas.Pixels[x,y]<>clWhite then result:=1 else result:=0;
end;

procedure Swap(var int1,int2:Integer);
var temp:Integer;
begin
   temp:=int2;
   int2:=int1;
   int1:=temp;
end;

function Inside(ival,lbound,rbound:LongInt):Byte;
begin
   if (ival>=lbound) and (ival<=rbound) then result:=1 else result:=0;
end;

procedure DLSPixF(pxx,pxy:Integer;pxc:Byte);
begin
  if (Inside(pxx,VPX1,VPX2)>0) and (Inside(pxy,VPY1,VPY2)>0) then DLSPixA(pxx,pxy,pxc);
end;

procedure DLLineF(x1,y1,x2,y2:Integer;color:Byte);
var d,dx,dy,aincr,bincr,xincr,yincr,x,y:Integer;
begin
   if Abs(x2-x1)<Abs(y2-y1) then
   begin
      if y1>y2 then
      begin
         Swap(x1,x2);
         Swap(y1,y2);
      end;
      if x2>x1 then xincr:=1 else xincr:=-1;
      dy:=y2-y1;
      dx:=Abs(x2-x1);
      d:=2*dx-dy;
      aincr:=2*(dx-dy);
      bincr:=2*dx;
      x:=x1;
      y:=y1;
      DLSPixF(x,y,color);
      for y:=y1+1 to y2 do
      begin
         if d>=0 then
         begin
            x:=x+xincr;
            d:=d+aincr;
         end
         else
         begin
            d:=d+bincr;
         end;
         DLSPixF(x,y,color);
      end;
   end
   else
   begin
      if x1>x2 then
      begin
         Swap(x1,x2);
         Swap(y1,y2);
      end;
      if y2>y1 then yincr:=1 else yincr:=-1;
      dx:=x2-x1;
      dy:=Abs(y2-y1);
      d:=2*dy-dx;
      aincr:=2*(dy-dx);
      bincr:=2*dy;
      x:=x1;
      y:=y1;
      DLSPixF(x,y,color);
      for x:=x1+1 to x2 do
      begin
         if d>=0 then
         begin
            y:=y+yincr;
            d:=d+aincr;
         end
         else
         begin
            d:=d+bincr;
         end;
         DLSPixF(x,y,color);
      end;
   end;
end;

procedure DrawGroundBack(var cash1:Integer;cash2:Integer);
var
  cnt,cnt2:Integer;
  chgt,nhgt:Real;
  tend:Integer;
begin
   chgt:=random(100)+30;
   tend:=random(30);
   DLLineF(0,Round(chgt+20),19,Round(chgt+20),128);
   cash1:=Round(chgt);
   for cnt:=0 to 279 do
   begin
      tend:=tend+random(10)-4;
      if chgt<40 then tend:=tend+3;
      if chgt>120 then tend:=tend-3;
      if tend<0 then tend:=0;
      if tend>29 then tend:=29;
      nhgt:=chgt+(tend/10.0)-1.9;
      if nhgt<30 then nhgt:=30;
      if nhgt>129 then nhgt:=129;
      DLLineF(cnt+20,Round(chgt+20),cnt+21,Round(nhgt+20),128);
      chgt:=nhgt;
   end;
   DLLineF(300,Round(chgt+20),319,Round(chgt+20),128);
   cash2:=Round(chgt);
   for cnt:=0 to 319 do
   begin
      cnt2:=179;
      while not(DLGPixA(cnt,cnt2)=1) do
      begin
         DLSPixA(cnt,cnt2,random(4)+129);
         cnt2:=cnt2-1;
      end;
   end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
   VPX1:=0;
   VPY1:=0;
   VPX2:=PaintBox1.Width;
   VPY2:=PaintBox1.Height;
   randomize;
end;

procedure TForm1.Button1Click(Sender: TObject);
var c1,c2:Integer;
begin
   PaintBox1.Canvas.Brush.Color:=clWhite;
   PaintBox1.Canvas.Pen.Color:=clWhite;
   PaintBox1.Canvas.FillRect(Rect(0,0,PaintBox1.Width,PaintBox1.Height));
   DrawGroundBack(c1,c2);
end;

end.


Das ist der Landschaftsgenerator aus Clonk 1(!). Er läuft auf einem Form mit einer PaintBox und einem Button.

Viel Spaß!

_________________
Linux und OpenSource rulez!
umpani
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 389



BeitragVerfasst: So 22.08.04 15:48 
Das ist ja im prinzip auch nichts anderes, als dass was wir mimi schon geliefert haben.

www.delphi-forum.de/...der=asc&start=20

Mimi möchte jedoch eine Unit haben, welche den ganzen Hintergrund für ihn zeichnet (mit allen Objekten etc.).

Aber das muß er nun mal selbst entwickeln und kann hier nur hilfe bei einzelnen Programmierproblemen erwarten aber nicht eine fertige Unit.

Gruß benno

_________________
Lernen, ohne zu denken, ist eitel; denken, ohne zu lernen, ist gefährlich. Konfuzius
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Mo 23.08.04 17:48 
ich wollte ja auch nur einen anhaltzunkt haben und nicht gleich eine fertig unit(währe natürlich auch schön), aber mal sehen, evtl. mache ich das später mal !!!

_________________
MFG
Michael Springwald, "kann kein englisch...."
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: Sa 28.08.04 12:55 
Das es so ähnlich ist wie das was vorher schon angesprochen wurde liegt daran, dass es aus Clonk 1 portiert wurde. Damals gab es noch keine abbaubaren Bodenschätze.

_________________
Linux und OpenSource rulez!
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Sa 28.08.04 21:09 
ich glaube diese version von clonk konnte ich bzw. ein nachbar von mir mal komplieren sicher bin ich mir da aber nicht !!! vielen dank !

_________________
MFG
Michael Springwald, "kann kein englisch...."
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: So 29.08.04 12:46 
Ich werde mir mal noch den Code aus Clonk 3 reinziehen, aber das wird warscheinlich erst nächste Woche was.

_________________
Linux und OpenSource rulez!
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 29.08.04 13:12 
wie währes mit dem code von der GWE ???? *G*

_________________
MFG
Michael Springwald, "kann kein englisch...."
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: So 29.08.04 13:28 
So lange ist meine Weile auch nicht. Hast du dir Clonk 3 schon mal angeguckt? Falls dir das nicht reicht, kann ich auch mal in Clonk 4 reinschaun.

_________________
Linux und OpenSource rulez!
mimi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 17.10.04 08:37 
clonk4 währe nicht schlecht(am besten währe GWE)

_________________
MFG
Michael Springwald, "kann kein englisch...."