sfml framework

The Partridge Family were neither partridges nor a family. Discuss.
xu2201g
Posts: 33
Joined: April 19th, 2017, 12:49 pm
Location: Germany

Re: sfml framework

Post by xu2201g » June 10th, 2017, 6:30 am

Hi there,
worked a bit on the next chapters of the book, which transform the snake game into a classic sidescroller like mario. It took me some time to understand most stuff used in those, but i made it running, after fixing some bugs(you can see some in the commit history).

New features implemented:
+ game map class
- using a map <idMap, pointer<tile>> //the actual map with a reference to the tile the id is holding
- using a set <idSet, pointer<tileInfo>> //set of all possible tiles/segments of a map

- the 1d idMap is converted into 2d (x,y) coordinates
- the gamemap is loaded from file and provides a warp tile to get into the next gamemap
- there are deadly tiles as well - if entities collide with them they die

+ entity manager (with entity base -> character -> player|enemy)
- handles entity construction, destruction and collisions (with gamemap and between entities)
- player and enemies have hp and can kill each other with a little knockback animation for succesfull hits

I not deviated much from the way the author solved the problems to create a 2d sidescroller so far.

It looks the like:
Image

Now iam wondering what to do next. I could goon with the next chapters, modify the sidescroller to another game to consolidate the new learned stuff and to prove if im not only monkey see monkey do like copied the stuff or i could start to create a new project in the chili framework reinventing the whole stuff i made about with a minumum of peeking in the book.

The next chapters are about transforming the sidescroller in a classic 2d roleplay game with orthographic projection using the entity–component–system pattern.
https://en.wikipedia.org/wiki/Entity%E2 ... 0%93system
http://gameprogrammingpatterns.com/component.html

What do u guys recommend?

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: sfml framework

Post by chili » June 10th, 2017, 6:52 am

xu2201g wrote: modify the sidescroller to another game to consolidate the new learned stuff and to prove if im not only monkey see monkey do like copied the stuff
I vote for this. Later on after some more experience you can try the isometric game with ECS. It sounds like a fun project, but would likely also be rather monumental and there is a not insignificant chance of giving up midway through.

The screenshot of the platformer looks good man.
Chili

xu2201g
Posts: 33
Joined: April 19th, 2017, 12:49 pm
Location: Germany

Re: sfml framework

Post by xu2201g » June 10th, 2017, 10:31 am

Allright,
ill give it a shot and iam already thinking of some kind of spaceshooter. Those sprites used re mostly from opengameart.org btw. I dont ve much experience in designing game art.

xu2201g
Posts: 33
Joined: April 19th, 2017, 12:49 pm
Location: Germany

Re: sfml framework

Post by xu2201g » June 10th, 2017, 12:24 pm

I guess its a bit inconvenient to get the projects running from github so ive packed those .exe, .dlls and asset files together to make it a bit easier to test them.
Attachments
snake.rar
Snake - removed some stuff i forget about like unnecessary .dlls
(904.4 KiB) Downloaded 122 times
spaceshooter.rar
Spaceshooter
(1.03 MiB) Downloaded 121 times
platformer.rar
Platformer
(1.03 MiB) Downloaded 128 times

xu2201g
Posts: 33
Joined: April 19th, 2017, 12:49 pm
Location: Germany

Re: sfml framework

Post by xu2201g » June 10th, 2017, 8:24 pm

I made some adjustments to the sidescroller and now it looks like that:
Image

There is only one enemy type atm and only one projectile type, but ill implement more soon.
Creating the gamemap only from file is a pain in the arse, thatswhy it is very sparse. I guess it would make sense to make some kind of editor for that.

The viewspace is scrolling on itself horizontally and centers vertically the playership. Hits by rockets oneshot atm. and there is entity to entity collision which reduces the hp by 1 so far.
Entity to gamemap collision does no dmg atm.
There is much to do to make this a real game, but i think its some kind of good start.

Ill attach it and if u want to disable the automatic scrolling just set SCROLLPIXELPERSECOND to 0 in the map1.map in the assets folder.

I made the sprites with paint this time hope you dont get aids from watching them.

Feel free to give me some feedback.

xu2201g
Posts: 33
Joined: April 19th, 2017, 12:49 pm
Location: Germany

Re: sfml framework

Post by xu2201g » June 14th, 2017, 5:47 pm

Well, totally forgot to attach the demo in the last post...
I added a new firemode for the player and u can toggle it by pressing 'q'. (it ll be toggled by powerups later) Firing rockets is bound to 'f'. U can look up the key bindings in the controls.txt or in the key.cfg file which uses sfml keycodes. I have not much time this week, but ill try to improve the game at the weekend. I lack a bit creativity, so if u ve some ideas what would improve the content dont hesitate to tell me.
Attachments
spaceshooter.rar
(957.46 KiB) Downloaded 124 times

User avatar
Zedtho
Posts: 189
Joined: February 14th, 2017, 7:32 pm

Re: sfml framework

Post by Zedtho » June 17th, 2017, 7:21 pm

I made some adjustments
It looks like a completely new game to me, this looks really cool!

xu2201g
Posts: 33
Joined: April 19th, 2017, 12:49 pm
Location: Germany

Re: sfml framework

Post by xu2201g » June 18th, 2017, 12:17 am

Thanks, that was my intention :)
To learn more about ways to build a solid framework, which can transform into different kinds of games with not too much effort. I ve added powerups now, which re dropped by destroyed enemy entities and improve the firemode, like u could do by yourself pressing q. I guess the next thing is to create some kind of map editor to make some maps. After that i ll goon with the next chapters about Entity Component Systems.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: sfml framework

Post by chili » June 18th, 2017, 5:05 am

I just checked these games out. Looks pretty cool! Platformer jumping physics looks decent. That's usually a hard part to get down.

It seems you have the collision logic in EntityBase, but in an ECS system you'd probably end up having that as part of a component.
Chili

xu2201g
Posts: 33
Joined: April 19th, 2017, 12:49 pm
Location: Germany

Re: sfml framework

Post by xu2201g » June 19th, 2017, 1:45 am

Added some kind of simple editor as a new state. You can select it in the main menu and even toggle between the game and the editor. The functionality is pretty simple. You select a tile of the game map and a tile of the tile set with the mouse (leftclick) and with space the tile ll be placed.

I want to implement at least also.

- new/save/load
- placing/removing entities (enemies, powerups etc.)
- overwriting already placed/existing tiles

The best way to manage attachments is to place the latest version of the game at the first page of the thread or what do you say?

Thanks for the response, i dont use ECS yet. I want to play around with the codebase to understand it better before i go on with the next chapters, covering ecs, gui, sound and networking.
Attachments
spaceshooter.rar
editor added
(963.66 KiB) Downloaded 113 times

Post Reply