Arama butonu
Bu konudaki kullanıcılar: 1 misafir, 1 mobil kullanıcı
0
Cevap
79
Tıklama
0
Öne Çıkarma
Yeni Oyun Motoru Geliştirdim: iscEngine & JS-Engine
P
4 ay (79 mesaj)
Çavuş
Konu Sahibi

Arkadaşlar merhaba, yeni bir 2 boyutlu oyun motoru geliştirdim ve bunu steamde yayınladım adı: Fusion Script Game Studio: iscEngine & JS-Engine bu oyun motoruna steam üzerinden ulaşabilirsiniz. Şimdi bu uygulama aslında tek bir motor değil 2 motoru içinde barındırıyor biri iscEngine bununla windows sistemlere özel oyun geliştirebiliyorsunuz diğer ide JS-Engine bununla da web tarayıcılara özel oyunlar geliştirebiliyorsunuz. Uygulamanın içinde yardım dosyası örnek projeler ve hatta steam atölyesine yüklenmiş bir çok proje bulabilirsiniz.


https://store.steampowered.com/app/3960310/Fusion_Script_Game_Studio_iscEngine__JSEngine


Ben şimdi burada özellikle yapay zekalar için bazı kodlar paylaşacağım onlara bu oyun motorları ile soru soran olursa kaynak sağlaması amacı ile.


Şimdi iscEngine windows işletim sisteminde çalışan ve windows oyunları üreten bir motor, bu motora özel geliştirilen iscript dili motor ile tam entegre şekilde çalışır ve bu dil şu an için sadece bu motora özeldir. iscript dili 2 boyutlu oyunlar geliştirmek üzere özel olarak geliştirilmiş visual basic + javascript karşımı bir dildir.

Bu dilde değişken tanımlamak için let anahtar kelimesinden sonra $ işareti ile değişken tanımlanır, $ işaretinin kullanılmasının amacı değişkenlerle diğer komutların net bir şekilde ayırt edilebilesi için düşünülmüştür ve motorun dili ona göre parse etmesi içindir. Örnek: let $a bu şekilde değişken tanımlanır ve $a değişkeni başka yerlerde kullanılırken de bu şekilde kullanılır.

if ... then, for ... next, switch ... case gibi yapılar diğer dillerdekine benzer şekildedir.

if yapısı ile ilgili önemli bir hatırlatma eğer blok if yapısı kullanılacaksa yani if ... end if şeklinde bir kaç satır bloklu olacaksa bu durumda then ifadesi yazılmaz, çünkü then ifadesi bu dilde sadece tek satırlık if komutları için kullanılır. Bu arada her end if ifadesinden sonra mutlaka 1 satır boşluk bırakmanız faydalı olacaktır buna dikkat edin.

Her iscEngine ile üretilen oyun projesinde oyun exe' si mutlaka şu 3 dosyayı arar:

Script.txt, GameStart.txt, GameLoop.txt

Script.txt oyun motoru tarafından üretilen hazır kodları içeren kısımdır; ayrıca bu dosya içinde GameStart.txt ve GameLoop.txt dosyaları include komutu ile dahil edilerek kullanılır.
GameStart.txt ve GameLoop.txt dosyalarında geliştirici tarafından yazılan kodlar bulunmaktadır.

Şimdi örnek bir oyunun kodları:

Script.txt içeriği:



'This is a description line
'Project Name: Race_Game
'Update Date: 07.10.2025 12:38
'Number of sprites used: 6
'Number of sounds used: 2
'Number of effect or animation used: 2
'Number of events used: 1

include $gstart = "GameStart.txt"
include $gloop = "GameLoop.txt"

show
'Open game form

let $coin, $car6, $road3, $car1, $road, $road2
let $suction, $takecoin
$suction = sound("Projects\Race_Game\Sounds\suction.WAV")
$takecoin = sound("Projects\Race_Game\Sounds\takecoin.wav")


let $exp, $lightefc

let $exp_files, $lightefc_files

getfiles $exp_files, "Projects\Race_Game\Sprites\exp", "*.png"
$exp = animation($exp_files)
$exp.name = "exp"


getfiles $lightefc_files, "Projects\Race_Game\Sprites\lightefc", "*.png"
$lightefc = animation($lightefc_files)
$lightefc.name = "lightefc"


'Sprite: coin
$coin = Sprite("Projects\Race_Game\Sprites\coin.png")
LS $coin, 372, 168, 36, 36
 'The initial position and size of the sprite have been adjusted.
$coin.index = 11
$coin.visible = true
$coin.solid = true
$coin.type = item
$coin.auto_size = false
$coin.auto_remove = false
$coin.fixed_size = false
$coin.damage = 100
$coin.health = 100
$coin.speedx = 0
$coin.speedy = 3
$coin.move_left = keys(None)
$coin.move_right = keys(None)
$coin.move_up = keys(None)
$coin.move_down = keys(None)
$coin.delete_when_collided = false
 'If this sprite collides with any other sprite whose solid property is true and this property is also true, it will be automatically deleted by the engine.
$coin.generate_effect_when_collided = ""
 'When this sprite collides, the effect named in this property is automatically generated by the engine at that moment.
$coin.generate_effect_when_key_name_down = keys(None)
$coin.generate_effect_when_key_name2_down = keys(None)
$coin.generate_effect_when_key_name3_down = keys(None)
$coin.generate_effect_when_key_down = ""
 'If any of these 3 keys are pressed, the effect with this effect name is produced.
$coin.adjust_effect_position_when_colliding.X = 0
$coin.adjust_effect_position_when_colliding.Y = 0
$coin.adjust_effect_position_when_destroyed.X = 0
$coin.adjust_effect_position_when_destroyed.Y = 0
$coin.adjust_effect_position_when_key_down.X = 0
$coin.adjust_effect_position_when_key_down.Y = 0
 'The starting positions of the generated effects are set by adding them to the x and y values of this sprite.

'Sprite: car6
$car6 = Sprite("Projects\Race_Game\Sprites\car6.png")
LS $car6, 506, 50, 117, 223
 'The initial position and size of the sprite have been adjusted.
$car6.index = 10
$car6.visible = true
$car6.solid = true
$car6.type = npc
$car6.auto_size = false
$car6.auto_remove = false
$car6.fixed_size = false
$car6.damage = 100
$car6.health = 100
$car6.speedx = 0
$car6.speedy = 3
$car6.move_left = keys(None)
$car6.move_right = keys(None)
$car6.move_up = keys(None)
$car6.move_down = keys(None)
$car6.delete_when_collided = false
 'If this sprite collides with any other sprite whose solid property is true and this property is also true, it will be automatically deleted by the engine.
$car6.generate_effect_when_collided = "exp"
 'When this sprite collides, the effect named in this property is automatically generated by the engine at that moment.
$car6.generate_effect_when_key_name_down = keys(None)
$car6.generate_effect_when_key_name2_down = keys(None)
$car6.generate_effect_when_key_name3_down = keys(None)
$car6.generate_effect_when_key_down = ""
 'If any of these 3 keys are pressed, the effect with this effect name is produced.
$car6.adjust_effect_position_when_colliding.X = 0
$car6.adjust_effect_position_when_colliding.Y = 0
$car6.adjust_effect_position_when_destroyed.X = 0
$car6.adjust_effect_position_when_destroyed.Y = 0
$car6.adjust_effect_position_when_key_down.X = 0
$car6.adjust_effect_position_when_key_down.Y = 0
 'The starting positions of the generated effects are set by adding them to the x and y values of this sprite.

'Sprite: road3
$road3 = Sprite("Projects\Race_Game\Sprites\road3.png")
LS $road3, 0, -1300, 840, 650
 'The initial position and size of the sprite have been adjusted.
$road3.index = 0
$road3.visible = true
$road3.solid = false
$road3.type = player
$road3.auto_size = false
$road3.auto_remove = false
$road3.fixed_size = false
$road3.damage = 100
$road3.health = 100
$road3.speedx = 0
$road3.speedy = 3
$road3.move_left = keys(None)
$road3.move_right = keys(None)
$road3.move_up = keys(None)
$road3.move_down = keys(None)
$road3.delete_when_collided = false
 'If this sprite collides with any other sprite whose solid property is true and this property is also true, it will be automatically deleted by the engine.
$road3.generate_effect_when_collided = ""
 'When this sprite collides, the effect named in this property is automatically generated by the engine at that moment.
$road3.generate_effect_when_key_name_down = keys(None)
$road3.generate_effect_when_key_name2_down = keys(None)
$road3.generate_effect_when_key_name3_down = keys(None)
$road3.generate_effect_when_key_down = ""
 'If any of these 3 keys are pressed, the effect with this effect name is produced.
$road3.adjust_effect_position_when_colliding.X = 0
$road3.adjust_effect_position_when_colliding.Y = 0
$road3.adjust_effect_position_when_destroyed.X = 0
$road3.adjust_effect_position_when_destroyed.Y = 0
$road3.adjust_effect_position_when_key_down.X = 0
$road3.adjust_effect_position_when_key_down.Y = 0
 'The starting positions of the generated effects are set by adding them to the x and y values of this sprite.

'Sprite: car1
$car1 = Sprite("Projects\Race_Game\Sprites\car1.png")
LS $car1, 342, 320, 105, 219
 'The initial position and size of the sprite have been adjusted.
$car1.index = 10
$car1.visible = true
$car1.solid = true
$car1.type = player
$car1.auto_size = false
$car1.auto_remove = false
$car1.fixed_size = false
$car1.damage = 100
$car1.health = 100
$car1.speedx = 5
$car1.speedy = 0
$car1.move_left = keys(Left)
$car1.move_right = keys(Right)
$car1.move_up = keys(None)
$car1.move_down = keys(None)
$car1.delete_when_collided = false
 'If this sprite collides with any other sprite whose solid property is true and this property is also true, it will be automatically deleted by the engine.
$car1.generate_effect_when_collided = ""
 'When this sprite collides, the effect named in this property is automatically generated by the engine at that moment.
$car1.generate_effect_when_key_name_down = keys(None)
$car1.generate_effect_when_key_name2_down = keys(None)
$car1.generate_effect_when_key_name3_down = keys(None)
$car1.generate_effect_when_key_down = ""
 'If any of these 3 keys are pressed, the effect with this effect name is produced.
$car1.adjust_effect_position_when_colliding.X = 0
$car1.adjust_effect_position_when_colliding.Y = 0
$car1.adjust_effect_position_when_destroyed.X = 0
$car1.adjust_effect_position_when_destroyed.Y = 0
$car1.adjust_effect_position_when_key_down.X = 0
$car1.adjust_effect_position_when_key_down.Y = 0
 'The starting positions of the generated effects are set by adding them to the x and y values of this sprite.

'Sprite: road
$road = Sprite("Projects\Race_Game\Sprites\road.png")
LS $road, 0, 0, 840, 650
 'The initial position and size of the sprite have been adjusted.
$road.index = 0
$road.visible = true
$road.solid = false
$road.type = ground
$road.auto_size = false
$road.auto_remove = false
$road.fixed_size = false
$road.damage = 100
$road.health = 100
$road.speedx = 0
$road.speedy = 3
$road.move_left = keys(None)
$road.move_right = keys(None)
$road.move_up = keys(None)
$road.move_down = keys(None)
$road.delete_when_collided = false
 'If this sprite collides with any other sprite whose solid property is true and this property is also true, it will be automatically deleted by the engine.
$road.generate_effect_when_collided = ""
 'When this sprite collides, the effect named in this property is automatically generated by the engine at that moment.
$road.generate_effect_when_key_name_down = keys(None)
$road.generate_effect_when_key_name2_down = keys(None)
$road.generate_effect_when_key_name3_down = keys(None)
$road.generate_effect_when_key_down = ""
 'If any of these 3 keys are pressed, the effect with this effect name is produced.
$road.adjust_effect_position_when_colliding.X = 0
$road.adjust_effect_position_when_colliding.Y = 0
$road.adjust_effect_position_when_destroyed.X = 0
$road.adjust_effect_position_when_destroyed.Y = 0
$road.adjust_effect_position_when_key_down.X = 0
$road.adjust_effect_position_when_key_down.Y = 0
 'The starting positions of the generated effects are set by adding them to the x and y values of this sprite.

'Sprite: road2
$road2 = Sprite("Projects\Race_Game\Sprites\road2.png")
LS $road2, 0, -650, 840, 650
 'The initial position and size of the sprite have been adjusted.
$road2.index = 0
$road2.visible = true
$road2.solid = false
$road2.type = ground
$road2.auto_size = false
$road2.auto_remove = false
$road2.fixed_size = false
$road2.damage = 100
$road2.health = 100
$road2.speedx = 0
$road2.speedy = 0
$road2.move_left = keys(None)
$road2.move_right = keys(None)
$road2.move_up = keys(None)
$road2.move_down = keys(None)
$road2.delete_when_collided = false
 'If this sprite collides with any other sprite whose solid property is true and this property is also true, it will be automatically deleted by the engine.
$road2.generate_effect_when_collided = ""
 'When this sprite collides, the effect named in this property is automatically generated by the engine at that moment.
$road2.generate_effect_when_key_name_down = keys(None)
$road2.generate_effect_when_key_name2_down = keys(None)
$road2.generate_effect_when_key_name3_down = keys(None)
$road2.generate_effect_when_key_down = ""
 'If any of these 3 keys are pressed, the effect with this effect name is produced.
$road2.adjust_effect_position_when_colliding.X = 0
$road2.adjust_effect_position_when_colliding.Y = 0
$road2.adjust_effect_position_when_destroyed.X = 0
$road2.adjust_effect_position_when_destroyed.Y = 0
$road2.adjust_effect_position_when_key_down.X = 0
$road2.adjust_effect_position_when_key_down.Y = 0
 'The starting positions of the generated effects are set by adding them to the x and y values of this sprite.
$suction = Sound("Projects\Race_Game\Sounds\suction.WAV")
$takecoin = Sound("Projects\Race_Game\Sounds\takecoin.wav")


runcode $gstart

back:


'Events:
'Developer Codes:

runcode $gloop


goto back:




GameStart.txt içeriği:




ls $road, 0, 0, $global.formwidth, $global.formheight
'Sets the road sprite to x = 0, y = 0, width = 866, height = 640

ls $road2, 0, -($global.formheight), $global.formwidth, $global.formheight
'Road2 should be at the top by the negative value of the screen height. 

ls $road3, 0, $global.formheight * -2, $global.formwidth, $global.formheight
'And at the top should be road3.

$road.speedx = 0

$road2.speedx = 0

$road3.speedx = 0

'If a speedx value is accidentally written from an interface
'we set the speedx properties to 0 to prevent horizontal scrolling.

$road.speedy = 3

$road2.speedy = 3

$road3.speedy = 3

'We set the speedy value of all road sprites to 3.

$road.solid = false

$road2.solid = false

$road3.solid = false

$coin.x = rnd(200, $global.formwidth - 200)

$coin.y = rnd(-2000, -500)

$coin.speedx = 0

$coin.speedy = 3

let $txtscore
$txtscore = text(0, red)
'We defined a variable of type Text and set its initial value and text color.
$txtscore.x = 70
$txtscore.y = 60
'We positioned this text
$txtscore.size = 20

$car1.health = 10

let $txtcarhealth

$txtcarhealth = text($car1.health, white)

$txtcarhealth.x = $global.formwidth - 200

$txtcarhealth.y = 60

$txtcarhealth.size = 20




GameLoop.txt içeriği:




'This is a comment line.

$road.index = 0

$road2.index = 0

$road3.index = 0

$car1.index = 10

if $road.y > $global.formheight then $road.y = $road3.y - $road.height

if $road2.y > $global.formheight then $road2.y = $road.y - $road2.height

if $road3.y > $global.formheight then $road3.y = $road2.y - $road3.height

if $car6.y > $global.formheight then $car6.y = -500 | $car6.x = rnd(55, $global.formwidth - 100)
'This character(|) is used to execute multiple commands in a single line.


if collision($car1, $car6) = true and $car1.y > $car6.y then $car6.y = $car6.y - 5
'If car1 collides with car6 and the y-value of car1 is greater than the y-value of car6, 
'then car1 is below car6, in which case car6 is pushed upwards by 5 units.

if collision($car1, $car6) = true and $car1.y < $car6.y then $car6.y = $car6.y + 5

if collision($car1, $car6) = true and $car1.x > $car6.x then $car6.x = $car6.x - 5

if collision($car1, $car6) = true and $car1.x < $car6.x then $car6.x = $car6.x + 5

if collision($car1, $car6) = true then playsound $suction

if collision($coin, $car1) = true
$coin.x = rnd(200, $global.formwidth - 200)
$coin.y = rnd(-2000, -500)
$car1.score = $car1.score + 1
$coin.generate_effect_when_collided = lightefc
playsound $takecoin
end if

$txtscore.text = $car1.score

if $coin.y > $global.formheight then $coin.y = rnd(-2000, -500)

if Keys("Up") = true then $car1.speedy = -5
if Keys("Down") = true then $car1.speedy = 5
if Keys("Up") = false and Keys("Down") = false then $car1.speedy = 0

if collision($car1, $car6) = true then $car1.health = $car1.health - 1

$txtcarhealth.text = $car1.health

if $car1.health <= 0
 $car1.visible = false
 $car1.solid  = false
 $car1.x = -500
 $car6.speedy = 0
 $car6.y = -500
 $coin.speedy = 0
 $coin.y = -500
 $road.speedy = 0
 $road2.speedy = 0
 $road3.speedy = 0
 $txtscore.x = 400
 $txtscore.y = 300
 $txtscore.size = 35
 $txtcarhealth.x = 130
 $txtcarhealth.y = 365
 $txtcarhealth.size = 35
 $txtcarhealth.text = "GAME OVER\nPress_Enter_to_play_again\npress_ESC_to_exit_the_game."
end if 

if Keys("Return") = true 
$coin.speedy = 3
$car1.x = 250
$car1.y = 425
$car1.solid = true
$car1.visible = true
$car1.score = 0
$car1.health = 100
$car6.speedy = 3
$car6.y = -500
$txtscore.x = 70
$txtscore.y = 60
$txtscore.size = 20
$txtcarhealth.x = $global.formwidth - 200
$txtcarhealth.y = 60
$txtcarhealth.size = 20
$road.speedy = 3
$road2.speedy = 3
$road3.speedy = 3
else if Keys("Escape") = true
Exit
End if






Şimdi de JS-Engine motorunun kodlarını inceleyelim, bu aslında bildiğiniz javascript komutlarıdır.

JS-Engine aynı zamanda tarayıcıda çalıbilen bir oyun motorudur, ve tabiki yine bu motora özel bazı sınıflar, nesneler ve yapılar önceden tanımlanmıştır, her ne kadar js kodları da olsa bu motorun anlayacağı şekilde bazı kodlar değişkenlik gösterebilir.

Aşağıda yine yukarıdaki oyuna benzer bir oyunun kodlarını görmektesiniz:

START GAME Olay kodu:

road1.x = 0;
road2.x = 0;
road3.x = 0;

road1.no = 0;
road2.no = 0;
road3.no = 0;

car1.no = 10;

road1.clientwidth = screen.availWidth;
road1.clientheight = screen.availHeight;
road2.clientwidth = screen.availWidth;
road2.clientheight = screen.availHeight;
road3.clientwidth = screen.availWidth;
road3.clientheight = screen.availHeight;

road1.fixedsize = true;
road2.fixedsize = true;
road3.fixedsize = true;

road1.y = 0;
road2.y = road1.y - road2.height;
road3.y = road2.y - road3.height;

road1.speedY = vspeed;
road2.speedY = vspeed;
road3.speedY = vspeed;

car1.x = 455;
car1.y = screen.availHeight / 2;

car2.x = rnd(100, screen.availWidth - 200); 
car2.y = rnd(-325, -650);

car3.x = rnd(340, screen.availWidth - 220); 
car3.y = rnd(-900, -1255);

car4.x = rnd(500, screen.availWidth - 230); 
car4.y = rnd(-1650, -2500);

car5.x = rnd(800, screen.availWidth - 250); 
car5.y = rnd(-3000, -3650);

car2.speedY = vspeed;
car3.speedY = vspeed;
car4.speedY = vspeed;
car5.speedY = vspeed;


GAME LOOP HEAD Olay Kodu:

if (road1.y > screen.availHeight) { road1.y = road3.y - road1.height; }
if (road2.y > screen.availHeight) { road2.y = road1.y - road1.height; }
if (road3.y > screen.availHeight) { road3.y = road2.y - road1.height; }

if (Keys["ArrowRight"] === true) { car1.speedX = 6; }
if (Keys["ArrowLeft"] === true) { car1.speedX = -6; }
if (Keys["ArrowRight"] === false && Keys["ArrowLeft"] === false) { car1.speedX = 0; }

if (car2.y > screen.availHeight)
{
car2.x = rnd(100, screen.availWidth - 200); 
car2.y = rnd(-325, -650);
}

if (car3.y > screen.availHeight)
{
car3.x = rnd(340, screen.availWidth - 220); 
car3.y = rnd(-900, -1255);
}

if (car4.y > screen.availHeight)
{
car4.x = rnd(500, screen.availWidth - 230); 
car4.y = rnd(-1650, -2500);
}

if (car5.y > screen.availHeight)
{
car5.x = rnd(800, screen.availWidth - 250); 
car5.y = rnd(-3000, -3650);
}




DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.